diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index babbb94..58d2b12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/setup-python@v5 with: fetch-depth: 0 @@ -26,12 +26,20 @@ jobs: python -m pip install --upgrade pip pip install ".[test]" - - name: Lint with flake8 + - name: Run coverage with pytest run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + pytest --cov --cov-report=xml + + - name: Build sanity check + run: | + python -m pip install build + python -m build + + - name: Lint with Ruff + run: | + python -m pip install ruff + ruff check . + ruff format --check . - name: Test with pytest run: | diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7366f11..fecb979 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,56 +1,55 @@ -name: sphinxdocumentation +name: docs -on: [push] +on: + push: + branches: ["main"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true jobs: build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - - name: Install docs dependencies - run: | - pip install --upgrade pip - pip install -e ".[docs]" - - - name: Build docs - working-directory: ./docs - run: | - make html -# uses: ammaraskar/sphinx-action@master -# with: -# docs-folder: "docs/" - - # Publish built docs to gh-pages branch. - # =============================== - - name: Commit documentation changes - run: | - git clone https://github.com/ammaraskar/sphinx-action-test.git --branch gh-pages --single-branch gh-pages - cp -r docs/_build/html/* gh-pages/ - cd gh-pages - touch .nojekyll - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add . - git commit -m "Update documentation" -a || true - # The above command will fail if no changes were present, so we ignore - # that. - - name: Push changes - uses: ad-m/github-push-action@master - with: - branch: gh-pages - directory: gh-pages - github_token: ${{ secrets.GITHUB_TOKEN }} - force: true - # =============================== + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: "pip" + + - name: Install docs dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[docs]" + + - name: Build Sphinx HTML + run: | + make -C docs html + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/_build/html + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a14c9ee --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-yaml + - id: check-toml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-added-large-files + - id: check-merge-conflict + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.9.9 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..237721d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,34 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [Unreleased] + +### Added +- New features in development + +### Changed +- Updates to existing functionality + +### Deprecated +- Features planned for removal + +### Removed +- Removed features + +### Fixed +- Bug fixes + +### Security +- Security vulnerability fixes + +## [0.1.0] - 2024-01-01 + +### Added +- Initial project setup +- Basic project structure +- Core functionality +- Documentation + +[Unreleased]: https://github.com/yourusername/mpia-python-template/compare/v0.1.0...HEAD +[0.1.0]: https://github.com/yourusername/mpia-python-template/releases/tag/v0.1.0 \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 3d05e35..8837afb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,7 +18,7 @@ # -- Project information ----------------------------------------------------- project = 'my_package' -copyright = '2022, Author Name' +copyright = '2026, Author Name' author = 'Author Name' @@ -27,7 +27,12 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx_automodapi.automodapi' +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.napoleon', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode', + 'sphinx_automodapi.automodapi', # Common in astronomy projects for auto-generating module documentation ] numpydoc_show_class_members = False @@ -45,7 +50,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'furo' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/pyproject.toml b/pyproject.toml index 33d4c16..b63a4f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ classifiers = [ ] requires-python = ">=3.9" dependencies = [ - "numpy", + "numpy>=1.20", ] dynamic = ['version'] @@ -31,9 +31,9 @@ test = [ ] [project.urls] -"Bug Tracker" = "https://github.com/mpi-astronomy/snowblind/issues" -"Source Code" = "https://github.com/mpi-astronomy/snowblind" - +"Homepage" = "https://github.com/mpi-astronomy" +"Bug Tracker" = "https://github.com/mpi-astronomy/CHANGEME/issues" +"Source Code" = "https://github.com/mpi-astronomy/CHANGEME" [build-system] requires = [ @@ -49,8 +49,8 @@ write_to = "src/my_package/_version.py" [tool.setuptools.packages.find] where = ["src"] -[tool.flake8] -max-line-length = 130 +[tool.ruff] +line-length = 130 exclude = [ 'docs', '.tox', @@ -59,7 +59,14 @@ exclude = [ '*_version.py', ] +[tool.ruff.lint] +select = ['E', 'F', 'W'] + +[tool.ruff.format] +line-length = 130 + [tool.coverage.run] omit = [ - "_version.py", + "src/**/_version.py", ] +