estrellio-py-env-tools 0.1.0__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.
- estrellio_py_env_tools-0.1.0/LICENSE +21 -0
- estrellio_py_env_tools-0.1.0/MANIFEST.in +8 -0
- estrellio_py_env_tools-0.1.0/PKG-INFO +166 -0
- estrellio_py_env_tools-0.1.0/README.md +150 -0
- estrellio_py_env_tools-0.1.0/docs/publishing.md +70 -0
- estrellio_py_env_tools-0.1.0/docs/testing.md +44 -0
- estrellio_py_env_tools-0.1.0/docs/usage.md +244 -0
- estrellio_py_env_tools-0.1.0/pyproject.toml +36 -0
- estrellio_py_env_tools-0.1.0/release_tests/test_installed.py +118 -0
- estrellio_py_env_tools-0.1.0/release_tests/test_runtime_target.py +84 -0
- estrellio_py_env_tools-0.1.0/scripts/check_dist.py +40 -0
- estrellio_py_env_tools-0.1.0/scripts/install_minimal_repo.ps1 +204 -0
- estrellio_py_env_tools-0.1.0/scripts/install_minimal_repo.sh +157 -0
- estrellio_py_env_tools-0.1.0/scripts/py_env.ps1 +1231 -0
- estrellio_py_env_tools-0.1.0/scripts/py_env.sh +936 -0
- estrellio_py_env_tools-0.1.0/scripts/py_env_tool.py +17 -0
- estrellio_py_env_tools-0.1.0/scripts/verify_install.py +33 -0
- estrellio_py_env_tools-0.1.0/setup.cfg +4 -0
- estrellio_py_env_tools-0.1.0/src/estrellio_py_env_tools.egg-info/PKG-INFO +166 -0
- estrellio_py_env_tools-0.1.0/src/estrellio_py_env_tools.egg-info/SOURCES.txt +35 -0
- estrellio_py_env_tools-0.1.0/src/estrellio_py_env_tools.egg-info/dependency_links.txt +1 -0
- estrellio_py_env_tools-0.1.0/src/estrellio_py_env_tools.egg-info/entry_points.txt +2 -0
- estrellio_py_env_tools-0.1.0/src/estrellio_py_env_tools.egg-info/requires.txt +3 -0
- estrellio_py_env_tools-0.1.0/src/estrellio_py_env_tools.egg-info/top_level.txt +1 -0
- estrellio_py_env_tools-0.1.0/src/py_env_tools/__init__.py +6 -0
- estrellio_py_env_tools-0.1.0/src/py_env_tools/cli.py +158 -0
- estrellio_py_env_tools-0.1.0/src/py_env_tools/core.py +692 -0
- estrellio_py_env_tools-0.1.0/templates/minimal_repo/config/py_env.json +46 -0
- estrellio_py_env_tools-0.1.0/templates/minimal_repo/config/requirements/default.txt +1 -0
- estrellio_py_env_tools-0.1.0/templates/minimal_repo/py_env.ps1 +19 -0
- estrellio_py_env_tools-0.1.0/templates/minimal_repo/py_env.sh +16 -0
- estrellio_py_env_tools-0.1.0/tests/conftest.py +10 -0
- estrellio_py_env_tools-0.1.0/tests/helpers.py +98 -0
- estrellio_py_env_tools-0.1.0/tests/test_core_library.py +446 -0
- estrellio_py_env_tools-0.1.0/tests/test_install_minimal_repo.py +195 -0
- estrellio_py_env_tools-0.1.0/tests/test_minimal_template.py +161 -0
- estrellio_py_env_tools-0.1.0/tests/test_repository_scripts.py +239 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shade
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
include LICENSE README.md
|
|
2
|
+
recursive-include docs *.md
|
|
3
|
+
recursive-include scripts *.py *.sh *.ps1
|
|
4
|
+
recursive-include tests *.py
|
|
5
|
+
recursive-include release_tests *.py
|
|
6
|
+
recursive-include templates *.sh *.ps1 *.json *.txt
|
|
7
|
+
global-exclude *.py[cod]
|
|
8
|
+
global-exclude *_local.* *_runner.sh *_runner.ps1
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: estrellio-py-env-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Configuration-driven Python environment helpers for AutoScripts-style repos
|
|
5
|
+
Author: shade
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jiangnanqw12/py_env_tools
|
|
8
|
+
Project-URL: Repository, https://github.com/jiangnanqw12/py_env_tools
|
|
9
|
+
Project-URL: Issues, https://github.com/jiangnanqw12/py_env_tools/issues
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Provides-Extra: test
|
|
14
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# py_env_tools
|
|
18
|
+
|
|
19
|
+
Python API and CLI for configuration-driven environment resolution and setup.
|
|
20
|
+
Requires Python 3.10+ with no third-party runtime dependencies.
|
|
21
|
+
|
|
22
|
+
## Python package (release preparation)
|
|
23
|
+
|
|
24
|
+
Version `0.1.0` is being prepared; this change does not publish it to PyPI.
|
|
25
|
+
For local installation from this repository root:
|
|
26
|
+
|
|
27
|
+
```console
|
|
28
|
+
python -m pip install .
|
|
29
|
+
py-env-tool --help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
After the first release is published, install with
|
|
33
|
+
`python -m pip install estrellio-py-env-tools==0.1.0`.
|
|
34
|
+
|
|
35
|
+
The installed `py-env-tool` command supports `resolve-env`, `describe-config`,
|
|
36
|
+
`resolve-python`, `create-venv`, and `install-pipx`. Pass `--config` and
|
|
37
|
+
`--project-dir` explicitly; pip installation does not create project config.
|
|
38
|
+
For example, with an existing configuration:
|
|
39
|
+
|
|
40
|
+
```console
|
|
41
|
+
py-env-tool resolve-env --config config/py_env.json --project-dir . --format json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Python integrations can use `PyEnvError`, `resolve_env_data`, and
|
|
45
|
+
`resolve_python_runtime` from `py_env_tools`, and the existing configuration
|
|
46
|
+
and setup helpers from `py_env_tools.core`. Configuration precedence remains
|
|
47
|
+
shared config, current-platform overrides, then the sibling local config.
|
|
48
|
+
|
|
49
|
+
## Repository scripts and templates
|
|
50
|
+
|
|
51
|
+
The wheel does **not** install the Bash/PowerShell launchers, minimal templates,
|
|
52
|
+
or installer scripts. `write-env`, `run-module`, bootstrap Python discovery,
|
|
53
|
+
and template installation still require the source/submodule layout. The
|
|
54
|
+
Python CLI has its existing output contract, including `AUTOSCRIPTS_*` JSON
|
|
55
|
+
keys; it is not a replacement for the shell wrappers' generic output contract.
|
|
56
|
+
|
|
57
|
+
Repository entrypoints remain `scripts/py_env.sh`, `scripts/py_env.ps1`, and
|
|
58
|
+
`scripts/install_minimal_repo.sh` / `.ps1`. They use the host repository's
|
|
59
|
+
`config/py_env.json` by default; wrappers can override `PY_ENV_CONFIG_PATH`.
|
|
60
|
+
`scripts/py_env_tool.py` is a source launcher for `py_env_tools.cli`, allowing
|
|
61
|
+
repository scripts to work before the package is installed.
|
|
62
|
+
|
|
63
|
+
See [Usage](docs/usage.md), [Testing](docs/testing.md), and
|
|
64
|
+
[Publishing](docs/publishing.md) for the supported interfaces and release checks.
|
|
65
|
+
|
|
66
|
+
## Common Submodule Operations
|
|
67
|
+
|
|
68
|
+
When this repository is used under a parent repo as `libs/py_env_tools`, Git
|
|
69
|
+
tracks two different states:
|
|
70
|
+
|
|
71
|
+
- the commit pinned by the parent repository
|
|
72
|
+
- the latest commit on this repository's own remote branch
|
|
73
|
+
|
|
74
|
+
Common commands from the parent repository root:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Inspect the submodule state recorded by the parent repo
|
|
78
|
+
git submodule status
|
|
79
|
+
git diff --submodule=log -- libs/py_env_tools
|
|
80
|
+
|
|
81
|
+
# Reset the submodule to the commit currently pinned by the parent repo
|
|
82
|
+
git submodule update --init --recursive
|
|
83
|
+
|
|
84
|
+
# Move the submodule itself to the latest origin/main commit
|
|
85
|
+
git -C libs/py_env_tools checkout main
|
|
86
|
+
git -C libs/py_env_tools pull --ff-only
|
|
87
|
+
|
|
88
|
+
# Record the updated submodule pointer in the parent repo
|
|
89
|
+
git add libs/py_env_tools
|
|
90
|
+
git commit -m "Update py_env_tools submodule"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`git submodule update --init --recursive` does not mean "pull the latest remote
|
|
94
|
+
changes for this submodule". It checks out the commit currently recorded by the
|
|
95
|
+
parent repository and commonly leaves the submodule in a detached `HEAD` state.
|
|
96
|
+
|
|
97
|
+
## Minimal Repo Template
|
|
98
|
+
|
|
99
|
+
If a new repository only needs Python environment management, it does not need
|
|
100
|
+
the full AutoScripts wrapper layout. A minimal cross-platform setup is available in:
|
|
101
|
+
|
|
102
|
+
- `templates/minimal_repo/py_env.sh`
|
|
103
|
+
- `templates/minimal_repo/py_env.ps1`
|
|
104
|
+
- `templates/minimal_repo/config/py_env.json`
|
|
105
|
+
- `templates/minimal_repo/config/requirements/default.txt`
|
|
106
|
+
|
|
107
|
+
Copy `py_env.sh` and/or `py_env.ps1` to the new repository root, copy
|
|
108
|
+
`config/py_env.json` into a `config/` directory, and vendor or initialize
|
|
109
|
+
`libs/py_env_tools/` in the new repository. The template entrypoints expose:
|
|
110
|
+
|
|
111
|
+
- `resolve-env`
|
|
112
|
+
- `write-env`
|
|
113
|
+
- `install-pipx`
|
|
114
|
+
- `create-venv`
|
|
115
|
+
|
|
116
|
+
The template keeps the existing `py_env.json` schema but maps environment
|
|
117
|
+
outputs to generic names such as `PY_ENV_PROJECT_DIR` and `PY_ENV_VENV_ROOT`.
|
|
118
|
+
`resolve-env` still reports those values, but `write-env` only persists
|
|
119
|
+
cross-repository-safe state such as `PY_BASE`, `PY_ENV_BOOTSTRAP_PYTHON`, and
|
|
120
|
+
PATH updates for the pipx shim directory.
|
|
121
|
+
|
|
122
|
+
`py_env.json` now also supports an optional top-level `platforms` mapping with
|
|
123
|
+
`windows`, `linux`, and `macos` branches. The effective config is resolved in
|
|
124
|
+
this order:
|
|
125
|
+
|
|
126
|
+
1. Shared config
|
|
127
|
+
2. `platforms.<current-platform>`
|
|
128
|
+
3. `py_env_local.json`
|
|
129
|
+
|
|
130
|
+
Use the shared config for machine-independent defaults, platform branches for
|
|
131
|
+
OS-specific paths such as `pythonBase`, `venvRoot`, and `pipxShimPath`, and
|
|
132
|
+
`py_env_local.json` for one-off machine overrides.
|
|
133
|
+
|
|
134
|
+
If the host repository keeps its public entrypoints under `scripts/`, use the
|
|
135
|
+
helper installer instead of copying files manually:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
bash libs/py_env_tools/scripts/install_minimal_repo.sh --repo-root . --force
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```powershell
|
|
142
|
+
.\libs\py_env_tools\scripts\install_minimal_repo.ps1 -RepoRoot . -Force
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
That command adapts the minimal template for the `scripts/` layout and writes:
|
|
146
|
+
|
|
147
|
+
- `scripts/py_env.sh`
|
|
148
|
+
- `scripts/py_env.ps1`
|
|
149
|
+
- `scripts/config/py_env.json`
|
|
150
|
+
- `scripts/config/requirements/default.txt`
|
|
151
|
+
|
|
152
|
+
It is intended for repositories that only need the minimal environment
|
|
153
|
+
management surface. If your host repo also needs `run-module` wrappers, keep a
|
|
154
|
+
repository-specific `py_env` entry layer instead of overwriting it with the
|
|
155
|
+
minimal template.
|
|
156
|
+
|
|
157
|
+
## Tests
|
|
158
|
+
|
|
159
|
+
The submodule keeps its own pytest suite under `tests/` so it can be validated
|
|
160
|
+
without relying on the parent repository test tree.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
python -m pytest -q tests
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
For target-platform and portable interpreter paths, see [runtime resolution for standalone runners](docs/usage.md#runtime-resolution-for-standalone-runners).
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# py_env_tools
|
|
2
|
+
|
|
3
|
+
Python API and CLI for configuration-driven environment resolution and setup.
|
|
4
|
+
Requires Python 3.10+ with no third-party runtime dependencies.
|
|
5
|
+
|
|
6
|
+
## Python package (release preparation)
|
|
7
|
+
|
|
8
|
+
Version `0.1.0` is being prepared; this change does not publish it to PyPI.
|
|
9
|
+
For local installation from this repository root:
|
|
10
|
+
|
|
11
|
+
```console
|
|
12
|
+
python -m pip install .
|
|
13
|
+
py-env-tool --help
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
After the first release is published, install with
|
|
17
|
+
`python -m pip install estrellio-py-env-tools==0.1.0`.
|
|
18
|
+
|
|
19
|
+
The installed `py-env-tool` command supports `resolve-env`, `describe-config`,
|
|
20
|
+
`resolve-python`, `create-venv`, and `install-pipx`. Pass `--config` and
|
|
21
|
+
`--project-dir` explicitly; pip installation does not create project config.
|
|
22
|
+
For example, with an existing configuration:
|
|
23
|
+
|
|
24
|
+
```console
|
|
25
|
+
py-env-tool resolve-env --config config/py_env.json --project-dir . --format json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Python integrations can use `PyEnvError`, `resolve_env_data`, and
|
|
29
|
+
`resolve_python_runtime` from `py_env_tools`, and the existing configuration
|
|
30
|
+
and setup helpers from `py_env_tools.core`. Configuration precedence remains
|
|
31
|
+
shared config, current-platform overrides, then the sibling local config.
|
|
32
|
+
|
|
33
|
+
## Repository scripts and templates
|
|
34
|
+
|
|
35
|
+
The wheel does **not** install the Bash/PowerShell launchers, minimal templates,
|
|
36
|
+
or installer scripts. `write-env`, `run-module`, bootstrap Python discovery,
|
|
37
|
+
and template installation still require the source/submodule layout. The
|
|
38
|
+
Python CLI has its existing output contract, including `AUTOSCRIPTS_*` JSON
|
|
39
|
+
keys; it is not a replacement for the shell wrappers' generic output contract.
|
|
40
|
+
|
|
41
|
+
Repository entrypoints remain `scripts/py_env.sh`, `scripts/py_env.ps1`, and
|
|
42
|
+
`scripts/install_minimal_repo.sh` / `.ps1`. They use the host repository's
|
|
43
|
+
`config/py_env.json` by default; wrappers can override `PY_ENV_CONFIG_PATH`.
|
|
44
|
+
`scripts/py_env_tool.py` is a source launcher for `py_env_tools.cli`, allowing
|
|
45
|
+
repository scripts to work before the package is installed.
|
|
46
|
+
|
|
47
|
+
See [Usage](docs/usage.md), [Testing](docs/testing.md), and
|
|
48
|
+
[Publishing](docs/publishing.md) for the supported interfaces and release checks.
|
|
49
|
+
|
|
50
|
+
## Common Submodule Operations
|
|
51
|
+
|
|
52
|
+
When this repository is used under a parent repo as `libs/py_env_tools`, Git
|
|
53
|
+
tracks two different states:
|
|
54
|
+
|
|
55
|
+
- the commit pinned by the parent repository
|
|
56
|
+
- the latest commit on this repository's own remote branch
|
|
57
|
+
|
|
58
|
+
Common commands from the parent repository root:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Inspect the submodule state recorded by the parent repo
|
|
62
|
+
git submodule status
|
|
63
|
+
git diff --submodule=log -- libs/py_env_tools
|
|
64
|
+
|
|
65
|
+
# Reset the submodule to the commit currently pinned by the parent repo
|
|
66
|
+
git submodule update --init --recursive
|
|
67
|
+
|
|
68
|
+
# Move the submodule itself to the latest origin/main commit
|
|
69
|
+
git -C libs/py_env_tools checkout main
|
|
70
|
+
git -C libs/py_env_tools pull --ff-only
|
|
71
|
+
|
|
72
|
+
# Record the updated submodule pointer in the parent repo
|
|
73
|
+
git add libs/py_env_tools
|
|
74
|
+
git commit -m "Update py_env_tools submodule"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`git submodule update --init --recursive` does not mean "pull the latest remote
|
|
78
|
+
changes for this submodule". It checks out the commit currently recorded by the
|
|
79
|
+
parent repository and commonly leaves the submodule in a detached `HEAD` state.
|
|
80
|
+
|
|
81
|
+
## Minimal Repo Template
|
|
82
|
+
|
|
83
|
+
If a new repository only needs Python environment management, it does not need
|
|
84
|
+
the full AutoScripts wrapper layout. A minimal cross-platform setup is available in:
|
|
85
|
+
|
|
86
|
+
- `templates/minimal_repo/py_env.sh`
|
|
87
|
+
- `templates/minimal_repo/py_env.ps1`
|
|
88
|
+
- `templates/minimal_repo/config/py_env.json`
|
|
89
|
+
- `templates/minimal_repo/config/requirements/default.txt`
|
|
90
|
+
|
|
91
|
+
Copy `py_env.sh` and/or `py_env.ps1` to the new repository root, copy
|
|
92
|
+
`config/py_env.json` into a `config/` directory, and vendor or initialize
|
|
93
|
+
`libs/py_env_tools/` in the new repository. The template entrypoints expose:
|
|
94
|
+
|
|
95
|
+
- `resolve-env`
|
|
96
|
+
- `write-env`
|
|
97
|
+
- `install-pipx`
|
|
98
|
+
- `create-venv`
|
|
99
|
+
|
|
100
|
+
The template keeps the existing `py_env.json` schema but maps environment
|
|
101
|
+
outputs to generic names such as `PY_ENV_PROJECT_DIR` and `PY_ENV_VENV_ROOT`.
|
|
102
|
+
`resolve-env` still reports those values, but `write-env` only persists
|
|
103
|
+
cross-repository-safe state such as `PY_BASE`, `PY_ENV_BOOTSTRAP_PYTHON`, and
|
|
104
|
+
PATH updates for the pipx shim directory.
|
|
105
|
+
|
|
106
|
+
`py_env.json` now also supports an optional top-level `platforms` mapping with
|
|
107
|
+
`windows`, `linux`, and `macos` branches. The effective config is resolved in
|
|
108
|
+
this order:
|
|
109
|
+
|
|
110
|
+
1. Shared config
|
|
111
|
+
2. `platforms.<current-platform>`
|
|
112
|
+
3. `py_env_local.json`
|
|
113
|
+
|
|
114
|
+
Use the shared config for machine-independent defaults, platform branches for
|
|
115
|
+
OS-specific paths such as `pythonBase`, `venvRoot`, and `pipxShimPath`, and
|
|
116
|
+
`py_env_local.json` for one-off machine overrides.
|
|
117
|
+
|
|
118
|
+
If the host repository keeps its public entrypoints under `scripts/`, use the
|
|
119
|
+
helper installer instead of copying files manually:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
bash libs/py_env_tools/scripts/install_minimal_repo.sh --repo-root . --force
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```powershell
|
|
126
|
+
.\libs\py_env_tools\scripts\install_minimal_repo.ps1 -RepoRoot . -Force
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
That command adapts the minimal template for the `scripts/` layout and writes:
|
|
130
|
+
|
|
131
|
+
- `scripts/py_env.sh`
|
|
132
|
+
- `scripts/py_env.ps1`
|
|
133
|
+
- `scripts/config/py_env.json`
|
|
134
|
+
- `scripts/config/requirements/default.txt`
|
|
135
|
+
|
|
136
|
+
It is intended for repositories that only need the minimal environment
|
|
137
|
+
management surface. If your host repo also needs `run-module` wrappers, keep a
|
|
138
|
+
repository-specific `py_env` entry layer instead of overwriting it with the
|
|
139
|
+
minimal template.
|
|
140
|
+
|
|
141
|
+
## Tests
|
|
142
|
+
|
|
143
|
+
The submodule keeps its own pytest suite under `tests/` so it can be validated
|
|
144
|
+
without relying on the parent repository test tree.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
python -m pytest -q tests
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
For target-platform and portable interpreter paths, see [runtime resolution for standalone runners](docs/usage.md#runtime-resolution-for-standalone-runners).
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Publishing estrellio-py-env-tools
|
|
2
|
+
|
|
3
|
+
## Preparation status
|
|
4
|
+
|
|
5
|
+
Version `0.1.0` is prepared for a first release. This preparation does not
|
|
6
|
+
publish to PyPI or create a release tag. Branch pushes and pull requests run
|
|
7
|
+
validation only. Recheck name/version availability before the first upload.
|
|
8
|
+
|
|
9
|
+
The wheel contains only `py_env_tools` and distribution metadata. The sdist
|
|
10
|
+
also contains the scripts, existing templates, documentation and tests needed
|
|
11
|
+
to rebuild and validate the source. Installing an sdist still installs the
|
|
12
|
+
Python package only; it does not install repository launchers or templates.
|
|
13
|
+
See [Usage](usage.md) for the boundary between installed and repository usage.
|
|
14
|
+
|
|
15
|
+
## Trusted Publisher setup
|
|
16
|
+
|
|
17
|
+
At https://pypi.org/manage/account/publishing/ add a pending publisher:
|
|
18
|
+
|
|
19
|
+
| Field | Value |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| Project | `estrellio-py-env-tools` |
|
|
22
|
+
| Owner | `jiangnanqw12` |
|
|
23
|
+
| Repository | `py_env_tools` |
|
|
24
|
+
| Workflow | `publish.yml` |
|
|
25
|
+
| Environment | `pypi` |
|
|
26
|
+
|
|
27
|
+
Use the filename only for Workflow. Configure this on official PyPI, not
|
|
28
|
+
TestPyPI. The GitHub repository must have a `pypi` environment. No PyPI API
|
|
29
|
+
token is needed. A pending publisher does not reserve the package name.
|
|
30
|
+
|
|
31
|
+
## Validation
|
|
32
|
+
|
|
33
|
+
From a clean checkout, in a development environment:
|
|
34
|
+
|
|
35
|
+
```console
|
|
36
|
+
python -m pip install build twine pytest
|
|
37
|
+
python -m pytest -q tests
|
|
38
|
+
python -m build
|
|
39
|
+
python -m twine check --strict dist/*
|
|
40
|
+
python scripts/check_dist.py dist
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`python -m build` creates the sdist and builds the wheel from it. Use an empty
|
|
44
|
+
output directory so stale artifacts cannot be mistaken for this release.
|
|
45
|
+
Install pytest and the resulting wheel in a fresh virtual environment, then
|
|
46
|
+
use its Python to run:
|
|
47
|
+
|
|
48
|
+
```console
|
|
49
|
+
python scripts/verify_install.py 0.1.0
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This verifies version and import location, copies `release_tests` into a
|
|
53
|
+
separate temporary directory without source-path helpers, and tests the
|
|
54
|
+
installed package. Ubuntu and Windows with Python 3.10 and 3.12 run this in
|
|
55
|
+
CI. The existing complete repository test suite runs separately on Ubuntu.
|
|
56
|
+
Tests use temporary configuration and mock external operations where needed.
|
|
57
|
+
|
|
58
|
+
## Future release
|
|
59
|
+
|
|
60
|
+
1. Confirm the PyPI publisher fields and name/version availability.
|
|
61
|
+
2. Update `project.version` if needed, commit and push main, and wait for CI.
|
|
62
|
+
3. Only when publication is requested, create and push the matching `v0.1.0`
|
|
63
|
+
tag (substitute the actual version). Tags must match package metadata.
|
|
64
|
+
4. The publish job runs only after all checks pass, using OIDC. It alone has
|
|
65
|
+
`id-token: write` permission.
|
|
66
|
+
5. Install the exact published version from official PyPI into a clean
|
|
67
|
+
environment and repeat the installed-package verification.
|
|
68
|
+
|
|
69
|
+
Stop on name/version conflicts; do not automatically rename the project,
|
|
70
|
+
overwrite a release, or silently skip existing artifacts.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Testing
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
The submodule test suite covers:
|
|
6
|
+
|
|
7
|
+
- `core.py` config merge and runtime resolution behavior
|
|
8
|
+
- CLI output for `resolve-env` and `describe-config`
|
|
9
|
+
- Bash repository-facing script behavior around generic env output
|
|
10
|
+
- Minimal template behavior for Linux and WSL repositories
|
|
11
|
+
|
|
12
|
+
PowerShell behavior is still covered mainly through static assertions because
|
|
13
|
+
PowerShell execution is not always available in Linux-only test environments.
|
|
14
|
+
|
|
15
|
+
## Run Tests
|
|
16
|
+
|
|
17
|
+
From the `libs/py_env_tools/` directory:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python -m pytest -q tests
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If the parent repository already has a prepared virtual environment, it is also
|
|
24
|
+
fine to run:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
/path/to/python -m pytest -q libs/py_env_tools/tests
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Test Design Notes
|
|
31
|
+
|
|
32
|
+
- Tests create temporary repositories instead of relying on fixed machine paths.
|
|
33
|
+
- Bash entrypoint tests copy the submodule into a temp repo so the repository
|
|
34
|
+
contract matches real usage.
|
|
35
|
+
- Config fixtures intentionally keep the existing `py_env.json` schema so the
|
|
36
|
+
template and runtime layers stay aligned.
|
|
37
|
+
|
|
38
|
+
## Installed distribution validation
|
|
39
|
+
|
|
40
|
+
Repository tests can import `src/` directly, so passing them alone does not
|
|
41
|
+
prove that the wheel works. `scripts/verify_install.py <version>` runs the
|
|
42
|
+
separate `release_tests` outside the checkout with an installed distribution.
|
|
43
|
+
No source-path conftest is copied. See [Publishing](publishing.md) for build,
|
|
44
|
+
artifact checks, and the Windows/Linux installation matrix.
|