-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): Infer dynamically the version, license and readme of sk…
…ore (#465) ```bash $ cd skore/ $ python -m build Successfully built skore-0.0.0+unknown.tar.gz and skore-0.0.0+unknown-py3-none-any.whl ``` --- To locally build a package with a version other than the default `0.0.0+unknown`: ```bash $ cd skore/ $ echo "X.Y.Z" > VERSION.txt $ python -m build Successfully built skore-X.Y.Z.tar.gz and skore-X.Y.Z-py3-none-any.whl ```
- Loading branch information
1 parent
28e83a4
commit 91ff22e
Showing
6 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from pathlib import Path | ||
from contextlib import suppress | ||
|
||
from hatchling.metadata.plugin.interface import MetadataHookInterface | ||
|
||
|
||
class MetadataHook(MetadataHookInterface): | ||
def update(self, metadata): | ||
license = Path(self.root, self.config["license-file"]).read_text() | ||
readme = Path(self.root, self.config["readme-file"]).read_text() | ||
version = self.config["version-default"] | ||
|
||
with suppress(FileNotFoundError): | ||
version = Path(self.root, "VERSION.txt").read_text() | ||
|
||
metadata["license"] = {"text": license, "content-type": "text/plain"} | ||
metadata["readme"] = {"text": readme, "content-type": "text/markdown"} | ||
metadata["version"] = version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
[project] | ||
name = "skore" | ||
description = "Tooling and assistance for data scientists to \"Own Your Data Science\"" | ||
dynamic = ["version"] | ||
readme = "README.md" | ||
dynamic = [ | ||
"license", | ||
"readme", | ||
"version" | ||
] | ||
requires-python = ">=3.11" | ||
maintainers = [ | ||
{name = "skore developers", email="[email protected]"}, | ||
|
@@ -14,7 +17,6 @@ dependencies = [ | |
"skops", | ||
"uvicorn", | ||
] | ||
license = { file = "LICENSE" } | ||
classifiers=[ | ||
"Intended Audience :: Science/Research", | ||
"Intended Audience :: Developers", | ||
|
@@ -43,12 +45,14 @@ Issues = "https://github.com/probabl-ai/skore/issues" | |
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.version] | ||
path = "VERSION.txt" | ||
pattern = "(?P<version>[^']+)" | ||
[tool.hatch.metadata.hooks.custom] | ||
path = "hatch/metadata.py" | ||
license-file = "../LICENSE" | ||
readme-file = "../README.md" | ||
version-default = "0.0.0+unknown" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
only-include = ["src/"] | ||
only-include = ["src/", "hatch/"] | ||
artifacts = ["src/skore/ui/static/"] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
|