Skip to content

Commit 02249d3

Browse files
committed
modernize & sync boilerplate
1 parent a5e50b3 commit 02249d3

9 files changed

Lines changed: 223 additions & 108 deletions

File tree

.gitignore

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#
1717
# - If there is a / at the end of the pattern then the pattern will only match directories,
1818
# otherwise the pattern can match both files and directories.
19-
19+
#
2020
# - Symlinks are always files, even if they point to a dir. So never put a / at the end.
2121

22-
# archived files
23-
/_archive/
22+
# exclude claude for now
23+
.claude
2424

2525
# dev-symlinks to .venv to make bin/python work
2626
/bin
@@ -29,16 +29,18 @@
2929
/pyvenv.cfg
3030

3131
# exclude actual virtual-environment
32-
/.venv/
32+
/.venv*
3333

34-
# distribution / packaging
34+
# default build directory
3535
/dist/
3636

3737
# .env can contain secrets
38-
/.env
39-
40-
# exclude toplevel var-dir
41-
/var/
38+
.env*
39+
# but include .env.template
40+
!.env.template
4241

43-
# exclude generated python-files Byte-compiled / optimized / DLL files
42+
# excluded generated python-files Byte-compiled / optimized / DLL files
4443
__pycache__/
44+
45+
# exclude toplevel var-dir
46+
/var/

.just/project.justfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# project
3+
4+
5+
# run all install-steps to full initial installation
6+
[group: 'project']
7+
install: create-dirs dotenv-install uv-sync-all-groups && symlink-venv-dirs
8+

.just/sphinx.justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sphinx-build-which:
99

1010
# generate sphinx-docs in var/html-docs
1111
[group: 'sphinx']
12-
sphinx-docs: uv-export-requirements-docs
12+
sphinx-docs:
1313
sphinx-build -b html -d var/cache/sphinx-doctrees -w var/log/sphinx-build.log docs var/html-docs
1414
@echo
1515
@echo "Build finished."

.just/uv.justfile

Lines changed: 104 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,135 @@
1-
# See ../justfile
1+
# uv
22

33

4-
# create the virtualenv
4+
# use existing env-variable 'UV_PYTHON_INSTALL_DIR' or default to '/opt/python'
5+
export UV_PYTHON_INSTALL_DIR := env('UV_PYTHON_INSTALL_DIR', '/opt/python')
6+
7+
# install uv/uvx directly in /opt/bin
8+
export UV_INSTALL_DIR := env('UV_INSTALL_DIR', '/usr/local/bin')
9+
export TMPDIR := env('TMPDIR', '/tmp')
10+
11+
12+
# install uv + uvx
513
[group: 'uv']
6-
uv-create-venv:
7-
uv venv --seed
14+
uv-install:
15+
@ echo "Using temp-folder {{TMPDIR}}"
16+
mkdir -p {{TMPDIR}}
17+
curl --create-dirs --fail --location --no-progress-bar --silent --show-error --proto '=https' --tlsv1.2 https://astral.sh/uv/install.sh | env INSTALLER_NO_MODIFY_PATH=1 bash -s -- --verbose
818

19+
alias install-uv := uv-install
920

10-
# run uv install to create the virtualenv
21+
22+
# upgrade uv itself
1123
[group: 'uv']
12-
uv-pip-install:
13-
uv pip install --editable .
24+
uv-upgrade target_version="":
25+
uv self update {{target_version}}
26+
27+
alias upgrade-uv := uv-upgrade
1428

1529

16-
# run uv install without dev-dependencies
30+
# show location of uv
1731
[group: 'uv']
18-
uv-pip-install-no-dev:
19-
uv pip install --no-dev
32+
uv-which:
33+
@ which uv
2034

35+
alias which-uv := uv-which
2136

22-
# run uv sync
37+
38+
# display uv version
2339
[group: 'uv']
24-
uv-sync:
25-
uv sync
40+
uv-version:
41+
uv --version
42+
43+
alias version-uv := uv-version
2644

2745

28-
# run uv lock
46+
# clear the cache used by uv
2947
[group: 'uv']
30-
uv-lock:
31-
uv lock
48+
uv-cache-clean *args:
49+
uv cache cleans {{args}}
3250

3351

34-
# run uv lock --upgrade
52+
# display cache-dir used by uv
3553
[group: 'uv']
36-
uv-lock-upgrade:
37-
uv lock --upgrade
54+
uv-cache-dir *args:
55+
uv cache dir {{args}}
3856

3957

40-
# run uv build to create the python-package
58+
# install the project and all dependencies from only the default groups
4159
[group: 'uv']
42-
uv-build:
43-
uv build --out-dir var/dist
60+
uv-sync *args:
61+
uv sync {{args}}
4462

63+
# alias uv-install := uv-sync
64+
alias create-venv := uv-sync
4565

