diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..753bd53 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [main, dev] + pull_request: + branches: [main, dev] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ["3.11", "3.12"] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + + - name: Install dependencies + run: pip install -e ".[dev]" + + - name: Lint with ruff + run: ruff check . + + - name: Check formatting + run: ruff format --check . + + - name: Run tests with coverage + run: pytest --cov=mathlib --cov-report=term-missing \ No newline at end of file diff --git a/.gitignore b/.gitignore index b7faf40..672bc0f 100644 --- a/.gitignore +++ b/.gitignore @@ -205,3 +205,7 @@ cython_debug/ marimo/_static/ marimo/_lsp/ __marimo__/ + + +# VsCode settings +.vscode/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..303bfd6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.defaultInterpreterPath": ".venv/Scripts/python", + "editor.formatOnSave": true, + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff" + } +} \ No newline at end of file diff --git a/pymath/__init__.py b/pymath/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pymath/arithmetic.py b/pymath/arithmetic.py new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..36e2d69 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[build-system] +requires = ["setuptools>=68"] +build-backend = "etuptools.build_meta" + +[project] +name = "mathlib" +version = "0.1.0" +description = "A math library built for learning" +requires-python = ">=3.11" + +[project.optional-dependencies] +dev = [ + "pytest>=8.0", + "pytest-cov", # coverage reports + "ruff", # linting + formatting (replaces flake8+black) +] + +[tool.ruff] +line-length = 88 + +[tool.ruff.lint] +select = ["E", "F", "W"] # pycodestyle + pyflakes rules + +[tool.pytest.ini_options] +testpaths = ["tests"] + +[tool.coverage.report] +omit = ["tests/*"] diff --git a/setup b/setup new file mode 100644 index 0000000..9558f00 --- /dev/null +++ b/setup @@ -0,0 +1,27 @@ +# Create venv (do this once per machine) +python -m venv .venv + +# Activate — Linux/Mac +source .venv/bin/activate + +# Activate — Windows (VSCode terminal) +.venv\Scripts\activate + +# Install the project in editable mode + dev tools +pip install -e ".[dev]" +``` + +The `-e` flag means **editable install** — changes to your `mathlib/` code take effect immediately without reinstalling. + +--- + +### 4. `.gitignore` +``` +.venv/ +__pycache__/ +*.pyc +.coverage +htmlcov/ +dist/ +*.egg-info/ +.vscode/ \ No newline at end of file diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test_arithmetic.py b/test/test_arithmetic.py new file mode 100644 index 0000000..e69de29