Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ updates:
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
19 changes: 10 additions & 9 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<package_slug>/_version.py` with a variable containing
Expand Down
11 changes: 6 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
14 changes: 12 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down