hunterMakesPy 0.10.2__tar.gz → 0.10.3__tar.gz
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.
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/PKG-INFO +3 -1
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/README.md +2 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/coping.py +7 -2
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/packages.py +8 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/test_coping.py +10 -7
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy.egg-info/PKG-INFO +3 -1
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/pyproject.toml +1 -1
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/LICENSE +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/__init__.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/_theSSOT.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/dataStructures.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/kitFilesystem.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/parseParameters.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/py.typed +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/semiotics.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/__init__.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/conftest.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/conftestAnnex.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/__init__.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/arrays.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/arraysRLE.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/callables.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/classes.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/containers.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/messages.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/pyprojects.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/pythonSource.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/text.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/test_conftestAnnex.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/test_dataStructures.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/test_kitFilesystem.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/test_parseParameters.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/test_theTypes.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/theTypes.py +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy.egg-info/SOURCES.txt +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy.egg-info/dependency_links.txt +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy.egg-info/requires.txt +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy.egg-info/top_level.txt +0 -0
- {huntermakespy-0.10.2 → huntermakespy-0.10.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hunterMakesPy
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.3
|
|
4
4
|
Summary: Easy Python functions making making functional Python functions easier.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License-Expression: CC-BY-NC-4.0
|
|
@@ -159,6 +159,8 @@ encoded = autoDecodingRLE(arrayTarget)
|
|
|
159
159
|
## Configure Package Metadata at Runtime
|
|
160
160
|
|
|
161
161
|
`PackageSettings` reads `pyproject.toml` automatically to resolve the package name and installation path.
|
|
162
|
+
For an installed package, `PackageSettings` reads the name that packaging copied from `pyproject.toml`
|
|
163
|
+
into the package's metadata, so the `pyproject.toml` in the current working directory cannot change it.
|
|
162
164
|
|
|
163
165
|
```python
|
|
164
166
|
from hunterMakesPy import PackageSettings
|
|
@@ -123,6 +123,8 @@ encoded = autoDecodingRLE(arrayTarget)
|
|
|
123
123
|
## Configure Package Metadata at Runtime
|
|
124
124
|
|
|
125
125
|
`PackageSettings` reads `pyproject.toml` automatically to resolve the package name and installation path.
|
|
126
|
+
For an installed package, `PackageSettings` reads the name that packaging copied from `pyproject.toml`
|
|
127
|
+
into the package's metadata, so the `pyproject.toml` in the current working directory cannot change it.
|
|
126
128
|
|
|
127
129
|
```python
|
|
128
130
|
from hunterMakesPy import PackageSettings
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Package configuration and defensive programming utilities for Python projects."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
+
from importlib.metadata import metadata, PackageNotFoundError
|
|
4
5
|
from importlib.util import find_spec
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from typing import TYPE_CHECKING
|
|
@@ -12,10 +13,12 @@ if TYPE_CHECKING:
|
|
|
12
13
|
from importlib.machinery import ModuleSpec
|
|
13
14
|
|
|
14
15
|
def _getIdentifierPackagePACKAGING(identifierPackageFALLBACK: str) -> str:
|
|
15
|
-
"""Get package name from pyproject.toml or fallback to provided value."""
|
|
16
|
+
"""Get package name from the metadata that packaging wrote, from pyproject.toml, or fallback to provided value."""
|
|
16
17
|
identifierPackage: str = identifierPackageFALLBACK
|
|
17
18
|
with contextlib.suppress(OSError, tomllib.TOMLDecodeError, KeyError):
|
|
18
19
|
identifierPackage = tomllib.loads(Path('pyproject.toml').read_text(encoding='utf-8'))['project']['name'] or identifierPackageFALLBACK
|
|
20
|
+
with contextlib.suppress(PackageNotFoundError, ValueError):
|
|
21
|
+
identifierPackage = metadata(identifierPackageFALLBACK)['Name']
|
|
19
22
|
return identifierPackage
|
|
20
23
|
|
|
21
24
|
def _getPathPackageINSTALLING(identifierPackage: str) -> Path:
|
|
@@ -45,7 +48,9 @@ class PackageSettings:
|
|
|
45
48
|
Fallback package identifier used only during initialization when automatic discovery fails.
|
|
46
49
|
identifierPackage : str = ''
|
|
47
50
|
Canonical name of the package. An explicit value takes precedence over `pyproject.toml`, then
|
|
48
|
-
`identifierPackageFALLBACK`.
|
|
51
|
+
`identifierPackageFALLBACK`. For `pyproject.toml`, the `Name` that packaging wrote to the metadata of
|
|
52
|
+
the installed distribution named `identifierPackageFALLBACK` takes precedence over `project.name` in
|
|
53
|
+
the `pyproject.toml` of the current working directory.
|
|
49
54
|
pathPackage : Path = _getPathPackageINSTALLING(identifierPackage)
|
|
50
55
|
Absolute path to the installed package directory. Automatically resolved from
|
|
51
56
|
`identifierPackage` if not provided.
|
|
@@ -3,6 +3,14 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
boxOfIdentifiersPackageAbsent: tuple[str, ...] = ('astToolkit', 'mapFolding')
|
|
5
5
|
|
|
6
|
+
boxOfIdentifiersDistributionInstalled: tuple[str, ...] = ('hunterMakesPy', 'numpy', 'pytest')
|
|
7
|
+
"""Identifiers of importable packages whose installed distribution has the identifier as its metadata `Name`.
|
|
8
|
+
|
|
9
|
+
(AI generated docstring)
|
|
10
|
+
|
|
11
|
+
`hunterMakesPy` is an editable installation, and `numpy` and `pytest` are installations from a wheel.
|
|
12
|
+
"""
|
|
13
|
+
|
|
6
14
|
lookupIdentifiersPackageInstalled: dict[str, str] = {
|
|
7
15
|
'fractions': 'fractions',
|
|
8
16
|
'hunterMakesPy': 'hunterMakesPy',
|
|
@@ -6,22 +6,25 @@ from hunterMakesPy.coping import _getIdentifierPackagePACKAGING, _getPathPackage
|
|
|
6
6
|
from hunterMakesPy.tests import assertEqualTo
|
|
7
7
|
from hunterMakesPy.tests.dataSamples.arrays import arrayRange
|
|
8
8
|
from hunterMakesPy.tests.dataSamples.messages import messageHostMissing
|
|
9
|
-
from hunterMakesPy.tests.dataSamples.packages import
|
|
9
|
+
from hunterMakesPy.tests.dataSamples.packages import (
|
|
10
|
+
boxOfIdentifiersDistributionInstalled, boxOfIdentifiersPackageAbsent, lookupIdentifiersPackageInstalled)
|
|
10
11
|
from hunterMakesPy.tests.dataSamples.pyprojects import tomlProjectMalformed, tomlProjectNamed, tomlProjectNameEmpty, tomlProjectNameless
|
|
12
|
+
from itertools import repeat
|
|
11
13
|
from pathlib import Path
|
|
12
14
|
import importlib.resources
|
|
13
15
|
import pytest
|
|
14
16
|
import re as regex
|
|
15
17
|
|
|
16
|
-
@pytest.mark.parametrize('identifierPackageFALLBACK',
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
18
|
+
@pytest.mark.parametrize('identifierPackageFALLBACK, expected', (
|
|
19
|
+
*zip(boxOfIdentifiersPackageAbsent, repeat('cobraPy')),
|
|
20
|
+
*zip(boxOfIdentifiersDistributionInstalled, boxOfIdentifiersDistributionInstalled, strict=True),
|
|
21
|
+
))
|
|
22
|
+
@pytest.mark.parametrize('pathWorkingDirectory', [tomlProjectNamed], indirect=True, ids=['tomlProjectNamed'])
|
|
20
23
|
def test_getIdentifierPackagePACKAGING(pathWorkingDirectory: Path, identifierPackageFALLBACK: str, expected: str) -> None:
|
|
21
|
-
"""Reference: the `project.name` that `tomlProjectNamed` states."""
|
|
24
|
+
"""Reference: the `project.name` that `tomlProjectNamed` states, or, for `boxOfIdentifiersDistributionInstalled`, the metadata `Name` that its docstring states."""
|
|
22
25
|
assertEqualTo(_getIdentifierPackagePACKAGING(identifierPackageFALLBACK), expected, _getIdentifierPackagePACKAGING.__name__, identifierPackageFALLBACK, pathWorkingDirectory=pathWorkingDirectory)
|
|
23
26
|
|
|
24
|
-
@pytest.mark.parametrize('identifierPackageFALLBACK', boxOfIdentifiersPackageAbsent)
|
|
27
|
+
@pytest.mark.parametrize('identifierPackageFALLBACK', (*boxOfIdentifiersPackageAbsent, *boxOfIdentifiersDistributionInstalled))
|
|
25
28
|
@pytest.mark.parametrize('pathWorkingDirectory', (
|
|
26
29
|
pytest.param(None, id='pyprojectAbsent'),
|
|
27
30
|
pytest.param(tomlProjectMalformed, id='tomlProjectMalformed'),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hunterMakesPy
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.3
|
|
4
4
|
Summary: Easy Python functions making making functional Python functions easier.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License-Expression: CC-BY-NC-4.0
|
|
@@ -159,6 +159,8 @@ encoded = autoDecodingRLE(arrayTarget)
|
|
|
159
159
|
## Configure Package Metadata at Runtime
|
|
160
160
|
|
|
161
161
|
`PackageSettings` reads `pyproject.toml` automatically to resolve the package name and installation path.
|
|
162
|
+
For an installed package, `PackageSettings` reads the name that packaging copied from `pyproject.toml`
|
|
163
|
+
into the package's metadata, so the `pyproject.toml` in the current working directory cannot change it.
|
|
162
164
|
|
|
163
165
|
```python
|
|
164
166
|
from hunterMakesPy import PackageSettings
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{huntermakespy-0.10.2 → huntermakespy-0.10.3}/hunterMakesPy/tests/dataSamples/pythonSource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|