Skip to content

Commit 10e3d89

Browse files
committed
chore: update package management configuration
- Add mirror URL standardization for lock files - Remove automatic install trigger on lock file changes - Clean up and reorganize pyproject.toml structure - Simplify VS Code testing configuration
1 parent 04684b6 commit 10e3d89

5 files changed

Lines changed: 60 additions & 49 deletions

File tree

template/.config/copier/direnv/10-python.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,26 @@
44

55
pushd "$(git rev-parse --show-toplevel)" > /dev/null || return 1
66

7+
function replace-mirrors() {
8+
local file="$1"
9+
if [[ -f $file ]]; then
10+
sd 'https://(\S+)/simple' 'https://pypi.org/simple' "$file"
11+
sd 'https://(\S+)/packages' 'https://files.pythonhosted.org/packages' "$file"
12+
fi
13+
}
14+
715
if [[ -f "pixi.lock" ]]; then
816
options=()
917
if [[ -t 2 ]]; then
1018
options+=(--color=always)
1119
fi
1220
eval "$(pixi shell-hook "${options[@]}")"
21+
replace-mirrors 'pixi.lock'
1322
fi
1423

1524
if [[ -f "uv.lock" ]]; then
1625
uv sync --all-extras --all-groups
26+
replace-mirrors 'uv.lock'
1727
sed --in-place --regexp-extended \
1828
"s|\s*(include-system-site-packages)\s*=\s*.*\s*|\1 = true|" ".venv/pyvenv.cfg"
1929
# shellcheck disable=SC1091

template/.config/copier/mise/tasks/install.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,20 @@ set -o errexit
55
set -o nounset
66
set -o pipefail
77

8+
function replace-mirrors() {
9+
local file="$1"
10+
if [[ -f $file ]]; then
11+
sd 'https://(\S+)/simple' 'https://pypi.org/simple' "$file"
12+
sd 'https://(\S+)/packages' 'https://files.pythonhosted.org/packages' "$file"
13+
fi
14+
}
15+
816
if [[ -f "pixi.lock" ]]; then
917
pixi install
18+
replace-mirrors 'pixi.lock'
1019
fi
1120

1221
if [[ -f "uv.lock" ]]; then
1322
uv sync --all-extras --all-groups
23+
replace-mirrors 'uv.lock'
1424
fi

template/.config/mise/config.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,3 @@ includes = [".config/mise/tasks/", ".config/copier/mise/tasks/"]
55

66
[tasks.lint]
77
depends = ["lint-python", "lint-toml"]
8-
9-
[[watch_files]]
10-
patterns = ["pixi.lock", "pyproject.toml", "uv.lock"]
11-
run = "mise run install"

