Skip to content

Commit 39e659e

Browse files
committedMar 25, 2024
chore: Template upgrade
1 parent 776c06f commit 39e659e

File tree

9 files changed

+51
-44
lines changed

9 files changed

+51
-44
lines changed
 

‎.copier-answers.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 1.0.8
2+
_commit: 1.1.0
33
_src_path: gh:pawamoy/copier-uv
44
author_email: dev@pawamoy.fr
55
author_fullname: Timothée Mazzucotelli

‎.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
github: pawamoy
22
ko_fi: pawamoy
3+
polar: pawamoy
34
custom:
45
- https://www.paypal.me/pawamoy

‎.github/workflows/ci.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ jobs:
8686
run: pip install uv
8787

8888
- name: Install dependencies
89-
run: |
90-
uv venv
91-
uv pip install -r devdeps.txt
92-
uv pip install "git-changelog @ ."
89+
run: make setup
9390

9491
- name: Run the test suite
9592
run: make test

‎.gitignore

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
# editors
12
.idea/
23
.vscode/
3-
__pycache__/
4-
*.py[cod]
5-
dist/
4+
5+
# python
66
*.egg-info/
7-
build/
8-
htmlcov/
7+
*.py[cod]
8+
.venv/
9+
.venvs/
10+
/build/
11+
/dist/
12+
13+
# tools
914
.coverage*
10-
pip-wheel-metadata/
15+
/.pdm-build/
16+
/htmlcov/
17+
/site/
18+
19+
# cache
20+
.cache/
1121
.pytest_cache/
1222
.mypy_cache/
1323
.ruff_cache/
14-
site/
15-
.venv/
16-
.venvs/
17-
.cache/
24+
__pycache__/

‎config/ruff.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ line-length = 120
33

