diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 718572b..be4ca53 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,11 @@ updates: directory: "/" schedule: interval: "weekly" + groups: + github-actions: + patterns: + - "*" + - package-ecosystem: "uv" + directory: "/" + schedule: + interval: "weekly" diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1478786..633e182 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,17 +1,18 @@ version: 2 build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.10" + python: "3.12" + jobs: + create_environment: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + - UV_NO_EDITABLE=1 UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --group docs + install: + - "true" sphinx: configuration: docs/source/conf.py fail_on_warning: true - -python: - install: - - method: pip - path: . - extra_requirements: - - docs diff --git a/docs/source/conf.py b/docs/source/conf.py index 6bc1e6a..dc73897 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -28,6 +28,7 @@ extensions = [ "IPython.sphinxext.ipython_console_highlighting", "IPython.sphinxext.ipython_directive", + "sphinx.ext.doctest", "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.extlinks", diff --git a/docs/source/index.md b/docs/source/index.md index 2dfa30e..41b1223 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -62,15 +62,15 @@ A: This is called the src layout and the advantages are discussed in this Although the article discusses the src layout in terms of Python packages, it is also beneficial to structure a project the same way. Next to the reasons discussed there, it is possible to use a single Python environment for multiple projects without messing -with your PYTHONPATH (via `pip install -e .` or `conda develop .`) each time and still -import modules. +with your PYTHONPATH (for example, via editable installs) each time and still import +modules. Q: My project is a Python package, but it does not seem to have a version. Where is it? A: The cookiecutter uses [setuptools_scm](https://github.com/pypa/setuptools_scm/) to -manage the version number. When you install your created project as a Python package -with `pip install -e .`, setuptools_scm tries to infer the version number from the tags -created on the repo. +manage the version number. When you install your created project as a Python package in +editable mode, setuptools_scm tries to infer the version number from the tags created on +the repo. For example, if you have switched to a commit associated with the tag `v0.2.0`, setuptools_scm will create a `src//_version.py` with a variable containing diff --git a/justfile b/justfile index e9bd3a1..23b2f2e 100644 --- a/justfile +++ b/justfile @@ -4,15 +4,15 @@ install: # Run tests test: - uv run --extra test pytest + uv run --group test pytest # Run tests with coverage test-cov: - uv run --extra test pytest --cov=./ --cov-report=xml + uv run --group test pytest --cov=./ --cov-report=xml # Run type checking typing: - uv run --extra typing --extra test ty check hooks/ tests/ + uv run --group typing --group test --isolated ty check hooks/ tests/ # Run linting and formatting lint: @@ -23,5 +23,6 @@ check: lint typing test # Build docs and run doctests docs: - uv run --extra docs --extra test sphinx-build -n -T -b html -d docs/build/doctrees docs/source docs/build/html - uv run --extra docs --extra test sphinx-build -n -T -b doctest -d docs/build/doctrees docs/source docs/build/html + uv sync --group docs --group test + uv run --group docs --group test sphinx-build -n -T -b html -d docs/build/doctrees docs/source docs/build/html + uv run --group docs --group test sphinx-build -n -T -b doctest -d docs/build/doctrees docs/source docs/build/html diff --git a/pyproject.toml b/pyproject.toml index 18c56b0..b539bd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,11 +18,21 @@ classifiers = [ requires-python = ">=3.10" dependencies = ["cookiecutter"] +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +only-include = ["cookiecutter.json", "hooks", "{{cookiecutter.project_slug}}"] + +[tool.hatch.build.targets.sdist] +only-include = ["cookiecutter.json", "hooks", "{{cookiecutter.project_slug}}"] + [[project.authors]] name = "Tobias Raabe" email = "raabe@posteo.de" -[project.optional-dependencies] +[dependency-groups] docs = [ "furo", "ipython", @@ -36,7 +46,7 @@ docs = [ "sphinxext-opengraph", ] test = ["pytest", "pytest-cookies", "pytest-cov"] -typing = ["ty>=0.0.7"] +typing = ["ty>=0.0.8"] [project.readme] file = "README.md" diff --git a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py index 75190c8..bc1f9e7 100644 --- a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py +++ b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py @@ -1,8 +1,7 @@ """Contains the main namespace of {{ cookiecutter.project_slug }}.""" # Import the version from _version.py which is dynamically created by setuptools-scm -# when the project is installed with ``pip install -e .``. Do not put it into version -# control! +# when the project is installed in editable mode. Do not put it into version control! try: from ._version import version as __version__ # ty: ignore[unresolved-import] except ImportError: