Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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: |
Expand Down
99 changes: 49 additions & 50 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
11 changes: 8 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------

project = 'my_package'
copyright = '2022, Author Name'
copyright = '2026, Author Name'
author = 'Author Name'


Expand All @@ -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

Expand All @@ -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,
Expand Down
21 changes: 14 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ classifiers = [
]
requires-python = ">=3.9"
dependencies = [
"numpy",
"numpy>=1.20",
]
dynamic = ['version']

Expand All @@ -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 = [
Expand All @@ -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',
Expand All @@ -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",
]

Loading