pydepinject 0.0.3.dev0__tar.gz → 0.0.4.dev0__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.
- {pydepinject-0.0.3.dev0/src/pydepinject.egg-info → pydepinject-0.0.4.dev0}/PKG-INFO +28 -5
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/README.md +25 -2
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/pyproject.toml +4 -6
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/pydepinject/__init__.py +5 -5
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0/src/pydepinject.egg-info}/PKG-INFO +28 -5
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/pydepinject.egg-info/requires.txt +1 -1
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/tests/conftest.py +1 -1
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/LICENSE +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/MANIFEST.in +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/setup.cfg +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/pydepinject/backends.py +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/pydepinject.egg-info/SOURCES.txt +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/pydepinject.egg-info/dependency_links.txt +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/pydepinject.egg-info/top_level.txt +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/requirementmanager.egg-info/PKG-INFO +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/requirementmanager.egg-info/SOURCES.txt +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/requirementmanager.egg-info/dependency_links.txt +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/requirementmanager.egg-info/requires.txt +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/requirementmanager.egg-info/top_level.txt +0 -0
- {pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/tests/test_pydepinject.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydepinject
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4.dev0
|
|
4
4
|
Summary: A package to dynamically inject requirements into a virtual environment.
|
|
5
5
|
Author: pydepinject
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,10 +17,10 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
|
17
17
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
18
|
Classifier: Topic :: Software Development :: Libraries
|
|
19
19
|
Classifier: Typing :: Typed
|
|
20
|
-
Requires-Python: >=3.
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: packaging>=
|
|
23
|
+
Requires-Dist: packaging>=24.0
|
|
24
24
|
Requires-Dist: typing-extensions>=4.4.0
|
|
25
25
|
Provides-Extra: lint
|
|
26
26
|
Requires-Dist: isort; extra == "lint"
|
|
@@ -64,9 +64,11 @@ from pydepinject import requires
|
|
|
64
64
|
def my_function():
|
|
65
65
|
import requests
|
|
66
66
|
import numpy as np
|
|
67
|
+
|
|
67
68
|
print(requests.__version__)
|
|
68
69
|
print(np.__version__)
|
|
69
70
|
|
|
71
|
+
|
|
70
72
|
my_function()
|
|
71
73
|
```
|
|
72
74
|
|
|
@@ -81,6 +83,7 @@ from pydepinject import requires
|
|
|
81
83
|
with requires("requests", "numpy"):
|
|
82
84
|
import requests
|
|
83
85
|
import numpy as np
|
|
86
|
+
|
|
84
87
|
print(requests.__version__)
|
|
85
88
|
print(np.__version__)
|
|
86
89
|
```
|
|
@@ -93,30 +96,38 @@ The `requires` can create a virtual environment with a specific name:
|
|
|
93
96
|
@requires("requests", venv_name="myenv")
|
|
94
97
|
def my_function():
|
|
95
98
|
import requests
|
|
99
|
+
|
|
96
100
|
print(requests.__version__)
|
|
97
101
|
|
|
98
102
|
|
|
99
103
|
with requires("pylint", "requests", venv_name="myenv"):
|
|
100
104
|
import pylint
|
|
105
|
+
|
|
101
106
|
print(pylint.__version__)
|
|
102
107
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
108
|
+
|
|
103
109
|
print(requests.__version__)
|
|
104
110
|
|
|
105
111
|
|
|
106
112
|
# The virtual environment name can also be set as PYDEPINJECT_VENV_NAME environment variable
|
|
107
113
|
import os
|
|
114
|
+
|
|
108
115
|
os.environ["PYDEPINJECT_VENV_NAME"] = "myenv"
|
|
109
116
|
|
|
117
|
+
|
|
110
118
|
@requires("requests")
|
|
111
119
|
def my_function():
|
|
112
120
|
import requests
|
|
121
|
+
|
|
113
122
|
print(requests.__version__)
|
|
114
123
|
|
|
115
124
|
|
|
116
125
|
with requires("pylint", "requests"):
|
|
117
126
|
import pylint
|
|
127
|
+
|
|
118
128
|
print(pylint.__version__)
|
|
119
129
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
130
|
+
|
|
120
131
|
print(requests.__version__)
|
|
121
132
|
```
|
|
122
133
|
|
|
@@ -130,13 +141,16 @@ The `requires` can create named virtual environments and reuse them across multi
|
|
|
130
141
|
@requires("requests", venv_name="myenv", ephemeral=False)
|
|
131
142
|
def my_function():
|
|
132
143
|
import requests
|
|
144
|
+
|
|
133
145
|
print(requests.__version__)
|
|
134
146
|
|
|
135
147
|
|
|
136
148
|
with requires("pylint", "requests", venv_name="myenv", ephemeral=False):
|
|
137
149
|
import pylint
|
|
150
|
+
|
|
138
151
|
print(pylint.__version__)
|
|
139
152
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
153
|
+
|
|
140
154
|
print(requests.__version__)
|
|
141
155
|
```
|
|
142
156
|
|
|
@@ -148,8 +162,10 @@ The `requires` can automatically delete ephemeral virtual environments after use
|
|
|
148
162
|
@requires("requests", venv_name="myenv", ephemeral=True)
|
|
149
163
|
def my_function():
|
|
150
164
|
import requests
|
|
165
|
+
|
|
151
166
|
print(requests.__version__)
|
|
152
167
|
|
|
168
|
+
|
|
153
169
|
my_function()
|
|
154
170
|
```
|
|
155
171
|
|
|
@@ -160,12 +176,15 @@ If you need to ensure a completely clean environment, you can force its recreati
|
|
|
160
176
|
```python
|
|
161
177
|
from pydepinject import requires
|
|
162
178
|
|
|
179
|
+
|
|
163
180
|
# This will delete the "my-clean-env" venv if it exists and create it from scratch
|
|
164
181
|
@requires("requests", venv_name="my-clean-env", recreate=True)
|
|
165
182
|
def my_function():
|
|
166
183
|
import requests
|
|
184
|
+
|
|
167
185
|
print(requests.__version__)
|
|
168
186
|
|
|
187
|
+
|
|
169
188
|
my_function()
|
|
170
189
|
```
|
|
171
190
|
|
|
@@ -199,16 +218,20 @@ You can forward extra arguments to the underlying installer (pip or uv pip) via
|
|
|
199
218
|
```python
|
|
200
219
|
from pydepinject import requires
|
|
201
220
|
|
|
221
|
+
|
|
202
222
|
@requires(
|
|
203
223
|
"requests",
|
|
204
224
|
install_args=(
|
|
205
|
-
"--index-url",
|
|
206
|
-
"
|
|
225
|
+
"--index-url",
|
|
226
|
+
"https://pypi.myorg/simple",
|
|
227
|
+
"--upgrade-strategy",
|
|
228
|
+
"eager",
|
|
207
229
|
),
|
|
208
230
|
venv_backend="venv",
|
|
209
231
|
)
|
|
210
232
|
def my_function():
|
|
211
233
|
import requests
|
|
234
|
+
|
|
212
235
|
print(requests.__version__)
|
|
213
236
|
```
|
|
214
237
|
|
|
@@ -31,9 +31,11 @@ from pydepinject import requires
|
|
|
31
31
|
def my_function():
|
|
32
32
|
import requests
|
|
33
33
|
import numpy as np
|
|
34
|
+
|
|
34
35
|
print(requests.__version__)
|
|
35
36
|
print(np.__version__)
|
|
36
37
|
|
|
38
|
+
|
|
37
39
|
my_function()
|
|
38
40
|
```
|
|
39
41
|
|
|
@@ -48,6 +50,7 @@ from pydepinject import requires
|
|
|
48
50
|
with requires("requests", "numpy"):
|
|
49
51
|
import requests
|
|
50
52
|
import numpy as np
|
|
53
|
+
|
|
51
54
|
print(requests.__version__)
|
|
52
55
|
print(np.__version__)
|
|
53
56
|
```
|
|
@@ -60,30 +63,38 @@ The `requires` can create a virtual environment with a specific name:
|
|
|
60
63
|
@requires("requests", venv_name="myenv")
|
|
61
64
|
def my_function():
|
|
62
65
|
import requests
|
|
66
|
+
|
|
63
67
|
print(requests.__version__)
|
|
64
68
|
|
|
65
69
|
|
|
66
70
|
with requires("pylint", "requests", venv_name="myenv"):
|
|
67
71
|
import pylint
|
|
72
|
+
|
|
68
73
|
print(pylint.__version__)
|
|
69
74
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
75
|
+
|
|
70
76
|
print(requests.__version__)
|
|
71
77
|
|
|
72
78
|
|
|
73
79
|
# The virtual environment name can also be set as PYDEPINJECT_VENV_NAME environment variable
|
|
74
80
|
import os
|
|
81
|
+
|
|
75
82
|
os.environ["PYDEPINJECT_VENV_NAME"] = "myenv"
|
|
76
83
|
|
|
84
|
+
|
|
77
85
|
@requires("requests")
|
|
78
86
|
def my_function():
|
|
79
87
|
import requests
|
|
88
|
+
|
|
80
89
|
print(requests.__version__)
|
|
81
90
|
|
|
82
91
|
|
|
83
92
|
with requires("pylint", "requests"):
|
|
84
93
|
import pylint
|
|
94
|
+
|
|
85
95
|
print(pylint.__version__)
|
|
86
96
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
97
|
+
|
|
87
98
|
print(requests.__version__)
|
|
88
99
|
```
|
|
89
100
|
|
|
@@ -97,13 +108,16 @@ The `requires` can create named virtual environments and reuse them across multi
|
|
|
97
108
|
@requires("requests", venv_name="myenv", ephemeral=False)
|
|
98
109
|
def my_function():
|
|
99
110
|
import requests
|
|
111
|
+
|
|
100
112
|
print(requests.__version__)
|
|
101
113
|
|
|
102
114
|
|
|
103
115
|
with requires("pylint", "requests", venv_name="myenv", ephemeral=False):
|
|
104
116
|
import pylint
|
|
117
|
+
|
|
105
118
|
print(pylint.__version__)
|
|
106
119
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
120
|
+
|
|
107
121
|
print(requests.__version__)
|
|
108
122
|
```
|
|
109
123
|
|
|
@@ -115,8 +129,10 @@ The `requires` can automatically delete ephemeral virtual environments after use
|
|
|
115
129
|
@requires("requests", venv_name="myenv", ephemeral=True)
|
|
116
130
|
def my_function():
|
|
117
131
|
import requests
|
|
132
|
+
|
|
118
133
|
print(requests.__version__)
|
|
119
134
|
|
|
135
|
+
|
|
120
136
|
my_function()
|
|
121
137
|
```
|
|
122
138
|
|
|
@@ -127,12 +143,15 @@ If you need to ensure a completely clean environment, you can force its recreati
|
|
|
127
143
|
```python
|
|
128
144
|
from pydepinject import requires
|
|
129
145
|
|
|
146
|
+
|
|
130
147
|
# This will delete the "my-clean-env" venv if it exists and create it from scratch
|
|
131
148
|
@requires("requests", venv_name="my-clean-env", recreate=True)
|
|
132
149
|
def my_function():
|
|
133
150
|
import requests
|
|
151
|
+
|
|
134
152
|
print(requests.__version__)
|
|
135
153
|
|
|
154
|
+
|
|
136
155
|
my_function()
|
|
137
156
|
```
|
|
138
157
|
|
|
@@ -166,16 +185,20 @@ You can forward extra arguments to the underlying installer (pip or uv pip) via
|
|
|
166
185
|
```python
|
|
167
186
|
from pydepinject import requires
|
|
168
187
|
|
|
188
|
+
|
|
169
189
|
@requires(
|
|
170
190
|
"requests",
|
|
171
191
|
install_args=(
|
|
172
|
-
"--index-url",
|
|
173
|
-
"
|
|
192
|
+
"--index-url",
|
|
193
|
+
"https://pypi.myorg/simple",
|
|
194
|
+
"--upgrade-strategy",
|
|
195
|
+
"eager",
|
|
174
196
|
),
|
|
175
197
|
venv_backend="venv",
|
|
176
198
|
)
|
|
177
199
|
def my_function():
|
|
178
200
|
import requests
|
|
201
|
+
|
|
179
202
|
print(requests.__version__)
|
|
180
203
|
```
|
|
181
204
|
|
|
@@ -14,9 +14,9 @@ authors = [
|
|
|
14
14
|
]
|
|
15
15
|
license = "MIT"
|
|
16
16
|
keywords = ["virtualenv", "requirements", "dependency management"]
|
|
17
|
-
requires-python = ">=3.
|
|
17
|
+
requires-python = ">=3.11"
|
|
18
18
|
dependencies = [
|
|
19
|
-
"packaging>=
|
|
19
|
+
"packaging>=24.0",
|
|
20
20
|
"typing-extensions>=4.4.0",
|
|
21
21
|
]
|
|
22
22
|
classifiers = [
|
|
@@ -54,11 +54,9 @@ packages = ["pydepinject"]
|
|
|
54
54
|
[tool.setuptools.dynamic]
|
|
55
55
|
version = {attr = "pydepinject.VERSION"}
|
|
56
56
|
|
|
57
|
-
[tool.pytest]
|
|
57
|
+
[tool.pytest.ini_options]
|
|
58
58
|
log_cli = true
|
|
59
59
|
log_level = "DEBUG"
|
|
60
|
-
|
|
61
|
-
[tool.pytest.ini_options]
|
|
62
60
|
pythonpath = "src"
|
|
63
61
|
testpaths = ["tests"]
|
|
64
62
|
addopts = "--durations=10 -n auto"
|
|
@@ -98,6 +96,7 @@ ignore = [
|
|
|
98
96
|
"PLW2901",
|
|
99
97
|
"RET503",
|
|
100
98
|
"RUF005",
|
|
99
|
+
"RUF067",
|
|
101
100
|
"S404",
|
|
102
101
|
"S603",
|
|
103
102
|
"SLF001",
|
|
@@ -137,7 +136,6 @@ reportImplicitStringConcatenation = true
|
|
|
137
136
|
reportImportCycles = true
|
|
138
137
|
reportMissingSuperCall = false
|
|
139
138
|
reportPropertyTypeMismatch = true
|
|
140
|
-
reportShadowedImports = true
|
|
141
139
|
reportUninitializedInstanceVariable = true
|
|
142
140
|
reportUnnecessaryTypeIgnoreComment = false # reportMissingImports for tomllib is valid python<3.11.
|
|
143
141
|
reportUnusedCallResult = false
|
|
@@ -23,7 +23,7 @@ from .backends import VenvBackendRegistry
|
|
|
23
23
|
P = typing.ParamSpec("P")
|
|
24
24
|
R = typing.TypeVar("R")
|
|
25
25
|
|
|
26
|
-
VERSION = "0.0.
|
|
26
|
+
VERSION = "0.0.4dev0"
|
|
27
27
|
__version__ = VERSION
|
|
28
28
|
|
|
29
29
|
logger = logging.getLogger(__name__)
|
|
@@ -221,7 +221,7 @@ class RequirementManager:
|
|
|
221
221
|
extra_args=list(self._install_args) if self._install_args else None,
|
|
222
222
|
)
|
|
223
223
|
# Write metadata file for traceability
|
|
224
|
-
timestamp = int(datetime.datetime.now(tz=datetime.
|
|
224
|
+
timestamp = int(datetime.datetime.now(tz=datetime.UTC).timestamp())
|
|
225
225
|
meta_filepath = self.venv_path / f".pydepinject-{timestamp}.json"
|
|
226
226
|
try:
|
|
227
227
|
meta = {
|
|
@@ -234,7 +234,7 @@ class RequirementManager:
|
|
|
234
234
|
"platform": sys.platform,
|
|
235
235
|
"packages": list(self.packages),
|
|
236
236
|
"install_args": list(self._install_args),
|
|
237
|
-
"timestamp": datetime.datetime.now(datetime.
|
|
237
|
+
"timestamp": datetime.datetime.now(datetime.UTC).isoformat(),
|
|
238
238
|
}
|
|
239
239
|
meta_filepath.write_text(json.dumps(meta, indent=2))
|
|
240
240
|
logger.debug("Wrote venv metadata to: %s", meta_filepath)
|
|
@@ -319,7 +319,7 @@ class RequirementManager:
|
|
|
319
319
|
try:
|
|
320
320
|
self._activate_venv()
|
|
321
321
|
except RuntimeError:
|
|
322
|
-
logger.exception("Failed to activate venv
|
|
322
|
+
logger.exception("Failed to activate venv")
|
|
323
323
|
if self.ephemeral:
|
|
324
324
|
self._deactivate_venv()
|
|
325
325
|
raise
|
|
@@ -339,7 +339,7 @@ class RequirementManager:
|
|
|
339
339
|
try:
|
|
340
340
|
self._activate_venv()
|
|
341
341
|
except RuntimeError:
|
|
342
|
-
logger.exception("Failed to activate venv
|
|
342
|
+
logger.exception("Failed to activate venv")
|
|
343
343
|
if self.ephemeral:
|
|
344
344
|
self._deactivate_venv()
|
|
345
345
|
raise
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydepinject
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4.dev0
|
|
4
4
|
Summary: A package to dynamically inject requirements into a virtual environment.
|
|
5
5
|
Author: pydepinject
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,10 +17,10 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
|
17
17
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
18
|
Classifier: Topic :: Software Development :: Libraries
|
|
19
19
|
Classifier: Typing :: Typed
|
|
20
|
-
Requires-Python: >=3.
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: packaging>=
|
|
23
|
+
Requires-Dist: packaging>=24.0
|
|
24
24
|
Requires-Dist: typing-extensions>=4.4.0
|
|
25
25
|
Provides-Extra: lint
|
|
26
26
|
Requires-Dist: isort; extra == "lint"
|
|
@@ -64,9 +64,11 @@ from pydepinject import requires
|
|
|
64
64
|
def my_function():
|
|
65
65
|
import requests
|
|
66
66
|
import numpy as np
|
|
67
|
+
|
|
67
68
|
print(requests.__version__)
|
|
68
69
|
print(np.__version__)
|
|
69
70
|
|
|
71
|
+
|
|
70
72
|
my_function()
|
|
71
73
|
```
|
|
72
74
|
|
|
@@ -81,6 +83,7 @@ from pydepinject import requires
|
|
|
81
83
|
with requires("requests", "numpy"):
|
|
82
84
|
import requests
|
|
83
85
|
import numpy as np
|
|
86
|
+
|
|
84
87
|
print(requests.__version__)
|
|
85
88
|
print(np.__version__)
|
|
86
89
|
```
|
|
@@ -93,30 +96,38 @@ The `requires` can create a virtual environment with a specific name:
|
|
|
93
96
|
@requires("requests", venv_name="myenv")
|
|
94
97
|
def my_function():
|
|
95
98
|
import requests
|
|
99
|
+
|
|
96
100
|
print(requests.__version__)
|
|
97
101
|
|
|
98
102
|
|
|
99
103
|
with requires("pylint", "requests", venv_name="myenv"):
|
|
100
104
|
import pylint
|
|
105
|
+
|
|
101
106
|
print(pylint.__version__)
|
|
102
107
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
108
|
+
|
|
103
109
|
print(requests.__version__)
|
|
104
110
|
|
|
105
111
|
|
|
106
112
|
# The virtual environment name can also be set as PYDEPINJECT_VENV_NAME environment variable
|
|
107
113
|
import os
|
|
114
|
+
|
|
108
115
|
os.environ["PYDEPINJECT_VENV_NAME"] = "myenv"
|
|
109
116
|
|
|
117
|
+
|
|
110
118
|
@requires("requests")
|
|
111
119
|
def my_function():
|
|
112
120
|
import requests
|
|
121
|
+
|
|
113
122
|
print(requests.__version__)
|
|
114
123
|
|
|
115
124
|
|
|
116
125
|
with requires("pylint", "requests"):
|
|
117
126
|
import pylint
|
|
127
|
+
|
|
118
128
|
print(pylint.__version__)
|
|
119
129
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
130
|
+
|
|
120
131
|
print(requests.__version__)
|
|
121
132
|
```
|
|
122
133
|
|
|
@@ -130,13 +141,16 @@ The `requires` can create named virtual environments and reuse them across multi
|
|
|
130
141
|
@requires("requests", venv_name="myenv", ephemeral=False)
|
|
131
142
|
def my_function():
|
|
132
143
|
import requests
|
|
144
|
+
|
|
133
145
|
print(requests.__version__)
|
|
134
146
|
|
|
135
147
|
|
|
136
148
|
with requires("pylint", "requests", venv_name="myenv", ephemeral=False):
|
|
137
149
|
import pylint
|
|
150
|
+
|
|
138
151
|
print(pylint.__version__)
|
|
139
152
|
import requests # This is also available here because it was installed in the same virtual environment
|
|
153
|
+
|
|
140
154
|
print(requests.__version__)
|
|
141
155
|
```
|
|
142
156
|
|
|
@@ -148,8 +162,10 @@ The `requires` can automatically delete ephemeral virtual environments after use
|
|
|
148
162
|
@requires("requests", venv_name="myenv", ephemeral=True)
|
|
149
163
|
def my_function():
|
|
150
164
|
import requests
|
|
165
|
+
|
|
151
166
|
print(requests.__version__)
|
|
152
167
|
|
|
168
|
+
|
|
153
169
|
my_function()
|
|
154
170
|
```
|
|
155
171
|
|
|
@@ -160,12 +176,15 @@ If you need to ensure a completely clean environment, you can force its recreati
|
|
|
160
176
|
```python
|
|
161
177
|
from pydepinject import requires
|
|
162
178
|
|
|
179
|
+
|
|
163
180
|
# This will delete the "my-clean-env" venv if it exists and create it from scratch
|
|
164
181
|
@requires("requests", venv_name="my-clean-env", recreate=True)
|
|
165
182
|
def my_function():
|
|
166
183
|
import requests
|
|
184
|
+
|
|
167
185
|
print(requests.__version__)
|
|
168
186
|
|
|
187
|
+
|
|
169
188
|
my_function()
|
|
170
189
|
```
|
|
171
190
|
|
|
@@ -199,16 +218,20 @@ You can forward extra arguments to the underlying installer (pip or uv pip) via
|
|
|
199
218
|
```python
|
|
200
219
|
from pydepinject import requires
|
|
201
220
|
|
|
221
|
+
|
|
202
222
|
@requires(
|
|
203
223
|
"requests",
|
|
204
224
|
install_args=(
|
|
205
|
-
"--index-url",
|
|
206
|
-
"
|
|
225
|
+
"--index-url",
|
|
226
|
+
"https://pypi.myorg/simple",
|
|
227
|
+
"--upgrade-strategy",
|
|
228
|
+
"eager",
|
|
207
229
|
),
|
|
208
230
|
venv_backend="venv",
|
|
209
231
|
)
|
|
210
232
|
def my_function():
|
|
211
233
|
import requests
|
|
234
|
+
|
|
212
235
|
print(requests.__version__)
|
|
213
236
|
```
|
|
214
237
|
|
|
@@ -7,7 +7,7 @@ import pytest
|
|
|
7
7
|
PROJECT_DIR = pathlib.Path(__file__).parent.parent
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
@pytest.fixture(autouse=True)
|
|
10
|
+
@pytest.fixture(autouse=True) # noqa: RUF076
|
|
11
11
|
def _check_test_leftovers():
|
|
12
12
|
"""Checks if the test left any files in the project directory."""
|
|
13
13
|
items_before = list(PROJECT_DIR.iterdir())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/pydepinject.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/requirementmanager.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/requirementmanager.egg-info/requires.txt
RENAMED
|
File without changes
|
{pydepinject-0.0.3.dev0 → pydepinject-0.0.4.dev0}/src/requirementmanager.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|