hatch-env-plus 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hatch_env_plus/plugin.py +6 -6
- {hatch_env_plus-1.0.0.dist-info → hatch_env_plus-1.0.1.dist-info}/METADATA +8 -6
- hatch_env_plus-1.0.1.dist-info/RECORD +8 -0
- hatch_env_plus-1.0.0.dist-info/RECORD +0 -8
- {hatch_env_plus-1.0.0.dist-info → hatch_env_plus-1.0.1.dist-info}/WHEEL +0 -0
- {hatch_env_plus-1.0.0.dist-info → hatch_env_plus-1.0.1.dist-info}/entry_points.txt +0 -0
- {hatch_env_plus-1.0.0.dist-info → hatch_env_plus-1.0.1.dist-info}/licenses/LICENSE +0 -0
hatch_env_plus/plugin.py
CHANGED
|
@@ -4,13 +4,13 @@ from hatchling.version.source.plugin.interface import VersionSourceInterface
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class EnvironmentVariableVersionSource(VersionSourceInterface):
|
|
7
|
-
PLUGIN_NAME =
|
|
7
|
+
PLUGIN_NAME = "env-plus"
|
|
8
8
|
|
|
9
9
|
def get_version_data(self) -> dict:
|
|
10
|
-
variable = self.config.get(
|
|
11
|
-
fallback = self.config.get(
|
|
12
|
-
version = os.environ.get(variable, fallback
|
|
13
|
-
return {
|
|
10
|
+
variable = self.config.get("variable", "PACKAGE_VERSION")
|
|
11
|
+
fallback = self.config.get("fallback", "0.0.0dev0") or None
|
|
12
|
+
version = os.environ.get(variable, None) or fallback
|
|
13
|
+
return {"version": version}
|
|
14
14
|
|
|
15
15
|
def set_version(self, version: str, version_data: dict) -> None:
|
|
16
|
-
version_data[
|
|
16
|
+
version_data["version"] = version
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hatch-env-plus
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: A version source for Hatchling that reads the version from a given environment variable, but also allows for a fallback if the variable is not populated.
|
|
5
5
|
Project-URL: homepage, https://github.com/jenskeiner/hatch_env_plus/
|
|
6
6
|
Project-URL: repository, https://github.com/jenskeiner/hatch_env_plus.git
|
|
@@ -27,8 +27,9 @@ Description-Content-Type: text/markdown
|
|
|
27
27
|
|
|
28
28
|
# Hatchling Environment Variable Version Source
|
|
29
29
|
|
|
30
|
-
A Hatchling version source plugin that reads the version from an environment variable
|
|
31
|
-
since the built-in `env`
|
|
30
|
+
A [Hatchling](https://github.com/pypa/hatch) version source plugin that reads the version from an environment variable
|
|
31
|
+
with a configurable fallback value, since the built-in [`env`](https://hatch.pypa.io/latest/plugins/version-source/env/)
|
|
32
|
+
version source does not allow to define a fallback.
|
|
32
33
|
|
|
33
34
|
## Installation
|
|
34
35
|
|
|
@@ -62,12 +63,13 @@ fallback = "0.0.0dev0" # optional, default shown
|
|
|
62
63
|
|
|
63
64
|
Use the `variable` field to set the environment variable to use, and set `fallback` to the desired fallback version.
|
|
64
65
|
|
|
65
|
-
**Note: An empty string, whether from the configured environment variable or from the fallback, is an
|
|
66
|
+
**Note: An empty string, whether from the configured environment variable or from the fallback, is an
|
|
66
67
|
undefined version.**
|
|
67
68
|
|
|
68
69
|
If you explicitly set the configured environment variable to the empty string, your build will fail as no valid version
|
|
69
|
-
is set. If you explicitly set `fallback` to an empty string, your build will fail when the configured environment
|
|
70
|
-
variable is not set. This is the default behavior of Hatchling's built-in
|
|
70
|
+
is set. If you explicitly set `fallback` to an empty string, your build will fail when the configured environment
|
|
71
|
+
variable is not set. This is the default behavior of [Hatchling]([Hatchling](https://github.com/pypa/hatch))'s built-in
|
|
72
|
+
enviroment variable version source [`env`](https://hatch.pypa.io/latest/plugins/version-source/env/).
|
|
71
73
|
|
|
72
74
|
## Usage
|
|
73
75
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
hatch_env_plus/__init__.py,sha256=zJGQMEhazvvgCqxv453ca9YmaZf-nT8q78dfju1jNnI,101
|
|
2
|
+
hatch_env_plus/hooks.py,sha256=5yc22VRzKOcVdAqHB-6UYOMBty1IUlgFSyTNOSJWtZc,185
|
|
3
|
+
hatch_env_plus/plugin.py,sha256=GZ1PpuF-mNltkLZMZ9IpXj32XkpnX_HZg9Pl1yXt0iE,567
|
|
4
|
+
hatch_env_plus-1.0.1.dist-info/METADATA,sha256=7_VedzpMPl12uMkLd-zBWOoDBr_WlDtHKCoW4w86rfk,3309
|
|
5
|
+
hatch_env_plus-1.0.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
+
hatch_env_plus-1.0.1.dist-info/entry_points.txt,sha256=znfR_zsEJqQ4kew-3ZauRvfOFU1lrzMeZC4vshELYXY,40
|
|
7
|
+
hatch_env_plus-1.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
8
|
+
hatch_env_plus-1.0.1.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
hatch_env_plus/__init__.py,sha256=zJGQMEhazvvgCqxv453ca9YmaZf-nT8q78dfju1jNnI,101
|
|
2
|
-
hatch_env_plus/hooks.py,sha256=5yc22VRzKOcVdAqHB-6UYOMBty1IUlgFSyTNOSJWtZc,185
|
|
3
|
-
hatch_env_plus/plugin.py,sha256=djo2gPedfDPPA6VzswVE_XReulZO9XdQQ_gIFPIyd8o,559
|
|
4
|
-
hatch_env_plus-1.0.0.dist-info/METADATA,sha256=tKOxF-DYT3TMU_h5e6gU4E1eHzBcSqmelib3OlN2klc,3114
|
|
5
|
-
hatch_env_plus-1.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
-
hatch_env_plus-1.0.0.dist-info/entry_points.txt,sha256=znfR_zsEJqQ4kew-3ZauRvfOFU1lrzMeZC4vshELYXY,40
|
|
7
|
-
hatch_env_plus-1.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
8
|
-
hatch_env_plus-1.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|