Skip to content
Merged
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
23 changes: 18 additions & 5 deletions .github/workflows/check_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,25 @@ jobs:

- name: Run tests
run: |
mkdir summary
set +e
mkdir summary > /dev/null 2>&1 || echo
pytest --cov=python_ci_base --cov-report=markdown-append:summary/coverage.md --markdown-summary-file=summary/summary.md
echo -e "# Summary\n" >> $GITHUB_STEP_SUMMARY
cat summary/summary.md >> $GITHUB_STEP_SUMMARY
echo -e "\n# Coverage\n" >> $GITHUB_STEP_SUMMARY
cat summary/coverage.md >> $GITHUB_STEP_SUMMARY
EXIT_CODE=$?

set -e

if (( $EXIT_CODE == 5 )); then
echo "The test suite was empty. No summary generated."
echo -e "# Summary\n" >> $GITHUB_STEP_SUMMARY
echo -e "\n# Coverage\n" >> $GITHUB_STEP_SUMMARY
elif (( $EXIT_CODE == 0 )); then
echo -e "# Summary\n" >> $GITHUB_STEP_SUMMARY
cat summary/summary.md >> $GITHUB_STEP_SUMMARY
echo -e "\n# Coverage\n" >> $GITHUB_STEP_SUMMARY
cat summary/coverage.md >> $GITHUB_STEP_SUMMARY
else
exit $ExitCode
fi

# TODO: uncomment if you want to automate deployment to TestPyPI and PyPI

Expand Down
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.1
hooks:
- id: ruff-check
args: [ --output-format=github, --target-version=py314 ]
- id: ruff-format
args: [ --diff, --target-version=py314 ]

- repo: local
hooks:
- id: mypy
name: MyPy
language: python
entry: mypy
additional_dependencies: [ '.[pre_commit]' ]
types: [python]
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

The template sets up a simple continuous integration-pipeline for Python 3.14.

For every push and pull request, linting, format checking, static type checking, and tests are invoked:
For every pre-commit, push and pull request, linting, format checking, and static type checking are invoked:
* Ruff: Linting, Formatting
* MyPy: Code checking

Additionally, tests are run for pushes and pull requests (but not pre-hook):
* Tests: PyTest (with coverage)

The test summary and coverage are reported as an artifact.
Expand All @@ -23,6 +25,11 @@ Deployment to PyPI and TestPyPI is optional (see below).
pass
* Replace ``python_ci_base`` with the name of your app on all files and ``AUTHOR`` with your name
* Always use typing (if not, delete the py.typed file inside your package)
* Install pre-commit hooks:
```
pip install pre-commit
pre-commit install
```

If you want to enable automatic deployment to PyPI, proceed with the following steps:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def extract_info(*path: str, default: str = '') -> Any:
autosummary_generate = True

templates_path = ['_templates']
exclude_patterns = []
exclude_patterns: list[str] = []


# -- Options for HTML output -------------------------------------------------
Expand Down
10 changes: 0 additions & 10 deletions python_ci_base/app.py

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/build.sh

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/doc.sh

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/lint.sh

This file was deleted.

2 changes: 0 additions & 2 deletions tests/test_app.py

This file was deleted.