46-
# publish the package to pypi
66+
67+
# install the project including all dependencies from all groups
4768
[group: 'uv']
48-
uv-publish:
49-
uv publish var/dist/*
69+
uv-sync-all-groups *args:
70+
uv sync --all-groups {{args}}
71+
72+
alias uv-sync-all := uv-sync-all-groups
5073

5174

52-
# generate a requirements.txt-file
75+
# install the project with only runtime dependencies (no dev groups)
76+
[group: 'uv']
77+
uv-sync-minimal *args:
78+
uv sync --no-default-groups {{args}}
79+
80+
alias uv-sync-prod := uv-sync-minimal
81+
82+
83+
# update all dependencies from all groups
84+
[group: 'uv']
85+
uv-sync-upgrade-all-groups *args:
86+
uv sync --upgrade --all-groups {{args}}
87+
88+
89+
# update uv.lock
90+
[group: 'uv']
91+
uv-lock *args:
92+
uv lock {{args}}
93+
94+
95+
# check uv.lock is up-to-date
96+
[group: 'uv']
97+
uv-lock-check *args:
98+
uv lock --check {{args}}
99+
100+
101+
# build the python-package
102+
[group: 'uv']
103+
uv-build *args:
104+
uv build {{args}}
105+
106+
107+
# publish the python-package
108+
[group: 'uv']
109+
uv-publish path="dist/" *args:
110+
uv publish {{path}} --verbose {{args}}
111+
112+
113+
# export uv-defined requirements to a pip-installable requirements-file
53114
[group: 'uv']
54115
uv-export-requirements:
55-
uv export --format requirements-txt --output-file requirements.txt
116+
uv export --format requirements-txt --no-hashes --output-file etc/requirements.txt
117+
@ echo -e "Updated etc/requirements.txt"
118+
119+
alias uv-export := uv-export-requirements
56120

57121

58-
# generate a requirements.txt-file for readthedocs
122+
# set python-version in .python-version file
59123
[group: 'uv']
60-
uv-export-requirements-docs:
61-
uv export --format requirements-txt --only-group docs --no-hashes --output-file docs/requirements.txt
124+
[unix]
125+
uv-set-python-version version="3.10" *args:
126+
mv .python-version .python-version.backup
127+
@ echo "{{version}}" > .python-version
128+
@ echo -e "Set python version to {{version}}"
129+
130+
131+
# bump project version in pyproject.toml
132+
[group: 'uv']
133+
uv-bump-version value="patch":
134+
uv version {{value}}
135+

justfile

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,61 @@
33
#
44
# Official docs:
55
# - https://just.systems/man/en
6+
# - installation: https://just.systems/man/en/pre-built-binaries.html
67
#
78
# Usage:
9+
# > just # configured to display all available tasks
810
# > just --help
911
# > just <taskname>
1012
#
1113
# Notes:
12-
# - Comments immediately preceding a recipe will appear in just --list:# Just is a crossplatform task-runner, similar to make.
13-
# And justfiles are equivalent to makefiles.
14-
#
15-
# Official docs:
16-
# - https://just.systems/man/en
17-
#
18-
# Usage:
19-
# > just --help
20-
# > just <taskname>
21-
#
22-
# Notes:
23-
# - Comments immediately preceding a recipe will appear in just --list:
14+
# - Comments immediately preceding a recipe will appear in just --list
2415

2516
# load environment variables from .env file
26-
# set dotenv-filename := ".env"
17+
set dotenv-filename := ".env"
2718
set dotenv-load := true
2819

2920
# search for justfiles in parent directories
3021
set fallback
3122

3223
# set tempdir := "var/tmp"
3324

25+
# enable experimental features
26+
set unstable
27+
3428
# set shell to powershell on Windows
3529
set windows-shell := ["pwsh.exe", "-NoLogo", "-Command"]
3630
set shell := ["bash", "-uc"]
3731

38-
import '.just/dir-structure.justfile'
39-
import '.just/dotenv.justfile'
40-
import '.just/git.justfile'
41-
import '.just/ipython.justfile'
42-
import '.just/mypy.justfile'
43-
import '.just/pre-commit.justfile'
44-
import '.just/pylint.justfile'
45-
import '.just/pyroma.justfile'
46-
import '.just/pytest.justfile'
47-
import '.just/readthedocs.justfile'
48-
import '.just/ruff.justfile'
49-
import '.just/sphinx.justfile'
50-
import '.just/uv.justfile'
51-
52-
# Help target
53-
help:
32+
33+
# waiting for glob-support, see
34+
# - https://github.com/casey/just/issues/1885
35+
# - https://github.com/casey/just/pull/2376
36+
import? '.just/bandit.justfile'
37+
import? '.just/dir-structure.justfile'
38+
import? '.just/dotenv.justfile'
39+
import? '.just/gh.justfile'
40+
import? '.just/ipython.justfile'
41+
import? '.just/just.justfile'
42+
import? '.just/mdformat.justfile'
43+
import? '.just/mypy.justfile'
44+
import? '.just/pre-commit.justfile'
45+
import? '.just/prek.justfile'
46+
import? '.just/project.justfile'
47+
import? '.just/pylint.justfile'
48+
import? '.just/pyroma.justfile'
49+
import? '.just/pytest.justfile'
50+
import? '.just/readthedocs.justfile'
51+
import? '.just/ruff.justfile'
52+
import? '.just/safety.justfile'
53+
import? '.just/sphinx.justfile'
54+
import? '.just/sshx.justfile'
55+
import? '.just/ty.justfile'
56+
import? '.just/ubuntu.justfile'
57+
import? '.just/uv.justfile'
58+
59+
60+
# Display all configure tasks (default recipe)
61+
[group: 'default']
62+
list:
5463
@ just --list --unsorted

src/httpclient_logging/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
"""httpclient_logging.__init__."""
22

33
from httpclient_logging import patch
4-
from httpclient_logging._version import __copyright__, __metadata__, __version__
4+
from httpclient_logging.about import (
5+
authors as __author__,
6+
)
7+
from httpclient_logging.about import (
8+
license_ as __license__,
9+
)
10+
from httpclient_logging.about import (
11+
version as __version__,
12+
)
513

614
__all__ = [
7-
"__copyright__",
8-
"__metadata__",
15+
"__author__",
16+
"__license__",
917
"__version__",
1018
"patch",
1119
]

src/httpclient_logging/_version.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)