44
[lint]
55
exclude = [
6-
"fixtures",
7-
"site",
6+
"tests/fixtures/*.py",
87
]
98
select = [
109
"A", "ANN", "ARG",
@@ -79,5 +78,8 @@ known-first-party = ["git_changelog"]
7978
convention = "google"
8079

8180
[format]
81+
exclude = [
82+
"tests/fixtures/*.py",
83+
]
8284
docstring-code-format = true
8385
docstring-code-line-length = 80

‎duties.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,16 @@ def clean(ctx: Context) -> None:
162162
Parameters:
163163
ctx: The context instance (passed automatically).
164164
"""
165-
ctx.run("rm -rf .coverage*")
166-
ctx.run("rm -rf .mypy_cache")
167-
ctx.run("rm -rf .pytest_cache")
168-
ctx.run("rm -rf tests/.pytest_cache")
169-
ctx.run("rm -rf build")
170-
ctx.run("rm -rf dist")
171-
ctx.run("rm -rf htmlcov")
172-
ctx.run("rm -rf pip-wheel-metadata")
173-
ctx.run("rm -rf site")
174-
ctx.run("find . -type d -name __pycache__ | xargs rm -rf")
175-
ctx.run("find . -name '*.rej' -delete")
165+
def _rm(*targets: str) -> None:
166+
for target in targets:
167+
ctx.run(f"rm -rf {target}")
168+
169+
def _find_rm(*targets: str) -> None:
170+
for target in targets:
171+
ctx.run(f"find . -type d -name '{target}' | xargs rm -rf")
172+
173+
_rm("build", "dist", ".coverage*", "htmlcov", "site", ".pdm-build")
174+
_find_rm(".cache", ".pytest_cache", ".mypy_cache", ".ruff_cache", "__pycache__")
176175

177176

178177
@duty

‎scripts/gen_credits.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
pyproject = tomllib.load(pyproject_file)
2727
project = pyproject["project"]
2828
project_name = project["name"]
29-
with open("devdeps.txt") as devdeps_file:
29+
with project_dir.joinpath("devdeps.txt").open() as devdeps_file:
3030
devdeps = [line.strip() for line in devdeps_file if not line.startswith("-e")]
3131

3232
PackageMetadata = Dict[str, Union[str, Iterable[str]]]
@@ -47,13 +47,6 @@ def _norm_name(name: str) -> str:
4747
return name.replace("_", "-").replace(".", "-").lower()
4848

4949

50-
def _norm_spec(spec: str) -> set[str]:
51-
clean_spec = spec.split("]", 1)[-1].split(";", 1)[0].replace("(", "").replace(")", "").replace(" ", "").strip()
52-
if clean_spec:
53-
return set(clean_spec.split(","))
54-
return set()
55-
56-
5750
def _requirements(deps: list[str]) -> dict[str, Requirement]:
5851
return {_norm_name((req := Requirement(dep)).name): req for dep in deps}
5952

@@ -74,6 +67,7 @@ def _get_metadata() -> Metadata:
7467
metadata[name] = _merge_fields(pkg.metadata) # type: ignore[arg-type]
7568
metadata[name]["spec"] = set()
7669
metadata[name]["extras"] = set()
70+
metadata[name].setdefault("summary", "")
7771
_set_license(metadata[name])
7872
return metadata
7973

@@ -147,12 +141,12 @@ def _render_credits() -> str:
147141
148142
These projects were used to build *{{ project_name }}*. **Thank you!**
149143
150-
[`python`](https://www.python.org/) |
151-
[`uv`](https://github.com/astral-sh/uv) |
152-
[`copier-uv`](https://github.com/pawamoy/copier-uv)
144+
[Python](https://www.python.org/) |
145+
[uv](https://github.com/astral-sh/uv) |
146+
[copier-uv](https://github.com/pawamoy/copier-uv)
153147
154148
{% macro dep_line(dep) -%}
155-
[`{{ dep.name }}`](https://pypi.org/project/{{ dep.name }}/) | {{ dep.summary }} | {{ ("`" ~ dep.spec|sort(reverse=True)|join(", ") ~ "`") if dep.spec else "" }} | `{{ dep.version }}` | {{ dep.license }}
149+
[{{ dep.name }}](https://pypi.org/project/{{ dep.name }}/) | {{ dep.summary }} | {{ ("`" ~ dep.spec|sort(reverse=True)|join(", ") ~ "`") if dep.spec else "" }} | `{{ dep.version }}` | {{ dep.license }}
156150
{%- endmacro %}
157151
158152
{% if prod_dependencies -%}

‎scripts/make

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ prefix=""
1111
# as well as current project in editable mode.
1212
uv_install() {
1313
uv pip compile pyproject.toml devdeps.txt | uv pip install -r -
14-
uv pip install -e .
14+
if [ -z "${CI}" ]; then
15+
uv pip install -e .
16+
else
17+
uv pip install "git-changelog @ ."
18+
fi
1519
}
1620

1721

@@ -28,13 +32,13 @@ setup() {
2832
if [ -n "${PYTHON_VERSIONS}" ]; then
2933
for version in ${PYTHON_VERSIONS}; do
3034
if [ ! -d ".venvs/${version}" ]; then
31-
uv venv --seed --python "${version}" ".venvs/${version}"
35+
uv venv --python "${version}" ".venvs/${version}"
3236
fi
3337
VIRTUAL_ENV="${PWD}/.venvs/${version}" uv_install
3438
done
3539
fi
3640

37-
if [ ! -d .venv ]; then uv venv --seed --python python; fi
41+
if [ ! -d .venv ]; then uv venv --python python; fi
3842
uv_install
3943
}
4044

‎src/git_changelog/debug.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class Environment:
3737
"""Python interpreter name."""
3838
interpreter_version: str
3939
"""Python interpreter version."""
40+
interpreter_path: str
41+
"""Path to Python executable."""
4042
platform: str
4143
"""Operating System."""
4244
packages: list[Package]
@@ -83,6 +85,7 @@ def get_debug_info() -> Environment:
8385
return Environment(
8486
interpreter_name=py_name,
8587
interpreter_version=py_version,
88+
interpreter_path=sys.executable,
8689
platform=platform.platform(),
8790
variables=[Variable(var, val) for var in variables if (val := os.getenv(var))],
8891
packages=[Package(pkg, get_version(pkg)) for pkg in packages],
@@ -93,7 +96,7 @@ def print_debug_info() -> None:
9396
"""Print debug/environment information."""
9497
info = get_debug_info()
9598
print(f"- __System__: {info.platform}")
96-
print(f"- __Python__: {info.interpreter_name} {info.interpreter_version}")
99+
print(f"- __Python__: {info.interpreter_name} {info.interpreter_version} ({info.interpreter_path})")
97100
print("- __Environment variables__:")
98101
for var in info.variables:
99102
print(f" - `{var.name}`: `{var.value}`")

0 commit comments

Comments
 (0)
Please sign in to comment.