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 merge requests found
Pipeline #67948 passed with stages
in 4 minutes and 14 seconds
......@@ -7,9 +7,8 @@
**/build
# pdm dev environment
# dev environment
**/.venv
.pdm-python
# build artifacts
dist
......
......@@ -20,37 +20,35 @@ a local clone of your fork.
### Set up your dev environment
`pystencils-sfg` uses [`pdm`](https://pdm-project.org) for managing a virtual development environment.
Install `pdm` through your system's package manager and run `pdm sync` in your cloned project 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.
You can activate the virtual environment using `eval $(pdm venv activate)`.
Create a virtual environment using either `venv` or `virtualenv` and install the pystencils-sfg source tree
into it using an editable install, e.g. by running the following commands in the `pystencils-sfg` project root directory:
```bash
python -m virtualenv .venv
source .venv/bin/activate
pip install -e .
```
### Code Style and Type Checking
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.
Use flake8 (installed in the `pdm` virtual environment) to check your code style:
For consistency, format all your source files using the [black](https://pypi.org/project/black/) formatter.
Use flake8 to check your code style:
```shell
pdm run flake8 src/pystencilssfg
# or, if .venv is activated
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
correctly statically typed.
To check types, we use [MyPy](https://www.mypy-lang.org/), which is automatically installed in the dev environment
and can be invoked as
Before each commit, check your types by calling
```shell
pdm run mypy src/pystencilssfg
# or, if .venv is activated
mypy src/pystencilssfg
```
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.
from pystencilssfg import __version__ as sfg_version
from packaging.version import Version
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
......@@ -9,7 +12,13 @@
project = "pystencils-sfg"
copyright = "2024, 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 ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
......
#!/bin/bash
echo "[Pre-Commit] Checking code style"
pdm run flake8 src/pystencilssfg
flake8 src/pystencilssfg
status=$?
if [ ${status} != 0 ]; then
......@@ -11,7 +11,7 @@ else
fi
echo "[Pre-Commit] Checking types"
pdm run mypy src/pystencilssfg
mypy src/pystencilssfg
status=$?
if [ ${status} != 0 ]; then
exit 1
......
......@@ -29,6 +29,7 @@ interactive = [
testing = [
"flake8>=6.1.0",
"mypy>=1.7.0",
"black"
]
docs = [
"sphinx",
......@@ -36,7 +37,8 @@ docs = [
"myst-parser",
"sphinx_design",
"sphinx_autodoc_typehints",
"sphinx-copybutton"
"sphinx-copybutton",
"packaging"
]
[tool.versioneer]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment