dependence 1.0.4__tar.gz → 1.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.
@@ -1,18 +1,18 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: dependence
3
- Version: 1.0.4
3
+ Version: 1.1.0
4
4
  Summary: A dependency management tool for python projects
5
5
  Project-URL: Documentation, https://dependence.enorganic.org
6
6
  Project-URL: Repository, https://github.com/enorganic/dependence
7
7
  Author-email: david@belais.me
8
- License: MIT
8
+ License-Expression: MIT
9
9
  Keywords: dependencies,requirements
10
- Requires-Python: ~=3.8
10
+ Requires-Python: ~=3.9
11
11
  Requires-Dist: jsonpointer
12
12
  Requires-Dist: packaging
13
13
  Requires-Dist: pip
14
14
  Requires-Dist: setuptools>63
15
- Requires-Dist: tomli-w~=1.0
15
+ Requires-Dist: tomli-w~=1.2
16
16
  Requires-Dist: tomli~=2.2
17
17
  Description-Content-Type: text/markdown
18
18
 
@@ -21,11 +21,11 @@ Description-Content-Type: text/markdown
21
21
  [![test](https://github.com/enorganic/dependence/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/enorganic/dependence/actions/workflows/test.yml)
22
22
  [![PyPI version](https://badge.fury.io/py/dependence.svg?icon=si%3Apython)](https://badge.fury.io/py/dependence)
23
23
 
24
- Dependence provides a Command Line Interface and library for aligning
25
- a python projects' declared dependencies with the package versions
26
- installed in the environment in which `dependence` is executed, and for
27
- "freezing" recursively resolved package dependencies (like `pip freeze`, but
28
- for a package, instead of the entire environment).
24
+ Dependence provides a Command Line Interface and library for performing
25
+ dependency upgrades on a python project, aligning declared dependencies with
26
+ the package versions installed in the environment in which `dependence` is
27
+ executed, and for "freezing" recursively resolved package dependencies
28
+ (like `pip freeze`, but for a package, instead of the entire environment).
29
29
 
30
30
  - [Documentation](https://enorganic.github.io/dependence/)
31
31
  - [Contributing](https://enorganic.github.io/dependence/contributing)
@@ -38,7 +38,72 @@ You can install `dependence` with pip:
38
38
  pip3 install dependence
39
39
  ```
40
40
 
41
- ## Example Usage
41
+ ## Usage
42
+
43
+ ### Upgrading Dependencies
44
+
45
+ The `dependence upgrade` command, and the `dependence.upgrade.upgrade`
46
+ function, discover and upgrade project and environment dependencies in the
47
+ environment in which dependence is installed to their latest version
48
+ aligned with project and dependency requirements, then selectively update
49
+ requirement specifiers in any specified TOML files (such as pyproject.toml),
50
+ setup.cfg file, requirements.txt files, or tox.ini files. Because
51
+ pyproject.toml files may contain dependencies for more than one environment,
52
+ such as when using [hatch](https://hatch.pypa.io/) environments,
53
+ [JSON-style pointers](https://datatracker.ietf.org/doc/html/rfc6901) are used
54
+ to include or exclude specific parts of TOML files.
55
+
56
+ For example, in [this project's Makefile
57
+ ](https://github.com/enorganic/dependence/blob/main/Makefile#L27), we define a
58
+ `make upgrade` target as follows:
59
+
60
+ ```Makefile
61
+ SHELL := bash
62
+ PYTHON_VERSION := 3.9
63
+
64
+ upgrade:
65
+ hatch run dependence upgrade\
66
+ --include-pointer /tool/hatch/envs/default\
67
+ --include-pointer /project\
68
+ pyproject.toml && \
69
+ hatch run docs:dependence upgrade\
70
+ --include-pointer /tool/hatch/envs/docs\
71
+ --include-pointer /project\
72
+ pyproject.toml && \
73
+ hatch run hatch-static-analysis:dependence upgrade\
74
+ --include-pointer /tool/hatch/envs/docs\
75
+ --include-pointer /project\
76
+ pyproject.toml && \
77
+ hatch run hatch-test.py$(PYTHON_VERSION):dependence upgrade\
78
+ --include-pointer /tool/hatch/envs/hatch-test\
79
+ --include-pointer /project\
80
+ pyproject.toml && \
81
+ make requirements
82
+ ```
83
+
84
+ You can reference the [associated pyproject.toml file for this project
85
+ ](https://github.com/enorganic/dependence/blob/main/pyproject.toml#L21)
86
+ for reference concerning the implications of `--include-pointer`, which
87
+ uses identical syntax to [JSON pointers
88
+ ](https://datatracker.ietf.org/doc/html/rfc6901). The `--exclude-pointer`
89
+ parameter works identically, but in reverse. If both `--include-pointer`
90
+ and `--exclude-pointer` are used, only sections which match both conditions
91
+ will be updated.
92
+
93
+ You may refer to the [`dependence upgrade` CLI reference](./cli.md#dependence-upgrade)
94
+ and/or [`dependence.upgrade` API reference](./api/upgrade.md) for details
95
+ concerning this command/module, related options, and more complex use case
96
+ examples.
97
+
98
+ The `dependence upgrade` command, and the `dependence.upgrade.upgrade`
99
+ function, are simply a composite of the dependency listing and update
100
+ functionalities covered below, but which a `pip install --upgrade`
101
+ command executed in between—so please read further for additional details.
102
+ All parameters are directly passed, with the exception of
103
+ `--ignore-update`/`ignore_update`, which is translated to the
104
+ `--ignore`/`ignore` parameter for
105
+ `dependence update`/`dependence.update.update` (renamed in this operation
106
+ for clarity of purpose).
42
107
 
43
108
  ### Listing Dependencies
44
109
 
@@ -48,8 +113,8 @@ requirements.txt, pyproject.toml, setup.cfg, or tox.ini files. The output
48
113
  format matches that of `pip freeze`, but only lists dependencies of indicated
49
114
  packages and/or editable project locations.
50
115
 
51
- You may refer to the [`dependence freeze` CLI reference](https://dependence.enorganic.org/cli/#dependence-freeze)
52
- and/or [`dependence.freeze` API reference](https://dependence.enorganic.org/api/freeze/) for details
116
+ You may refer to the [`dependence freeze` CLI reference](./cli.md#dependence-freeze)
117
+ and/or [`dependence.freeze` API reference](./api/freeze.md) for details
53
118
  concerning this command/module, related options, and more complex use case
54
119
  examples.
55
120
 
@@ -157,7 +222,7 @@ $ diff pyproject_before.toml pyproject_after.toml
157
222
  ```
158
223
 
159
224
  As you can see, only the version specifier for tomli changed. We know that
160
- every dependency was upgraded, wo why was only the `tomli` version specifier
225
+ every dependency was upgraded, so why was only the `tomli` version specifier
161
226
  updated? By design. Here are the rules `dependence update` adheres to:
162
227
 
163
228
  - We only update requirements versions when they have *inclusive* specifiers.
@@ -174,7 +239,7 @@ updated? By design. Here are the rules `dependence update` adheres to:
174
239
  - If your requirement is unversioned, we don't touch it, of course. This is
175
240
  why you didn't see any change for "pip".
176
241
 
177
- You may refer to the [`dependence update` CLI reference](https://dependence.enorganic.org/cli/#dependence-update)
178
- and/or [`dependence.update` API reference](https://dependence.enorganic.org/api/update/) for details
242
+ You may refer to the [`dependence update` CLI reference](./cli.md#dependence-update)
243
+ and/or [`dependence.update` API reference](./api/update.md) for details
179
244
  concerning this command/module, related options, and more complex use
180
245
  cases/examples.
@@ -3,11 +3,11 @@
3
3
  [![test](https://github.com/enorganic/dependence/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/enorganic/dependence/actions/workflows/test.yml)
4
4
  [![PyPI version](https://badge.fury.io/py/dependence.svg?icon=si%3Apython)](https://badge.fury.io/py/dependence)
5
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).
6
+ Dependence provides a Command Line Interface and library for performing
7
+ dependency upgrades on a python project, aligning declared dependencies with
8
+ the package versions installed in the environment in which `dependence` is
9
+ executed, and for "freezing" recursively resolved package dependencies
10
+ (like `pip freeze`, but for a package, instead of the entire environment).
11
11
 
12
12
  - [Documentation](https://enorganic.github.io/dependence/)
13
13
  - [Contributing](https://enorganic.github.io/dependence/contributing)
@@ -20,7 +20,72 @@ You can install `dependence` with pip:
20
20
  pip3 install dependence
21
21
  ```
22
22
 
23
- ## Example Usage
23
+ ## Usage
24
+
25
+ ### Upgrading Dependencies
26
+
27
+ The `dependence upgrade` command, and the `dependence.upgrade.upgrade`
28
+ function, discover and upgrade project and environment dependencies in the
29
+ environment in which dependence is installed to their latest version
30
+ aligned with project and dependency requirements, then selectively update
31
+ requirement specifiers in any specified TOML files (such as pyproject.toml),
32
+ setup.cfg file, requirements.txt files, or tox.ini files. Because
33
+ pyproject.toml files may contain dependencies for more than one environment,
34
+ such as when using [hatch](https://hatch.pypa.io/) environments,
35
+ [JSON-style pointers](https://datatracker.ietf.org/doc/html/rfc6901) are used
36
+ to include or exclude specific parts of TOML files.
37
+
38
+ For example, in [this project's Makefile
39
+ ](https://github.com/enorganic/dependence/blob/main/Makefile#L27), we define a
40
+ `make upgrade` target as follows:
41
+
42
+ ```Makefile
43
+ SHELL := bash
44
+ PYTHON_VERSION := 3.9
45
+
46
+ upgrade:
47
+ hatch run dependence upgrade\
48
+ --include-pointer /tool/hatch/envs/default\
49
+ --include-pointer /project\
50
+ pyproject.toml && \
51
+ hatch run docs:dependence upgrade\
52
+ --include-pointer /tool/hatch/envs/docs\
53
+ --include-pointer /project\
54
+ pyproject.toml && \
55
+ hatch run hatch-static-analysis:dependence upgrade\
56
+ --include-pointer /tool/hatch/envs/docs\
57
+ --include-pointer /project\
58
+ pyproject.toml && \
59
+ hatch run hatch-test.py$(PYTHON_VERSION):dependence upgrade\
60
+ --include-pointer /tool/hatch/envs/hatch-test\
61
+ --include-pointer /project\
62
+ pyproject.toml && \
63
+ make requirements
64
+ ```
65
+
66
+ You can reference the [associated pyproject.toml file for this project
67
+ ](https://github.com/enorganic/dependence/blob/main/pyproject.toml#L21)
68
+ for reference concerning the implications of `--include-pointer`, which
69
+ uses identical syntax to [JSON pointers
70
+ ](https://datatracker.ietf.org/doc/html/rfc6901). The `--exclude-pointer`
71
+ parameter works identically, but in reverse. If both `--include-pointer`
72
+ and `--exclude-pointer` are used, only sections which match both conditions
73
+ will be updated.
74
+
75
+ You may refer to the [`dependence upgrade` CLI reference](./cli.md#dependence-upgrade)
76
+ and/or [`dependence.upgrade` API reference](./api/upgrade.md) for details
77
+ concerning this command/module, related options, and more complex use case
78
+ examples.
79
+
80
+ The `dependence upgrade` command, and the `dependence.upgrade.upgrade`
81
+ function, are simply a composite of the dependency listing and update
82
+ functionalities covered below, but which a `pip install --upgrade`
83
+ command executed in between—so please read further for additional details.
84
+ All parameters are directly passed, with the exception of
85
+ `--ignore-update`/`ignore_update`, which is translated to the
86
+ `--ignore`/`ignore` parameter for
87
+ `dependence update`/`dependence.update.update` (renamed in this operation
88
+ for clarity of purpose).
24
89
 
25
90
  ### Listing Dependencies
26
91
 
@@ -30,8 +95,8 @@ requirements.txt, pyproject.toml, setup.cfg, or tox.ini files. The output
30
95
  format matches that of `pip freeze`, but only lists dependencies of indicated
31
96
  packages and/or editable project locations.
32
97
 
33
- You may refer to the [`dependence freeze` CLI reference](https://dependence.enorganic.org/cli/#dependence-freeze)
34
- and/or [`dependence.freeze` API reference](https://dependence.enorganic.org/api/freeze/) for details
98
+ You may refer to the [`dependence freeze` CLI reference](./cli.md#dependence-freeze)
99
+ and/or [`dependence.freeze` API reference](./api/freeze.md) for details
35
100
  concerning this command/module, related options, and more complex use case
36
101
  examples.
37
102
 
@@ -139,7 +204,7 @@ $ diff pyproject_before.toml pyproject_after.toml
139
204
  ```
140
205
 
141
206
  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
207
+ every dependency was upgraded, so why was only the `tomli` version specifier
143
208
  updated? By design. Here are the rules `dependence update` adheres to:
144
209
 
145
210
  - We only update requirements versions when they have *inclusive* specifiers.
@@ -156,7 +221,7 @@ updated? By design. Here are the rules `dependence update` adheres to:
156
221
  - If your requirement is unversioned, we don't touch it, of course. This is
157
222
  why you didn't see any change for "pip".
158
223
 
159
- You may refer to the [`dependence update` CLI reference](https://dependence.enorganic.org/cli/#dependence-update)
160
- and/or [`dependence.update` API reference](https://dependence.enorganic.org/api/update/) for details
224
+ You may refer to the [`dependence update` CLI reference](./cli.md#dependence-update)
225
+ and/or [`dependence.update` API reference](./api/update.md) for details
161
226
  concerning this command/module, related options, and more complex use
162
227
  cases/examples.
@@ -1,13 +1,16 @@
1
1
  import sys
2
2
  from importlib import import_module
3
- from types import ModuleType
3
+ from typing import TYPE_CHECKING
4
4
 
5
- from . import __name__ as _module_name
6
- from ._utilities import get_exception_text
5
+ if TYPE_CHECKING:
6
+ from types import ModuleType
7
+
8
+ from dependence import __name__ as _module_name
9
+ from dependence._utilities import get_exception_text
7
10
 
8
11
 
9
12
  def _print_help() -> None:
10
- print(
13
+ print( # noqa: T201
11
14
  "Usage:\n"
12
15
  " dependence <command> [options]\n\n"
13
16
  "Commands:\n"
@@ -20,7 +23,10 @@ def _print_help() -> None:
20
23
  "installed\n"
21
24
  " distribution or project, in a similar "
22
25
  "format\n"
23
- " to the output of `pip freeze`."
26
+ " to the output of `pip freeze`.\n"
27
+ " upgrade Upgrade all dependencies and align "
28
+ "project\n"
29
+ " requirement specifiers to match."
24
30
  )
25
31
 
26
32
 
@@ -47,7 +53,7 @@ def main() -> None:
47
53
  module = import_module(f"{_module_name}.{command}")
48
54
  module.main() # type: ignore
49
55
  except ImportError:
50
- print(get_exception_text())
56
+ print(get_exception_text()) # noqa: T201
51
57
  _print_help()
52
58
 
53
59