template/.vscode/settings.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
"**/junit.xml": true
1111
},
1212
"python.analysis.diagnosticMode": "workspace",
13-
"python.testing.pytestArgs": [
14-
"--color=yes",
15-
"--cov",
16-
"--benchmark-disable",
17-
"--numprocesses=auto"
18-
],
13+
"python.testing.pytestArgs": ["--color=yes", "--cov", "--numprocesses=auto"],
1914
"python.testing.pytestEnabled": true,
2015
"python.testing.unittestEnabled": false,
2116
"yaml.customTags": [

template/pyproject.toml.jinja

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,6 @@
22
#:schema https://json.schemastore.org/pyproject.json
33
# ref: <https://packaging.python.org/en/latest/specifications/pyproject-toml/>
44

5-
[build-system]
6-
build-backend = "hatchling.build"
7-
requires = ["hatch-vcs", "hatchling"]
8-
9-
[dependency-groups]
10-
build = ["check-wheel-contents", "hatch", "twine"]
11-
dev = ["icecream"]
12-
docs = [
13-
"docstring-inheritance",
14-
"griffe-fieldz",
15-
"griffe-generics",
16-
"griffe-inherited-docstrings",
17-
"griffe-modernized-annotations",
18-
"griffe-pydantic",
19-
"griffe-warnings-deprecated",
20-
"mdx-truly-sane-lists",
21-
"mkdocs",
22-
"mkdocs-api-autonav",
23-
"mkdocs-autorefs",
24-
"mkdocs-git-committers-plugin-2",
25-
"mkdocs-git-revision-date-localized-plugin",
26-
"mkdocs-include-markdown-plugin",
27-
"mkdocs-material[imaging]",
28-
"mkdocs-section-index",
29-
"mkdocstrings",
30-
"mkdocstrings-python",
31-
"pymdown-extensions",
32-
"ruff",
33-
]
34-
test = ["pytest", "pytest-codspeed", "pytest-cov", "pytest-xdist"]
35-
365
[project]
376
authors = [{ email = "{{ author_email }}", name = "{{ author_name }}" }]
387
classifiers = [
@@ -49,8 +18,8 @@ classifiers = [
4918
"Programming Language :: Python",
5019
"Typing :: Typed",
5120
]
52-
dependencies = ["lazy-loader", "loguru", "rich"]
53-
description = "Add your description here"
21+
dependencies = ["lazy-loader", "loguru"]
22+
description = "TODO"
5423
dynamic = ["version"]
5524
keywords = []
5625
license = "{{ license }}"
@@ -67,6 +36,37 @@ requires-python = ">=3.12"
6736
"Release Notes" = "https://github.com/{{ github_user }}/{{ github_repo }}/releases"
6837
"Source Code" = "https://github.com/{{ github_user }}/{{ github_repo }}"
6938

39+
[dependency-groups]
40+
build = ["check-wheel-contents", "hatch", "twine"]
41+
dev = ["icecream"]
42+
docs = [
43+
"docstring-inheritance",
44+
"griffe-fieldz",
45+
"griffe-generics",
46+
"griffe-inherited-docstrings",
47+
"griffe-modernized-annotations",
48+
"griffe-pydantic",
49+
"griffe-warnings-deprecated",
50+
"mdx-truly-sane-lists",
51+
"mkdocs",
52+
"mkdocs-api-autonav",
53+
"mkdocs-autorefs",
54+
"mkdocs-git-committers-plugin-2",
55+
"mkdocs-git-revision-date-localized-plugin",
56+
"mkdocs-include-markdown-plugin",
57+
"mkdocs-material[imaging]",
58+
"mkdocs-section-index",
59+
"mkdocstrings",
60+
"mkdocstrings-python",
61+
"pymdown-extensions",
62+
"ruff",
63+
]
64+
test = ["hypothesis", "pytest", "pytest-codspeed", "pytest-cov", "pytest-xdist"]
65+
66+
[build-system]
67+
requires = ["hatch-vcs", "hatchling"]
68+
build-backend = "hatchling.build"
69+
7070
[tool.check-wheel-contents]
7171
ignore = ["W002"]
7272

@@ -86,10 +86,6 @@ packages = ["src/{{ wheel_package_dir }}/"]
8686
[tool.hatch.version]
8787
source = "vcs"
8888

89-
[tool.pytest.ini_options]
90-
addopts = ["--showlocals", "--strict-config", "--strict-markers"]
91-
testpaths = ["benches/", "tests/"]
92-
9389
# {%- if package_manager == "pixi" %}
9490
[tool.pixi.environments]
9591
default = { features = ["build", "dev", "docs", "test"] }
@@ -106,9 +102,13 @@ platforms = ["linux-64"]
106102
cuda = "12"
107103
libc = { family = "glibc", version = "2.41" }
108104
linux = "6.12"
105+
# {%- endif %}
106+
107+
[tool.pytest.ini_options]
108+
addopts = ["--showlocals", "--strict-config", "--strict-markers"]
109+
testpaths = ["benches/", "tests/"]
109110

110-
# {%- elif package_manager == "uv" %}
111+
# {%- if package_manager == "uv" %}
111112
[tool.uv]
112113
default-groups = "all"
113-
114114
# {%- endif %}

0 commit comments

Comments
 (0)