-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from DuncDennis/develop_CICD_workflow
Develop cicd workflow
- Loading branch information
Showing
10 changed files
with
100 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: pre-commit | ||
on: [pull_request, push, workflow_dispatch] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
architecture: "x64" | ||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: "23.1.0" | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: 'v0.0.245' | ||
hooks: | ||
- id: ruff | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: 'v1.1.1' | ||
hooks: | ||
- id: mypy | ||
args: [--config-file=pyproject.toml] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,73 @@ | ||
# Changelog: | ||
|
||
--- | ||
### Pre-release status (13.03.2023): | ||
- Now using [pre-commit](https://pre-commit.com/) as an automatic CI tool. | ||
- pre-commit runs some standard hooks, black, ruff and mypy. | ||
- The config for black, ruff and mypy is still in `pyproject.toml` | ||
- To run the pre-commit manual, run `pre-commit run --all-files` | ||
- To reinstall the pre-commits, run `pre-commit install` | ||
- My pre-commit GH action is running on ubuntu on python3.9 | ||
- **Note:** There is some redundancy, as I have to specify the versions of | ||
black, ruff and mypy twice. Once in the `.pre-commit-config.yaml` and once in the | ||
`pyproject.toml`. | ||
Maybe I am only specifying which *hook* to use in the `.pre-commit-config.yaml`. | ||
- Q: | ||
- Should I add the tests also to pre-commit? | ||
- When to test? | ||
|
||
|
||
### Pre-release status (12.03.2023): | ||
### Pre-release status (12.03.2023): | ||
|
||
**Development features:** | ||
**Development features:** | ||
|
||
1. Use [Black](https://github.com/psf/black) for formatting the code. | ||
1. Use [Black](https://github.com/psf/black) for formatting the code. | ||
- Local terminal usage: `black .` | ||
- Config in `pyproject.toml` | ||
- Set line-length to `88`, set python versions to `py8`to `py11` | ||
- GitHub Actions: | ||
- GitHub Actions: | ||
- Just check with black by running: `black --check .` | ||
|
||
2. Use [Ruff](https://github.com/charliermarsh/ruff) as the Python linter. | ||
- Local terminal usage: `ruff check .` | ||
- Config in `pyproject.toml` | ||
- set line-length, the Rules (*pycodestyle*, *pyflakes*, *pydocstyle*, *isort*), | ||
the source files, and to ignore rule *F401* to not complain about unused imports | ||
in `__init__` files. | ||
- GitHub Actions: | ||
- set line-length, the Rules (*pycodestyle*, *pyflakes*, *pydocstyle*, *isort*), | ||
the source files, and to ignore rule *F401* to not complain about unused imports | ||
in `__init__` files. | ||
- GitHub Actions: | ||
- run `ruff check --format=github .` | ||
3. Use [MyPy](https://github.com/python/mypy) as for type checking. | ||
|
||
3. Use [MyPy](https://github.com/python/mypy) as for type checking. | ||
- Local terminal usage: `mypy` | ||
- Config in `pyproject.toml` | ||
- Specify files: `src/lorenzpy/` | ||
- Ignore missing imports for `plotly` | ||
- GitHub Actions: | ||
- GitHub Actions: | ||
- Just running `mypy` | ||
|
||
4. Testing with [pytest-cov](https://github.com/pytest-dev/pytest-cov) | ||
- Local terminal usage: `pytest` | ||
- Config in `pyproject.toml` | ||
- automatically add the following options when `pytest` is run: | ||
- automatically add the following options when `pytest` is run: | ||
- `--verbose --cov-config=pyproject.toml --cov-report term-missing --cov=lorenzpy` | ||
- Note: This is somehow important for GitHub actions to work fine... | ||
- Omit the `plot` folder for the coverage. | ||
- GitHub Actions: | ||
- Omit the `plot` folder for the coverage. | ||
- GitHub Actions: | ||
- simply running `pytest` and then uploading the coverage reports to [Codecov](https://about.codecov.io/) | ||
using the GitHub action: [codecov-action](https://github.com/codecov/codecov-action) | ||
|
||
5. Generating docs with [mkdocs](https://github.com/mkdocs/mkdocs): | ||
- Following [this tutorial](https://realpython.com/python-project-documentation-with-mkdocs/) | ||
- Generate the docs with `mkdocs gh-deploy` | ||
- Use the plugin [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings) to | ||
automatically use the code-docstrings in the documentation. | ||
|
||
**Deployment on PyPI**: | ||
**Deployment on PyPI with GitHub Actions**: | ||
- Following the [PyPA tutorial](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/) | ||
- Also use [this PyPA tutorial](https://packaging.python.org/en/latest/tutorials/packaging-projects/) to manually upload the package to test PyPI. | ||
- This uses `build` and `twine` | ||
|
||
**Resources**: | ||
Taking inspiration from: | ||
https://github.com/dkmiller/modern-python-package, and | ||
https://github.com/denkiwakame/py-tiny-pkg. | ||
**Resources**: | ||
Taking inspiration from: | ||
https://github.com/dkmiller/modern-python-package, and | ||
https://github.com/denkiwakame/py-tiny-pkg. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# Welcome to LorenzPy | ||
|
||
This site contains the documentation for the `LorenzPy` Python package | ||
that can be used to simulate and measure discrete and continuous chaotic dynamical | ||
This site contains the documentation for the `LorenzPy` Python package | ||
that can be used to simulate and measure discrete and continuous chaotic dynamical | ||
systems. | ||
|
||
## Contents: | ||
## Contents: | ||
|
||
1. [Reference](reference.md) The API reference. | ||
1. [Reference](reference.md) The API reference. | ||
|
||
## Project Overview: | ||
## Project Overview: | ||
::: lorenzpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
### LorenzPy package: | ||
::: lorenzpy | ||
|
||
### simulations module: | ||
### simulations module: | ||
::: lorenzpy.simulations | ||
|
||
### measures module: | ||
### measures module: | ||
::: lorenzpy.measures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
|
||
from . import measures, simulations | ||
|
||
__version__ = "0.1.0" | ||
__version__ = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters