dependence 0.3.7__tar.gz → 1.0a0__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.
- dependence-1.0a0/.gitignore +20 -0
- dependence-1.0a0/PKG-INFO +179 -0
- dependence-1.0a0/README.md +162 -0
- dependence-0.3.7/dependence/utilities.py → dependence-1.0a0/dependence/_utilities.py +415 -347
- {dependence-0.3.7 → dependence-1.0a0}/dependence/freeze.py +86 -45
- {dependence-0.3.7 → dependence-1.0a0}/dependence/update.py +194 -86
- dependence-1.0a0/pyproject.toml +104 -0
- dependence-0.3.7/PKG-INFO +0 -139
- dependence-0.3.7/README.md +0 -123
- dependence-0.3.7/dependence/_utilities.py +0 -175
- dependence-0.3.7/dependence.egg-info/PKG-INFO +0 -139
- dependence-0.3.7/dependence.egg-info/SOURCES.txt +0 -19
- dependence-0.3.7/dependence.egg-info/dependency_links.txt +0 -1
- dependence-0.3.7/dependence.egg-info/entry_points.txt +0 -2
- dependence-0.3.7/dependence.egg-info/requires.txt +0 -5
- dependence-0.3.7/dependence.egg-info/top_level.txt +0 -1
- dependence-0.3.7/pyproject.toml +0 -28
- dependence-0.3.7/setup.cfg +0 -35
- dependence-0.3.7/setup.py +0 -3
- dependence-0.3.7/tests/test_freeze.py +0 -64
- dependence-0.3.7/tests/test_update.py +0 -199
- {dependence-0.3.7 → dependence-1.0a0}/dependence/__init__.py +0 -0
- {dependence-0.3.7 → dependence-1.0a0}/dependence/__main__.py +0 -0
- {dependence-0.3.7 → dependence-1.0a0}/dependence/py.typed +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
**/*~
|
|
2
|
+
**/.*
|
|
3
|
+
build
|
|
4
|
+
dist
|
|
5
|
+
venv
|
|
6
|
+
**.pyc
|
|
7
|
+
**.pyo
|
|
8
|
+
**.egg
|
|
9
|
+
**.sqlite
|
|
10
|
+
**/__pycache__
|
|
11
|
+
*.egg-info
|
|
12
|
+
**/*.egg-info
|
|
13
|
+
**/*.dist-info
|
|
14
|
+
pip-wheel-metadata
|
|
15
|
+
!.github
|
|
16
|
+
!.gitignore
|
|
17
|
+
!.flake8
|
|
18
|
+
!.markdownlint.yaml
|
|
19
|
+
!.editorconfig
|
|
20
|
+
site
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: dependence
|
|
3
|
+
Version: 1.0a0
|
|
4
|
+
Summary: A dependency management tool for python projects
|
|
5
|
+
Project-URL: Homepage, https://dependence.enorganic.org
|
|
6
|
+
Author-email: david@belais.me
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: dependencies,requirements
|
|
9
|
+
Requires-Python: ~=3.8
|
|
10
|
+
Requires-Dist: jsonpointer
|
|
11
|
+
Requires-Dist: packaging
|
|
12
|
+
Requires-Dist: pip
|
|
13
|
+
Requires-Dist: setuptools>63
|
|
14
|
+
Requires-Dist: tomli-w~=1.0
|
|
15
|
+
Requires-Dist: tomli~=2.2
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# dependence
|
|
19
|
+
|
|
20
|
+
[](https://github.com/enorganic/dependence/actions/workflows/test.yml)
|
|
21
|
+
[](https://badge.fury.io/py/dependence)
|
|
22
|
+
|
|
23
|
+
Dependence provides a Command Line Interface and library for aligning
|
|
24
|
+
a python projects' declared dependencies with the package versions
|
|
25
|
+
installed in the environment in which `dependence` is executed, and for
|
|
26
|
+
"freezing" recursively resolved package dependencies (like `pip freeze`, but
|
|
27
|
+
for a package, instead of the entire environment).
|
|
28
|
+
|
|
29
|
+
- [Documentation](https://enorganic.github.io/dependence/)
|
|
30
|
+
- [Contributing](https://enorganic.github.io/dependence/contributing)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
You can install `dependence` with pip:
|
|
35
|
+
|
|
36
|
+
```shell
|
|
37
|
+
pip3 install dependence
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Example Usage
|
|
41
|
+
|
|
42
|
+
### Listing Dependencies
|
|
43
|
+
|
|
44
|
+
The `dependence freeze` command, and the `dependence.freeze.freeze` function,
|
|
45
|
+
print all requirements for one or more specified python project,
|
|
46
|
+
requirements.txt, pyproject.toml, setup.cfg, or tox.ini files. The output
|
|
47
|
+
format matches that of `pip freeze`, but only lists dependencies of indicated
|
|
48
|
+
packages and/or editable project locations.
|
|
49
|
+
|
|
50
|
+
You may refer to the [`dependence freeze` CLI reference](https://dependence.enorganic.org/cli.md#dependence-freeze)
|
|
51
|
+
and/or [`dependence.freeze` API reference](https://dependence.enorganic.org/api/freeze.md) for details
|
|
52
|
+
concerning this command/module, related options, and more complex use case
|
|
53
|
+
examples.
|
|
54
|
+
|
|
55
|
+
We'll use this project, `dependence`, as a simple example. To start with, let's
|
|
56
|
+
see what the currently installed dependencies for this package look like
|
|
57
|
+
at the time of writing:
|
|
58
|
+
|
|
59
|
+
```console
|
|
60
|
+
$ dependence freeze .
|
|
61
|
+
packaging==24.1
|
|
62
|
+
pip==24.3.0
|
|
63
|
+
setuptools==75.1.0
|
|
64
|
+
tomli==2.1.0
|
|
65
|
+
tomli_w==1.0.0
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
...now let's save this output for later comparison purposes:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
dependence freeze . > requirements_before.txt
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Now, we'll upgrade our dependencies and see what they look like after:
|
|
75
|
+
|
|
76
|
+
```console
|
|
77
|
+
$ pip install -q --upgrade --upgrade-strategy eager . && dependence freeze .
|
|
78
|
+
packaging==24.2
|
|
79
|
+
pip==24.3.1
|
|
80
|
+
setuptools==75.3.0
|
|
81
|
+
tomli==2.2.1
|
|
82
|
+
tomli_w==1.0.0
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
...next let's dump them to a file and compare them with our previous
|
|
86
|
+
dependencies:
|
|
87
|
+
|
|
88
|
+
```console
|
|
89
|
+
$ dependence freeze . > dependence_after.txt
|
|
90
|
+
$ diff dependence_before.txt dependence_after.txt
|
|
91
|
+
1,5c1,5
|
|
92
|
+
< packaging==24.1
|
|
93
|
+
< pip==24.3.0
|
|
94
|
+
< setuptools==75.1.0
|
|
95
|
+
< tomli==2.1.0
|
|
96
|
+
< tomli_w==1.0.0
|
|
97
|
+
---
|
|
98
|
+
> packaging==24.2
|
|
99
|
+
> pip==24.3.1
|
|
100
|
+
> setuptools==75.3.0
|
|
101
|
+
> tomli==2.2.1
|
|
102
|
+
> tomli_w==1.0.1
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
As you can see above, *all* of our dependencies have been upgraded.
|
|
106
|
+
|
|
107
|
+
### Updating Requirement Specifiers
|
|
108
|
+
|
|
109
|
+
To start with, let's take a look at our pyproject.toml file:
|
|
110
|
+
|
|
111
|
+
```toml
|
|
112
|
+
[project]
|
|
113
|
+
name = "dependence"
|
|
114
|
+
version = "1.0.0"
|
|
115
|
+
dependencies = [
|
|
116
|
+
"packaging>23",
|
|
117
|
+
"pip",
|
|
118
|
+
"setuptools>63",
|
|
119
|
+
"tomli-w~=1.0",
|
|
120
|
+
"tomli~=2.1",
|
|
121
|
+
]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Now that we've upgraded our dependencies, we want to update our
|
|
125
|
+
pyproject.toml file to align with our upgraded dependencies. This is desirable
|
|
126
|
+
to ensure that `dependence` isn't installed alongside a version of one of its
|
|
127
|
+
dependencies preceding functionality utilized by `dependence`.
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
dependence update pyproject.toml
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Afterwards, our pyproject.toml file looks like this:
|
|
134
|
+
|
|
135
|
+
```toml
|
|
136
|
+
[project]
|
|
137
|
+
name = "dependence"
|
|
138
|
+
version = "1.0.0"
|
|
139
|
+
dependencies = [
|
|
140
|
+
"packaging>23",
|
|
141
|
+
"pip",
|
|
142
|
+
"setuptools>63",
|
|
143
|
+
"tomli-w~=1.0",
|
|
144
|
+
"tomli~=2.2",
|
|
145
|
+
]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Here's the diff:
|
|
149
|
+
|
|
150
|
+
```console
|
|
151
|
+
$ diff pyproject_before.toml pyproject_after.toml
|
|
152
|
+
9c9
|
|
153
|
+
< "tomli~=2.1",
|
|
154
|
+
---
|
|
155
|
+
> "tomli~=2.2",
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
As you can see, only the version specifier for tomli changed. We know that
|
|
159
|
+
every dependency was upgraded, wo why was only the `tomli` version specifier
|
|
160
|
+
updated? By design. Here are the rules `dependence update` adheres to:
|
|
161
|
+
|
|
162
|
+
- We only update requirements versions when they have *inclusive* specifiers.
|
|
163
|
+
For example, `~=`, `>=`, and `<=` are inclusive, whereas `!=`, `>`, and
|
|
164
|
+
`<` are *exclusive*. For this reason, nothing changed for
|
|
165
|
+
"packaging" and "setuptools" in our above example.
|
|
166
|
+
- We always retain the existing level of specificity. If your version
|
|
167
|
+
specifier is `~=1.2`, and the new version is `1.5.6`, we're going to
|
|
168
|
+
update your specifier to `~=1.5`. If your requirement has a minor version
|
|
169
|
+
level of specificity, and only a patch version upgrade is performed,
|
|
170
|
+
nothing will change in your project dependency specifier. This is why
|
|
171
|
+
you do not see any change in our above pyproject.toml file for the
|
|
172
|
+
`tomli-w` dependency—both new and old share the same minor version.
|
|
173
|
+
- If your requirement is unversioned, we don't touch it, of course. This is
|
|
174
|
+
why you didn't see any change for "pip".
|
|
175
|
+
|
|
176
|
+
You may refer to the [`dependence update` CLI reference](https://dependence.enorganic.org/cli.md#dependence-update)
|
|
177
|
+
and/or [`dependence.update` API reference](https://dependence.enorganic.org/api/update.md) for details
|
|
178
|
+
concerning this command/module, related options, and more complex use
|
|
179
|
+
cases/examples.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# dependence
|
|
2
|
+
|
|
3
|
+
[](https://github.com/enorganic/dependence/actions/workflows/test.yml)
|
|
4
|
+
[](https://badge.fury.io/py/dependence)
|
|
5
|
+
|
|
6
|
+
Dependence provides a Command Line Interface and library for aligning
|
|
7
|
+
a python projects' declared dependencies with the package versions
|
|
8
|
+
installed in the environment in which `dependence` is executed, and for
|
|
9
|
+
"freezing" recursively resolved package dependencies (like `pip freeze`, but
|
|
10
|
+
for a package, instead of the entire environment).
|
|
11
|
+
|
|
12
|
+
- [Documentation](https://enorganic.github.io/dependence/)
|
|
13
|
+
- [Contributing](https://enorganic.github.io/dependence/contributing)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
You can install `dependence` with pip:
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
pip3 install dependence
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Example Usage
|
|
24
|
+
|
|
25
|
+
### Listing Dependencies
|
|
26
|
+
|
|
27
|
+
The `dependence freeze` command, and the `dependence.freeze.freeze` function,
|
|
28
|
+
print all requirements for one or more specified python project,
|
|
29
|
+
requirements.txt, pyproject.toml, setup.cfg, or tox.ini files. The output
|
|
30
|
+
format matches that of `pip freeze`, but only lists dependencies of indicated
|
|
31
|
+
packages and/or editable project locations.
|
|
32
|
+
|
|
33
|
+
You may refer to the [`dependence freeze` CLI reference](https://dependence.enorganic.org/cli.md#dependence-freeze)
|
|
34
|
+
and/or [`dependence.freeze` API reference](https://dependence.enorganic.org/api/freeze.md) for details
|
|
35
|
+
concerning this command/module, related options, and more complex use case
|
|
36
|
+
examples.
|
|
37
|
+
|
|
38
|
+
We'll use this project, `dependence`, as a simple example. To start with, let's
|
|
39
|
+
see what the currently installed dependencies for this package look like
|
|
40
|
+
at the time of writing:
|
|
41
|
+
|
|
42
|
+
```console
|
|
43
|
+
$ dependence freeze .
|
|
44
|
+
packaging==24.1
|
|
45
|
+
pip==24.3.0
|
|
46
|
+
setuptools==75.1.0
|
|
47
|
+
tomli==2.1.0
|
|
48
|
+
tomli_w==1.0.0
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
...now let's save this output for later comparison purposes:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
dependence freeze . > requirements_before.txt
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Now, we'll upgrade our dependencies and see what they look like after:
|
|
58
|
+
|
|
59
|
+
```console
|
|
60
|
+
$ pip install -q --upgrade --upgrade-strategy eager . && dependence freeze .
|
|
61
|
+
packaging==24.2
|
|
62
|
+
pip==24.3.1
|
|
63
|
+
setuptools==75.3.0
|
|
64
|
+
tomli==2.2.1
|
|
65
|
+
tomli_w==1.0.0
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
...next let's dump them to a file and compare them with our previous
|
|
69
|
+
dependencies:
|
|
70
|
+
|
|
71
|
+
```console
|
|
72
|
+
$ dependence freeze . > dependence_after.txt
|
|
73
|
+
$ diff dependence_before.txt dependence_after.txt
|
|
74
|
+
1,5c1,5
|
|
75
|
+
< packaging==24.1
|
|
76
|
+
< pip==24.3.0
|
|
77
|
+
< setuptools==75.1.0
|
|
78
|
+
< tomli==2.1.0
|
|
79
|
+
< tomli_w==1.0.0
|
|
80
|
+
---
|
|
81
|
+
> packaging==24.2
|
|
82
|
+
> pip==24.3.1
|
|
83
|
+
> setuptools==75.3.0
|
|
84
|
+
> tomli==2.2.1
|
|
85
|
+
> tomli_w==1.0.1
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
As you can see above, *all* of our dependencies have been upgraded.
|
|
89
|
+
|
|
90
|
+
### Updating Requirement Specifiers
|
|
91
|
+
|
|
92
|
+
To start with, let's take a look at our pyproject.toml file:
|
|
93
|
+
|
|
94
|
+
```toml
|
|
95
|
+
[project]
|
|
96
|
+
name = "dependence"
|
|
97
|
+
version = "1.0.0"
|
|
98
|
+
dependencies = [
|
|
99
|
+
"packaging>23",
|
|
100
|
+
"pip",
|
|
101
|
+
"setuptools>63",
|
|
102
|
+
"tomli-w~=1.0",
|
|
103
|
+
"tomli~=2.1",
|
|
104
|
+
]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Now that we've upgraded our dependencies, we want to update our
|
|
108
|
+
pyproject.toml file to align with our upgraded dependencies. This is desirable
|
|
109
|
+
to ensure that `dependence` isn't installed alongside a version of one of its
|
|
110
|
+
dependencies preceding functionality utilized by `dependence`.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
dependence update pyproject.toml
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Afterwards, our pyproject.toml file looks like this:
|
|
117
|
+
|
|
118
|
+
```toml
|
|
119
|
+
[project]
|
|
120
|
+
name = "dependence"
|
|
121
|
+
version = "1.0.0"
|
|
122
|
+
dependencies = [
|
|
123
|
+
"packaging>23",
|
|
124
|
+
"pip",
|
|
125
|
+
"setuptools>63",
|
|
126
|
+
"tomli-w~=1.0",
|
|
127
|
+
"tomli~=2.2",
|
|
128
|
+
]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Here's the diff:
|
|
132
|
+
|
|
133
|
+
```console
|
|
134
|
+
$ diff pyproject_before.toml pyproject_after.toml
|
|
135
|
+
9c9
|
|
136
|
+
< "tomli~=2.1",
|
|
137
|
+
---
|
|
138
|
+
> "tomli~=2.2",
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
As you can see, only the version specifier for tomli changed. We know that
|
|
142
|
+
every dependency was upgraded, wo why was only the `tomli` version specifier
|
|
143
|
+
updated? By design. Here are the rules `dependence update` adheres to:
|
|
144
|
+
|
|
145
|
+
- We only update requirements versions when they have *inclusive* specifiers.
|
|
146
|
+
For example, `~=`, `>=`, and `<=` are inclusive, whereas `!=`, `>`, and
|
|
147
|
+
`<` are *exclusive*. For this reason, nothing changed for
|
|
148
|
+
"packaging" and "setuptools" in our above example.
|
|
149
|
+
- We always retain the existing level of specificity. If your version
|
|
150
|
+
specifier is `~=1.2`, and the new version is `1.5.6`, we're going to
|
|
151
|
+
update your specifier to `~=1.5`. If your requirement has a minor version
|
|
152
|
+
level of specificity, and only a patch version upgrade is performed,
|
|
153
|
+
nothing will change in your project dependency specifier. This is why
|
|
154
|
+
you do not see any change in our above pyproject.toml file for the
|
|
155
|
+
`tomli-w` dependency—both new and old share the same minor version.
|
|
156
|
+
- If your requirement is unversioned, we don't touch it, of course. This is
|
|
157
|
+
why you didn't see any change for "pip".
|
|
158
|
+
|
|
159
|
+
You may refer to the [`dependence update` CLI reference](https://dependence.enorganic.org/cli.md#dependence-update)
|
|
160
|
+
and/or [`dependence.update` API reference](https://dependence.enorganic.org/api/update.md) for details
|
|
161
|
+
concerning this command/module, related options, and more complex use
|
|
162
|
+
cases/examples.
|