Name | dependence JSON |
Version |
1.0.4
JSON |
| download |
home_page | None |
Summary | A dependency management tool for python projects |
upload_time | 2024-12-09 21:15:36 |
maintainer | None |
docs_url | None |
author | None |
requires_python | ~=3.8 |
license | MIT |
keywords |
dependencies
requirements
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# dependence
[![test](https://github.com/enorganic/dependence/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/enorganic/dependence/actions/workflows/test.yml)
[![PyPI version](https://badge.fury.io/py/dependence.svg?icon=si%3Apython)](https://badge.fury.io/py/dependence)
Dependence provides a Command Line Interface and library for aligning
a python projects' declared dependencies with the package versions
installed in the environment in which `dependence` is executed, and for
"freezing" recursively resolved package dependencies (like `pip freeze`, but
for a package, instead of the entire environment).
- [Documentation](https://enorganic.github.io/dependence/)
- [Contributing](https://enorganic.github.io/dependence/contributing)
## Installation
You can install `dependence` with pip:
```shell
pip3 install dependence
```
## Example Usage
### Listing Dependencies
The `dependence freeze` command, and the `dependence.freeze.freeze` function,
print all requirements for one or more specified python project,
requirements.txt, pyproject.toml, setup.cfg, or tox.ini files. The output
format matches that of `pip freeze`, but only lists dependencies of indicated
packages and/or editable project locations.
You may refer to the [`dependence freeze` CLI reference](https://dependence.enorganic.org/cli/#dependence-freeze)
and/or [`dependence.freeze` API reference](https://dependence.enorganic.org/api/freeze/) for details
concerning this command/module, related options, and more complex use case
examples.
We'll use this project, `dependence`, as a simple example. To start with, let's
see what the currently installed dependencies for this package look like
at the time of writing:
```console
$ dependence freeze .
packaging==24.1
pip==24.3.0
setuptools==75.1.0
tomli==2.1.0
tomli_w==1.0.0
```
...now let's save this output for later comparison purposes:
```bash
dependence freeze . > requirements_before.txt
```
Now, we'll upgrade our dependencies and see what they look like after:
```console
$ pip install -q --upgrade --upgrade-strategy eager . && dependence freeze .
packaging==24.2
pip==24.3.1
setuptools==75.3.0
tomli==2.2.1
tomli_w==1.0.0
```
...next let's dump them to a file and compare them with our previous
dependencies:
```console
$ dependence freeze . > dependence_after.txt
$ diff dependence_before.txt dependence_after.txt
1,5c1,5
< packaging==24.1
< pip==24.3.0
< setuptools==75.1.0
< tomli==2.1.0
< tomli_w==1.0.0
---
> packaging==24.2
> pip==24.3.1
> setuptools==75.3.0
> tomli==2.2.1
> tomli_w==1.0.1
```
As you can see above, *all* of our dependencies have been upgraded.
### Updating Requirement Specifiers
To start with, let's take a look at our pyproject.toml file:
```toml
[project]
name = "dependence"
version = "1.0.0"
dependencies = [
"packaging>23",
"pip",
"setuptools>63",
"tomli-w~=1.0",
"tomli~=2.1",
]
```
Now that we've upgraded our dependencies, we want to update our
pyproject.toml file to align with our upgraded dependencies. This is desirable
to ensure that `dependence` isn't installed alongside a version of one of its
dependencies preceding functionality utilized by `dependence`.
```bash
dependence update pyproject.toml
```
Afterwards, our pyproject.toml file looks like this:
```toml
[project]
name = "dependence"
version = "1.0.0"
dependencies = [
"packaging>23",
"pip",
"setuptools>63",
"tomli-w~=1.0",
"tomli~=2.2",
]
```
Here's the diff:
```console
$ diff pyproject_before.toml pyproject_after.toml
9c9
< "tomli~=2.1",
---
> "tomli~=2.2",
```
As you can see, only the version specifier for tomli changed. We know that
every dependency was upgraded, wo why was only the `tomli` version specifier
updated? By design. Here are the rules `dependence update` adheres to:
- We only update requirements versions when they have *inclusive* specifiers.
For example, `~=`, `>=`, and `<=` are inclusive, whereas `!=`, `>`, and
`<` are *exclusive*. For this reason, nothing changed for
"packaging" and "setuptools" in our above example.
- We always retain the existing level of specificity. If your version
specifier is `~=1.2`, and the new version is `1.5.6`, we're going to
update your specifier to `~=1.5`. If your requirement has a minor version
level of specificity, and only a patch version upgrade is performed,
nothing will change in your project dependency specifier. This is why
you do not see any change in our above pyproject.toml file for the
`tomli-w` dependency—both new and old share the same minor version.
- If your requirement is unversioned, we don't touch it, of course. This is
why you didn't see any change for "pip".
You may refer to the [`dependence update` CLI reference](https://dependence.enorganic.org/cli/#dependence-update)
and/or [`dependence.update` API reference](https://dependence.enorganic.org/api/update/) for details
concerning this command/module, related options, and more complex use
cases/examples.
Raw data
{
"_id": null,
"home_page": null,
"name": "dependence",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": "dependencies, requirements",
"author": null,
"author_email": "david@belais.me",
"download_url": "https://files.pythonhosted.org/packages/8b/99/814bfd1fc09c392197b90dc6422895f8a592b90b3467f9628cfe66e9c306/dependence-1.0.4.tar.gz",
"platform": null,
"description": "# dependence\n\n[![test](https://github.com/enorganic/dependence/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/enorganic/dependence/actions/workflows/test.yml)\n[![PyPI version](https://badge.fury.io/py/dependence.svg?icon=si%3Apython)](https://badge.fury.io/py/dependence)\n\nDependence provides a Command Line Interface and library for aligning\na python projects' declared dependencies with the package versions\ninstalled in the environment in which `dependence` is executed, and for\n\"freezing\" recursively resolved package dependencies (like `pip freeze`, but\nfor a package, instead of the entire environment).\n\n- [Documentation](https://enorganic.github.io/dependence/)\n- [Contributing](https://enorganic.github.io/dependence/contributing)\n\n## Installation\n\nYou can install `dependence` with pip:\n\n```shell\npip3 install dependence\n```\n\n## Example Usage\n\n### Listing Dependencies\n\nThe `dependence freeze` command, and the `dependence.freeze.freeze` function,\nprint all requirements for one or more specified python project,\nrequirements.txt, pyproject.toml, setup.cfg, or tox.ini files. The output\nformat matches that of `pip freeze`, but only lists dependencies of indicated\npackages and/or editable project locations.\n\nYou may refer to the [`dependence freeze` CLI reference](https://dependence.enorganic.org/cli/#dependence-freeze)\nand/or [`dependence.freeze` API reference](https://dependence.enorganic.org/api/freeze/) for details\nconcerning this command/module, related options, and more complex use case\nexamples.\n\nWe'll use this project, `dependence`, as a simple example. To start with, let's\nsee what the currently installed dependencies for this package look like\nat the time of writing:\n\n```console\n$ dependence freeze .\npackaging==24.1\npip==24.3.0\nsetuptools==75.1.0\ntomli==2.1.0\ntomli_w==1.0.0\n```\n\n...now let's save this output for later comparison purposes:\n\n```bash\ndependence freeze . > requirements_before.txt\n```\n\nNow, we'll upgrade our dependencies and see what they look like after:\n\n```console\n$ pip install -q --upgrade --upgrade-strategy eager . && dependence freeze .\npackaging==24.2\npip==24.3.1\nsetuptools==75.3.0\ntomli==2.2.1\ntomli_w==1.0.0\n```\n\n...next let's dump them to a file and compare them with our previous\ndependencies:\n\n```console\n$ dependence freeze . > dependence_after.txt\n$ diff dependence_before.txt dependence_after.txt\n1,5c1,5\n< packaging==24.1\n< pip==24.3.0\n< setuptools==75.1.0\n< tomli==2.1.0\n< tomli_w==1.0.0\n---\n> packaging==24.2\n> pip==24.3.1\n> setuptools==75.3.0\n> tomli==2.2.1\n> tomli_w==1.0.1\n```\n\nAs you can see above, *all* of our dependencies have been upgraded.\n\n### Updating Requirement Specifiers\n\nTo start with, let's take a look at our pyproject.toml file:\n\n```toml\n[project]\nname = \"dependence\"\nversion = \"1.0.0\"\ndependencies = [\n \"packaging>23\",\n \"pip\",\n \"setuptools>63\",\n \"tomli-w~=1.0\",\n \"tomli~=2.1\",\n]\n```\n\nNow that we've upgraded our dependencies, we want to update our\npyproject.toml file to align with our upgraded dependencies. This is desirable\nto ensure that `dependence` isn't installed alongside a version of one of its\ndependencies preceding functionality utilized by `dependence`.\n\n```bash\ndependence update pyproject.toml\n```\n\nAfterwards, our pyproject.toml file looks like this:\n\n```toml\n[project]\nname = \"dependence\"\nversion = \"1.0.0\"\ndependencies = [\n \"packaging>23\",\n \"pip\",\n \"setuptools>63\",\n \"tomli-w~=1.0\",\n \"tomli~=2.2\",\n]\n```\n\nHere's the diff:\n\n```console\n$ diff pyproject_before.toml pyproject_after.toml\n9c9\n< \"tomli~=2.1\",\n---\n> \"tomli~=2.2\",\n```\n\nAs you can see, only the version specifier for tomli changed. We know that\nevery dependency was upgraded, wo why was only the `tomli` version specifier\nupdated? By design. Here are the rules `dependence update` adheres to:\n\n- We only update requirements versions when they have *inclusive* specifiers.\n For example, `~=`, `>=`, and `<=` are inclusive, whereas `!=`, `>`, and\n `<` are *exclusive*. For this reason, nothing changed for\n \"packaging\" and \"setuptools\" in our above example.\n- We always retain the existing level of specificity. If your version\n specifier is `~=1.2`, and the new version is `1.5.6`, we're going to\n update your specifier to `~=1.5`. If your requirement has a minor version\n level of specificity, and only a patch version upgrade is performed,\n nothing will change in your project dependency specifier. This is why\n you do not see any change in our above pyproject.toml file for the\n `tomli-w` dependency\u2014both new and old share the same minor version.\n- If your requirement is unversioned, we don't touch it, of course. This is\n why you didn't see any change for \"pip\".\n\nYou may refer to the [`dependence update` CLI reference](https://dependence.enorganic.org/cli/#dependence-update)\nand/or [`dependence.update` API reference](https://dependence.enorganic.org/api/update/) for details\nconcerning this command/module, related options, and more complex use\ncases/examples.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A dependency management tool for python projects",
"version": "1.0.4",
"project_urls": {
"Documentation": "https://dependence.enorganic.org",
"Repository": "https://github.com/enorganic/dependence"
},
"split_keywords": [
"dependencies",
" requirements"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9a017b04b716c45fb029c44da94d9aa36c1734118a9b6cf739555aa4e2aa972e",
"md5": "e76f8b620bddc48e84cb6e1ad9107442",
"sha256": "220e8fe3e2a5a3560298c268f515cb8ca7fca5c440faae9462e7fa10491ecca4"
},
"downloads": -1,
"filename": "dependence-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e76f8b620bddc48e84cb6e1ad9107442",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 19636,
"upload_time": "2024-12-09T21:15:35",
"upload_time_iso_8601": "2024-12-09T21:15:35.544689Z",
"url": "https://files.pythonhosted.org/packages/9a/01/7b04b716c45fb029c44da94d9aa36c1734118a9b6cf739555aa4e2aa972e/dependence-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8b99814bfd1fc09c392197b90dc6422895f8a592b90b3467f9628cfe66e9c306",
"md5": "122ac003a5399f6a5ac86d0a19001cdc",
"sha256": "12c88e694e285b74083da7644bdc0a7a783342c241ade8f6bc7e410612452571"
},
"downloads": -1,
"filename": "dependence-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "122ac003a5399f6a5ac86d0a19001cdc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 17188,
"upload_time": "2024-12-09T21:15:36",
"upload_time_iso_8601": "2024-12-09T21:15:36.635194Z",
"url": "https://files.pythonhosted.org/packages/8b/99/814bfd1fc09c392197b90dc6422895f8a592b90b3467f9628cfe66e9c306/dependence-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 21:15:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "enorganic",
"github_project": "dependence",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"test_requirements": [
{
"name": "jsonpointer",
"specs": [
[
"==",
"3.0.0"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.2"
]
]
},
{
"name": "setuptools",
"specs": [
[
"==",
"75.3.0"
]
]
},
{
"name": "tomli",
"specs": [
[
"==",
"2.2.1"
]
]
},
{
"name": "tomli_w",
"specs": [
[
"==",
"1.0.0"
]
]
}
],
"lcname": "dependence"
}