utils-seleniumxp 1.0.0__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.
@@ -0,0 +1,55 @@
1
+ """Compute the version number and store it in the `__version__` variable.
2
+
3
+ Based on <https://github.com/maresb/hatch-vcs-footgun-example>.
4
+ """
5
+
6
+
7
+ # ruff and mypy per file settings
8
+ # others
9
+ # ruff: noqa: PLC0415
10
+
11
+ # fmt: off
12
+
13
+
14
+ def _get_hatch_version():
15
+ """Compute the most up-to-date version number in a development environment.
16
+
17
+ Returns `None` if Hatchling is not installed, e.g. in a production environment.
18
+
19
+ For more details, see <https://github.com/maresb/hatch-vcs-footgun-example/>.
20
+ """
21
+ import os
22
+
23
+ try:
24
+ from hatchling.metadata.core import ProjectMetadata
25
+ from hatchling.plugin.manager import PluginManager
26
+ from hatchling.utils.fs import locate_file
27
+ except ImportError:
28
+ # Hatchling is not installed, so probably we are not in a development environment.
29
+ return None
30
+
31
+ pyproject_toml = locate_file(__file__, "pyproject.toml")
32
+ if pyproject_toml is None:
33
+ err_msg = "pyproject.toml not found although hatchling is installed"
34
+ raise RuntimeError(err_msg)
35
+ root = os.path.dirname(pyproject_toml)
36
+ metadata = ProjectMetadata(root=root, plugin_manager=PluginManager())
37
+ # Version can be either statically set in pyproject.toml or computed dynamically:
38
+ return metadata.core.version or metadata.hatch.version.cached
39
+
40
+
41
+ def _get_importlib_metadata_version():
42
+ """Compute the version number using importlib.metadata.
43
+
44
+ This is the official Pythonic way to get the version number of an installed
45
+ package. However, it is only updated when a package is installed. Thus, if a
46
+ package is installed in editable mode, and a different version is checked out,
47
+ then the version number will not be updated.
48
+ """
49
+ from importlib.metadata import version
50
+
51
+ __version__ = version(__package__)
52
+ return __version__
53
+
54
+
55
+ __version__ = _get_hatch_version() or _get_importlib_metadata_version()