diff --git a/.copier-answers.yml b/.copier-answers.yml index 5e7178a..5790ff2 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 1.5.4 +_commit: 1.5.7 _src_path: gh:pawamoy/copier-uv author_email: dev@pawamoy.fr author_fullname: Timothée Mazzucotelli diff --git a/docs/insiders/index.md b/docs/insiders/index.md index eed55b7..a0c2324 100644 --- a/docs/insiders/index.md +++ b/docs/insiders/index.md @@ -88,6 +88,8 @@ else: ``` +Additionally, your sponsorship will give more weight to your upvotes on issues, helping us prioritize work items in our backlog. For more information on how we prioritize work, see this page: [Backlog management](https://pawamoy.github.io/backlog/). + ## How to become a sponsor Thanks for your interest in sponsoring! In order to become an eligible sponsor diff --git a/duties.py b/duties.py index 4ab22c9..8ed7a98 100644 --- a/duties.py +++ b/duties.py @@ -88,6 +88,7 @@ def check_docs(ctx: Context) -> None: @duty def check_types(ctx: Context) -> None: """Check that the code is correctly typed.""" + os.environ["FORCE_COLOR"] = "1" ctx.run( tools.mypy(*PY_SRC_LIST, config_file="config/mypy.ini"), title=pyprefix("Type-checking"), diff --git a/pyproject.toml b/pyproject.toml index 9474e00..343f91c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,13 +48,11 @@ Funding = "https://github.com/sponsors/pawamoy" [project.entry-points."mkdocs.plugins"] markdown-exec = "markdown_exec.mkdocs_plugin:MarkdownExecPlugin" -[tool.pdm] -version = {source = "scm"} +[tool.pdm.version] +source = "call" +getter = "scripts.get_version:get_version" [tool.pdm.build] -package-dir = "src" -editable-backend = "editables" - # Include as much as possible in the source distribution, to help redistributors. excludes = ["**/.pytest_cache"] source-includes = [ @@ -79,9 +77,6 @@ data = [ [dependency-groups] dev = [ - # dev - "editables>=0.5", - # maintenance "build>=1.2", "git-changelog>=2.5", diff --git a/scripts/get_version.py b/scripts/get_version.py new file mode 100644 index 0000000..f4a30a8 --- /dev/null +++ b/scripts/get_version.py @@ -0,0 +1,27 @@ +"""Get current project version from Git tags or changelog.""" + +import re +from contextlib import suppress +from pathlib import Path + +from pdm.backend.hooks.version import SCMVersion, Version, default_version_formatter, get_version_from_scm + +_root = Path(__file__).parent.parent +_changelog = _root / "CHANGELOG.md" +_changelog_version_re = re.compile(r"^## \[(\d+\.\d+\.\d+)\].*$") +_default_scm_version = SCMVersion(Version("0.0.0"), None, False, None, None) # noqa: FBT003 + + +def get_version() -> str: + """Get current project version from Git tags or changelog.""" + scm_version = get_version_from_scm(_root) or _default_scm_version + if scm_version.version <= Version("0.1"): # Missing Git tags? + with suppress(OSError, StopIteration): # noqa: SIM117 + with _changelog.open("r", encoding="utf8") as file: + match = next(filter(None, map(_changelog_version_re.match, file))) + scm_version = scm_version._replace(version=Version(match.group(1))) + return default_version_formatter(scm_version) + + +if __name__ == "__main__": + print(get_version()) diff --git a/scripts/make.py b/scripts/make.py index cf3a489..62c5581 100755 --- a/scripts/make.py +++ b/scripts/make.py @@ -69,12 +69,10 @@ def setup() -> None: uv_install(venv_path) -def run(version: str, cmd: str, *args: str, no_sync: bool = False, **kwargs: Any) -> None: +def run(version: str, cmd: str, *args: str, **kwargs: Any) -> None: """Run a command in a virtual environment.""" kwargs = {"check": True, **kwargs} - uv_run = ["uv", "run"] - if no_sync: - uv_run.append("--no-sync") + uv_run = ["uv", "run", "--no-sync"] if version == "default": with environ(UV_PROJECT_ENVIRONMENT=".venv"): subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510 @@ -141,7 +139,7 @@ def main() -> int: ) if os.path.exists(".venv"): print("\nAvailable tasks", flush=True) - run("default", "duty", "--list", no_sync=True) + run("default", "duty", "--list") return 0 while args: