From 61a414e3acd60000ebe48a0780bdd85fd384c35d Mon Sep 17 00:00:00 2001 From: bronsen Date: Tue, 18 Mar 2025 11:35:16 +0100 Subject: [PATCH 1/7] [project meta,pdm] move version information to config package --- VERSION.py | 3 --- config/__init__.py | 3 +++ pyproject.toml | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 VERSION.py diff --git a/VERSION.py b/VERSION.py deleted file mode 100644 index 5b3bd62..0000000 --- a/VERSION.py +++ /dev/null @@ -1,3 +0,0 @@ -# calver schema YYYY.0M.Micro (see also https://calver.org/#scheme) - -__version__ = "2025.03.3" diff --git a/config/__init__.py b/config/__init__.py index e69de29..5b3bd62 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -0,0 +1,3 @@ +# calver schema YYYY.0M.Micro (see also https://calver.org/#scheme) + +__version__ = "2025.03.3" diff --git a/pyproject.toml b/pyproject.toml index 667696a..2fc02cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,6 @@ show_missing = true [tool.coverage.run] omit = [ "*/migrations/*", - "VERSION.py", "manage.py", "config/[aw]sgi.py", ] @@ -49,4 +48,4 @@ build-backend = "pdm.backend" [tool.pdm.version] source = "file" -path = "./VERSION.py" +path = "config/__init__.py" From 2070318cede7f07ed3895e3ce1e8865cf2fe2016 Mon Sep 17 00:00:00 2001 From: bronsen Date: Tue, 18 Mar 2025 11:45:42 +0100 Subject: [PATCH 2/7] [dependencies] add pymarkdownlnt to lint markdown files mind the package name: it is pymarkdonlnt (l-n-t) --- justfile | 5 ++++- requirements/dev.in | 1 + requirements/dev.txt | 10 ++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/justfile b/justfile index 58c3d1c..9ffac81 100644 --- a/justfile +++ b/justfile @@ -6,7 +6,7 @@ sync: freshdeps: deps sync -lint: lint-ruff lint-django lint-woodpecker +lint: lint-ruff lint-django lint-woodpecker lint-markdown lint-ruff: ruff check . @@ -18,6 +18,9 @@ lint-django: lint-woodpecker: -woodpecker-cli lint .woodpecker/workflow.yaml +lint-markdown: + pymarkdown scan . + serve: python -m django runserver diff --git a/requirements/dev.in b/requirements/dev.in index 4a9c2d2..45f88d4 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -8,3 +8,4 @@ rich # pretty exceptions on dev/console ruff # linter uv # resolver for pip-compile-multi genbadge[tests,coverage] # create badges from coverage reports and pytest +pymarkdownlnt # lint markdown files, note: it's "lnt" at the end, not "lint" diff --git a/requirements/dev.txt b/requirements/dev.txt index 6c6128c..e6b7f0f 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,4 @@ -# SHA1:c1b1a9cb6cb941c70ba198b50670c6604e0daead +# SHA1:0fe30e8de6a24fe0b1d50d82a23038919d203909 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -6,11 +6,13 @@ # pip-compile-multi # -r test.txt +application-properties==0.8.2 asttokens==3.0.0 build==1.2.2.post1 certifi==2025.1.31 charset-normalizer==3.4.1 click==8.1.8 +columnar==1.4.1 decorator==5.2.1 defusedxml==0.7.1 django-debug-toolbar==5.0.1 @@ -35,16 +37,20 @@ prompt-toolkit==3.0.50 ptyprocess==0.7.0 pure-eval==0.2.3 pygments==2.19.1 +pymarkdownlnt==0.9.29 pyproject-hooks==1.2.0 +pyyaml==6.0.2 requests==2.32.3 rich==13.9.4 ruff==0.11.0 setuptools==76.0.0 stack-data==0.6.3 +tomli==2.2.1 +toolz==1.0.0 toposort==1.10 traitlets==5.14.3 types-pyyaml==6.0.12.20241230 urllib3==2.3.0 -uv==0.6.6 +uv==0.6.7 wcwidth==0.2.13 wheel==0.45.1 From c9cc55e439d1833f258be4a94af872f3edf4900b Mon Sep 17 00:00:00 2001 From: bronsen Date: Tue, 18 Mar 2025 11:46:15 +0100 Subject: [PATCH 3/7] [just] explain `-` in woodpecker recipe --- justfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/justfile b/justfile index 9ffac81..dd85095 100644 --- a/justfile +++ b/justfile @@ -16,6 +16,8 @@ lint-django: python -m django validate_templates lint-woodpecker: + @# allowed to fail because woodpecker-cli requires installation of homebrew + @# beforehand and not everyone will want to do that -woodpecker-cli lint .woodpecker/workflow.yaml lint-markdown: From 95905709d9d55bf45f0163756228ac0790a4194e Mon Sep 17 00:00:00 2001 From: bronsen Date: Tue, 18 Mar 2025 11:46:58 +0100 Subject: [PATCH 4/7] [readme] some more structure in README file --- README.md | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 30c13ab..ff8c6d3 100644 --- a/README.md +++ b/README.md @@ -9,29 +9,35 @@ ## Development -This project makes use of [direnv] and [just]. +This project makes use of several tools: -[direnv] is used to set up environment variables and activate the virtualenv. I -recommend installing it and integrate it into your favourite shell. It works -well with fish shell. - -[just] is used as a task runner. - -[woodpecker-cli] is used to lint `.woodpecker/workflow.yaml`. It is available +* [direnv] is used to set up environment variables and activate the virtualenv. I +recommend installing it and integrate it into your favourite shell. +* [just] is used as a task runner. +* [woodpecker-cli] is used to lint `.woodpecker/workflow.yaml`. It is available from [homebrew]. - -[pytest] is the test runner. Invoke it using `just test` (any arguments will be +* [pytest] is the test runner. Invoke it using `just test` (any arguments will be passed through to pytest). + Several pytest-plugins are used: + * [hypothesis] + * [pytest-django] + * [pytest-cov] ### Getting started +#### Python + Have Python >= 3.12 installed. I recommend [pyenv] (which in turn is easily installed by [homebrew]). +#### PostgreSQL + Set up PostgreSQL, a role and a schema. I have it on localhost, using the project name for role and schema name, and password. See `.env.test` for providing connection information. +#### Get the code + Clone the repo. `cd` into the project directory. ([direnv] should activate the virtualenv.) Run `python -m pip install -U pip` to upgrade pip. Then `python -m pip install -r requirements/dev.txt`. @@ -82,6 +88,8 @@ testing requirements and development tools. A useful command is `pip-sync requirements/dev.txt`, it uninstalls packages from your virtualenv that aren't explicitly specified as dependencies. +---- + [pip-compile-multi]: https://pypi.org/project/pip-compile-multi/ [direnv]: https://direnv.net/ [just]: https://just.systems/ @@ -89,3 +97,6 @@ from your virtualenv that aren't explicitly specified as dependencies. [homebrew]: https://brew.sh/ [pytest]: https://pytest.org/ [woodpecker-cli]: https://formulae.brew.sh/formula/woodpecker-cli +[hypothesis]: https://hypothesis.readthedocs.io/en/latest/ +[pytest-django]: https://pytest-django.readthedocs.io/en/latest/ +[pytest-cov]: https://pytest-cov.readthedocs.io/en/latest/ From 064bf1db3676d762a3aac7d378f991fefcb0ac4a Mon Sep 17 00:00:00 2001 From: bronsen Date: Tue, 18 Mar 2025 14:47:38 +0100 Subject: [PATCH 5/7] [readme] add TOC and conform to linter suggestions --- README.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ff8c6d3..fbfbaac 100644 --- a/README.md +++ b/README.md @@ -7,21 +7,35 @@ ![Tests Status](./docs/tests-badge.svg) ![Coverage Status](./docs/coverage-badge.svg) + + +- [Development](#development) + - [Getting started](#getting-started) + - [Python](#python) + - [PostgreSQL](#postgresql) + - [Get the code](#get-the-code) + - [Making changes](#making-changes) + - [Using the App](#using-the-app) +- [Dependency management](#dependency-management) + - [Installing dependencies](#installing-dependencies) + + + ## Development This project makes use of several tools: -* [direnv] is used to set up environment variables and activate the virtualenv. I +- [direnv] is used to set up environment variables and activate the virtualenv. I recommend installing it and integrate it into your favourite shell. -* [just] is used as a task runner. -* [woodpecker-cli] is used to lint `.woodpecker/workflow.yaml`. It is available +- [just] is used as a task runner. +- [woodpecker-cli] is used to lint `.woodpecker/workflow.yaml`. It is available from [homebrew]. -* [pytest] is the test runner. Invoke it using `just test` (any arguments will be +- [pytest] is the test runner. Invoke it using `just test` (any arguments will be passed through to pytest). Several pytest-plugins are used: - * [hypothesis] - * [pytest-django] - * [pytest-cov] + - [hypothesis] + - [pytest-django] + - [pytest-cov] ### Getting started From 0b3a0cffb7ffe9f56f022c115d0ff43d0f83b54e Mon Sep 17 00:00:00 2001 From: bronsen Date: Tue, 18 Mar 2025 14:52:34 +0100 Subject: [PATCH 6/7] [gitignore] ignore generated and purely local files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index dd54bcd..e7c172c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ teile-db.json +readme.html +todo.txt +reports/ From 7028a03f5c916e6c92ada430e8a85947985b8b45 Mon Sep 17 00:00:00 2001 From: bronsen Date: Tue, 18 Mar 2025 18:32:38 +0100 Subject: [PATCH 7/7] [readme] rebuild TOC --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index fbfbaac..5283c1b 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,21 @@ ![Coverage Status](./docs/coverage-badge.svg) - -- [Development](#development) - - [Getting started](#getting-started) - - [Python](#python) - - [PostgreSQL](#postgresql) - - [Get the code](#get-the-code) - - [Making changes](#making-changes) - - [Using the App](#using-the-app) -- [Dependency management](#dependency-management) - - [Installing dependencies](#installing-dependencies) - +- [Teilchensammler: Collect parts in a list](#teilchensammler-collect-parts-in-a-list) + - [Badges](#badges) + - [Development](#development) + - [Getting started](#getting-started) + - [Python](#python) + - [PostgreSQL](#postgresql) + - [Get the code](#get-the-code) + - [Making changes](#making-changes) + - [Using the App](#using-the-app) + - [Dependency management](#dependency-management) + - [Installing dependencies](#installing-dependencies) + - [More on tools that are used](#more-on-tools-that-are-used) + - [Direnv (automatic venv)](#direnv-automatic-venv) + - [Subshells or Shells started from Editors](#subshells-or-shells-started-from-editors) + - [just](#just) ## Development @@ -46,9 +50,11 @@ installed by [homebrew]). #### PostgreSQL -Set up PostgreSQL, a role and a schema. I have it on localhost, using the -project name for role and schema name, and password. See `.env.test` for -providing connection information. +Set up PostgreSQL, a role and a schema. + +I have it on localhost, using the project name for role and schema name, and +password. Using a VM, docker or even a remote instance is possible: See +`.env.test` for providing connection information. #### Get the code @@ -62,19 +68,20 @@ don't have just). ### Making changes Change code, settings, templates, dependencies as you see fit. Run `just lint` -repeatedly. Don't forget migrations. Commit often. +repeatedly. Don't forget migrations. Commit often. Please add tests. ### Using the App `just serve` and open -[localhost:8000/collector](http://localhost:8000/collector/) in your browser. +[localhost:8000/](http://localhost:8000/collector/) in your browser. Start +entering Teile. ## Dependency management This project uses [pip-compile-multi] for hard-pinning dependencies versions. Please see its documentation for usage instructions. In short, -`requirements/base.in` contains the list of direct requirements with occasional -version constraints (like `Django<2`) and `requirements/base.txt` is +`requirements/prod.in` contains the list of direct requirements with occasional +version constraints (like `Django<2`) and `requirements/prod.txt` is automatically generated from it by adding recursive tree of dependencies with fixed versions. The same goes for `test` and `dev`. @@ -102,6 +109,33 @@ testing requirements and development tools. A useful command is `pip-sync requirements/dev.txt`, it uninstalls packages from your virtualenv that aren't explicitly specified as dependencies. +## More on tools that are used + +These are not strictly necessary but very convenient. + +### Direnv (automatic venv) + +When direnv is [integrated into the shell](https://direnv.net/docs/hook.html) +entering the project directory for the first time will cause direnv to create a +hidden directory for the virtual environment. + +It will also activate that existing virtualenv automatically upon entering the +project directory. + +#### Subshells or Shells started from Editors + +If your editor spawns a shell window or new terminal, it might be necessary to +`direnv reload` before running any commands. This will make sure direnv has +things set up. neovim's terminal requires this. + +### just + +[just] is used as a task runner. Think "makefile" but less confusing. (make is +a build tool and task runner and much more, just intends to be a task runner.) + +If you don't want to install just, you can still look at its `justfile` to see +how test runners, linters, dev servers and such are to be executed. + ---- [pip-compile-multi]: https://pypi.org/project/pip-compile-multi/