Skip to content
Snippets Groups Projects
Commit 6915d55c authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Fix version string in docs. Update CONTRIBUTING.

parent 70901aae
No related branches found
No related tags found
No related merge requests found
Pipeline #67948 passed
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
**/build **/build
# pdm dev environment # dev environment
**/.venv **/.venv
.pdm-python
# build artifacts # build artifacts
dist dist
......
...@@ -20,37 +20,35 @@ a local clone of your fork. ...@@ -20,37 +20,35 @@ a local clone of your fork.
### Set up your dev environment ### Set up your dev environment
`pystencils-sfg` uses [`pdm`](https://pdm-project.org) for managing a virtual development environment. Create a virtual environment using either `venv` or `virtualenv` and install the pystencils-sfg source tree
Install `pdm` through your system's package manager and run `pdm sync` in your cloned project directory. into it using an editable install, e.g. by running the following commands in the `pystencils-sfg` project root directory:
It will set up a virtual environment in the subfolder `.venv`, installing all project dependencies into it.
The `pystencils-sfg` package itself is also installed in editable mode. ```bash
You can activate the virtual environment using `eval $(pdm venv activate)`. python -m virtualenv .venv
source .venv/bin/activate
pip install -e .
```
### Code Style and Type Checking ### Code Style and Type Checking
To contribute, please adhere to the Python code style set by [PEP 8](https://peps.python.org/pep-0008/). To contribute, please adhere to the Python code style set by [PEP 8](https://peps.python.org/pep-0008/).
It is recommended that you use the [black](https://pypi.org/project/black/) formatter to format your source files. For consistency, format all your source files using the [black](https://pypi.org/project/black/) formatter.
Use flake8 (installed in the `pdm` virtual environment) to check your code style: Use flake8 to check your code style:
```shell ```shell
pdm run flake8 src/pystencilssfg
# or, if .venv is activated
flake8 src/pystencilssfg flake8 src/pystencilssfg
``` ```
Further, `pystencils-sfg` takes a rigorous approach to correct static typing. Further, `pystencils-sfg` is being fully type-checked using [MyPy](https://www.mypy-lang.org/).
All submitted code should contain type annotations ([PEP 484](https://peps.python.org/pep-0484/)) and must be All submitted code should contain type annotations ([PEP 484](https://peps.python.org/pep-0484/)) and must be
correctly statically typed. correctly statically typed.
To check types, we use [MyPy](https://www.mypy-lang.org/), which is automatically installed in the dev environment Before each commit, check your types by calling
and can be invoked as
```shell ```shell
pdm run mypy src/pystencilssfg
# or, if .venv is activated
mypy src/pystencilssfg mypy src/pystencilssfg
``` ```
Both `flake8` and `mypy` are also run in the integration pipeline. Both `flake8` and `mypy` are also run in the integration pipeline.
It is furthermore recommended to run both checkers as a git pre-commit hook. You can automate the code quality checks by running them via a git pre-commit hook.
Such a hook can be installed using the [`install_git_hooks.sh`](install_git_hooks.sh) script located at the project root. Such a hook can be installed using the [`install_git_hooks.sh`](install_git_hooks.sh) script located at the project root.
from pystencilssfg import __version__ as sfg_version
from packaging.version import Version
# Configuration file for the Sphinx documentation builder. # Configuration file for the Sphinx documentation builder.
# #
# For the full list of built-in configuration values, see the documentation: # For the full list of built-in configuration values, see the documentation:
...@@ -9,7 +12,13 @@ ...@@ -9,7 +12,13 @@
project = "pystencils-sfg" project = "pystencils-sfg"
copyright = "2024, Frederik Hennig" copyright = "2024, Frederik Hennig"
author = "Frederik Hennig" author = "Frederik Hennig"
release = "0.0a"
parsed_version = Version(sfg_version)
version = ".".join([parsed_version.public])
release = sfg_version
html_title = f"pystencils-sfg v{version} Documentation"
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
......
#!/bin/bash #!/bin/bash
echo "[Pre-Commit] Checking code style" echo "[Pre-Commit] Checking code style"
pdm run flake8 src/pystencilssfg flake8 src/pystencilssfg
status=$? status=$?
if [ ${status} != 0 ]; then if [ ${status} != 0 ]; then
...@@ -11,7 +11,7 @@ else ...@@ -11,7 +11,7 @@ else
fi fi
echo "[Pre-Commit] Checking types" echo "[Pre-Commit] Checking types"
pdm run mypy src/pystencilssfg mypy src/pystencilssfg
status=$? status=$?
if [ ${status} != 0 ]; then if [ ${status} != 0 ]; then
exit 1 exit 1
......
...@@ -29,6 +29,7 @@ interactive = [ ...@@ -29,6 +29,7 @@ interactive = [
testing = [ testing = [
"flake8>=6.1.0", "flake8>=6.1.0",
"mypy>=1.7.0", "mypy>=1.7.0",
"black"
] ]
docs = [ docs = [
"sphinx", "sphinx",
...@@ -36,7 +37,8 @@ docs = [ ...@@ -36,7 +37,8 @@ docs = [
"myst-parser", "myst-parser",
"sphinx_design", "sphinx_design",
"sphinx_autodoc_typehints", "sphinx_autodoc_typehints",
"sphinx-copybutton" "sphinx-copybutton",
"packaging"
] ]
[tool.versioneer] [tool.versioneer]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment