Compare commits

..

No commits in common. "7028a03f5c916e6c92ada430e8a85947985b8b45" and "56bbb93b1fd90c6a58c644f825e14b255fd171d5" have entirely different histories.

8 changed files with 25 additions and 98 deletions

3
.gitignore vendored
View file

@ -1,4 +1 @@
teile-db.json
readme.html
todo.txt
reports/

View file

@ -7,56 +7,30 @@
![Tests Status](./docs/tests-badge.svg)
![Coverage Status](./docs/coverage-badge.svg)
<!--toc:start-->
- [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)
<!--toc:end-->
## Development
This project makes use of several tools:
This project makes use of [direnv] and [just].
- [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
[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
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. Using a VM, docker or even a remote instance is possible: See
`.env.test` for providing connection information.
#### Get the code
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.
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
@ -68,20 +42,19 @@ 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. Please add tests.
repeatedly. Don't forget migrations. Commit often.
### Using the App
`just serve` and open
[localhost:8000/](http://localhost:8000/collector/) in your browser. Start
entering Teile.
[localhost:8000/collector](http://localhost:8000/collector/) in your browser.
## Dependency management
This project uses [pip-compile-multi] for hard-pinning dependencies versions.
Please see its documentation for usage instructions. In short,
`requirements/prod.in` contains the list of direct requirements with occasional
version constraints (like `Django<2`) and `requirements/prod.txt` is
`requirements/base.in` contains the list of direct requirements with occasional
version constraints (like `Django<2`) and `requirements/base.txt` is
automatically generated from it by adding recursive tree of dependencies with
fixed versions. The same goes for `test` and `dev`.
@ -109,35 +82,6 @@ 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/
[direnv]: https://direnv.net/
[just]: https://just.systems/
@ -145,6 +89,3 @@ how test runners, linters, dev servers and such are to be executed.
[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/

3
VERSION.py Normal file
View file

@ -0,0 +1,3 @@
# calver schema YYYY.0M.Micro (see also https://calver.org/#scheme)
__version__ = "2025.03.3"

View file

@ -1,3 +0,0 @@
# calver schema YYYY.0M.Micro (see also https://calver.org/#scheme)
__version__ = "2025.03.3"

View file

@ -6,7 +6,7 @@ sync:
freshdeps: deps sync
lint: lint-ruff lint-django lint-woodpecker lint-markdown
lint: lint-ruff lint-django lint-woodpecker
lint-ruff:
ruff check .
@ -16,13 +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:
pymarkdown scan .
serve:
python -m django runserver

View file

@ -35,6 +35,7 @@ show_missing = true
[tool.coverage.run]
omit = [
"*/migrations/*",
"VERSION.py",
"manage.py",
"config/[aw]sgi.py",
]
@ -48,4 +49,4 @@ build-backend = "pdm.backend"
[tool.pdm.version]
source = "file"
path = "config/__init__.py"
path = "./VERSION.py"

View file

@ -8,4 +8,3 @@ 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"

View file

@ -1,4 +1,4 @@
# SHA1:0fe30e8de6a24fe0b1d50d82a23038919d203909
# SHA1:c1b1a9cb6cb941c70ba198b50670c6604e0daead
#
# This file is autogenerated by pip-compile-multi
# To update, run:
@ -6,13 +6,11 @@
# 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
@ -37,20 +35,16 @@ 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.7
uv==0.6.6
wcwidth==0.2.13
wheel==0.45.1