diff --git a/.gitignore b/.gitignore index 117c817abe52b602c4bc6f6474d10e57220724f5..65c40647dfc694cf861ac9f1ea2ffb05de4d12f2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,8 @@ **/build -# pdm dev environment +# dev environment **/.venv -.pdm-python # build artifacts dist diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e1126448741c2589f275d4bf011121e5097c813..ef8905c158e1336ca6909f9c5273cbafc9a39250 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/docs/source/conf.py b/docs/source/conf.py index 8a8d28d25178ddcdcbd34c962e9a7cca554e0319..84c2b779b553fe22fa8ef23a2f0a4872c9edb57c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,3 +1,6 @@ +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 diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index 901668520bdbab97a13aa521b7050e5e12dfd1fe..aaa96f6dd731fe45db7230987e9959cb446a5a03 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -1,7 +1,7 @@ #!/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 diff --git a/pyproject.toml b/pyproject.toml index 5b4e66b32136796c2f1b2cc2494b4a2054cedad8..6812c5532412ce39a466c062e6eff6c89fef7c03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]