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: 0 additions & 2 deletions DEVELOP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ To create a new release, you must:

In the release branch:

- Update ``__version__`` in ``src/crate/client/__init__.py``

- Add a section for the new version in the ``CHANGES.rst`` file

- Commit your changes with a message like "prepare release x.y.z"
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[build-system]
requires = ["hatchling >= 1.26"]
requires = ["hatchling >= 1.26", "versioningit"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/crate"]

[tool.hatch.version]
path = "src/crate/client/__init__.py"
source = "versioningit"
default-version = "0.0.0+unknown"

[project]
name = "crate"
Expand All @@ -32,6 +33,7 @@ classifiers = [
"Topic :: Database",
]
dependencies = [
"importlib-metadata; python_version<'3.8'",
"orjson>=3.11.3",
"urllib3",
"verlib2>=0.3.1",
Expand Down
18 changes: 15 additions & 3 deletions src/crate/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@
"Error",
]

# version string read from setup.py using a regex. Take care not to break the
# regex!
__version__ = "2.0.0"
# ruff: noqa: E402
try:
from importlib.metadata import PackageNotFoundError, version
except (ImportError, ModuleNotFoundError): # pragma: no cover
from importlib_metadata import ( # type: ignore[assignment,no-redef,unused-ignore]
PackageNotFoundError,
version,
)

__appname__ = "crate"

try:
__version__ = version(__appname__)
except PackageNotFoundError: # pragma: no cover
__version__ = "unknown"

# codeql[py/unused-global-variable]
apilevel = "2.0"
Expand Down