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
2 changes: 2 additions & 0 deletions .github/workflows/testing-and-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# Pip generated folders #
#########################
keepa.egg-info/
src/*.egg-info/
src/keepa/_version.py
build/
dist/
keepa/__pycache__/
Expand Down
16 changes: 15 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# import pydata_sphinx_theme # noqa
from datetime import datetime
import importlib
import importlib.metadata
import inspect
from pathlib import Path

Expand All @@ -15,6 +16,19 @@
with (PROJECT_ROOT / "pyproject.toml").open("rb") as project_file:
project_metadata = tomllib.load(project_file)["project"]


def get_release() -> str:
"""Return the installed package version for Sphinx."""
try:
return importlib.metadata.version("keepa")
except importlib.metadata.PackageNotFoundError:
try:
from setuptools_scm import get_version
except ModuleNotFoundError:
return "0.0.0"
return get_version(root=PROJECT_ROOT, fallback_version="1.5.0.dev0")


# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
Expand Down Expand Up @@ -109,7 +123,7 @@ def linkcode_resolve(domain: str, info: dict[str, str]) -> str | None:
#
# The full version, including alpha/beta/rc tags.
# The short X.Y version.
release = project_metadata["version"]
release = get_release()
version = ".".join(release.split(".")[:2])

# The language for content autogenerated by Sphinx. Refer to documentation
Expand Down
15 changes: 12 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
build-backend = "flit_core.buildapi"
requires = ["flit_core >=3,<4"]
build-backend = "setuptools.build_meta"
requires = ["setuptools >=64", "setuptools-scm >=8"]

[project]
authors = [
Expand All @@ -26,11 +26,11 @@ dependencies = [
"pydantic >=2"
]
description = "Interfaces with keepa.com's API."
dynamic = ["version"]
keywords = ["keepa"]
name = "keepa"
readme = "README.rst"
requires-python = ">=3.10"
version = "1.5.dev0"

[project.optional-dependencies]
doc = [
Expand Down Expand Up @@ -70,3 +70,12 @@ line-length = 100
[tool.ruff.lint]
ignore = []
select = ["E", "F", "W", "I001"] # pyflakes, pycodestyle, isort

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]
fallback_version = "1.5.0.dev0"
git_describe_command = "git describe --dirty --tags --long --match v*"
tag_regex = "^v(?P<version>[0-9]+\\.[0-9]+\\.[0-9]+(?:[abrc][0-9]+)?(?:\\.post[0-9]+)?(?:\\.dev[0-9]+)?)$"
version_file = "src/keepa/_version.py"
2 changes: 1 addition & 1 deletion src/keepa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from importlib.metadata import PackageNotFoundError, version

# single source versioning from the installed package (stored in pyproject.toml)
# Single source versioning from installed package metadata.
try:
__version__ = version("keepa")
except PackageNotFoundError:
Expand Down
1 change: 0 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading