| Name | realreq JSON |
| Version |
0.7.4
JSON |
| download |
| home_page | https://github.com/Calder-Ty/realreq |
| Summary | CLI tool to gather dependencies for imports actually used by your code |
| upload_time | 2023-08-24 14:24:54 |
| maintainer | |
| docs_url | None |
| author | Tyler Calder |
| requires_python | >=3.6 |
| license | |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# realreq: real requirements for real projects
  [](https://pypi.python.org/pypi/realreq/)
`realreq` is _the_ lightweight tool that provides you with the actual
dependencies used by your project.
## Why use realreq?
### Better dependency management
It is not a secret that python package management is not easy.
Separating package dependencies from tool dependencies is enough to make you pull
your hair out. Determining what packages are actual being used by your code, and
what their dependencies are is a hassle. `realreq` fixes this for you by
examining your source files and parsing out the dependencies for you.
### Lightweight
`realreq` does not depend on any third party package, except for `pip`. It
does not make any assumptions about the presence or absence of a virtual
environment, or what tool you used to make your virtual environment. This
means it will work with whatever tool set you are already using, without
getting in the way of your workflow
## Install
`realreq` is available for install via pip.
`pip install realreq`
## Usage
### Shallow Dependencies
By default realreq delivers a "shallow" dependency specification, giving you a list of the packages
directly used by your code:
```
realreq -s ./path/to/mypackage > requirements.txt
```
This is useful for Library maintainers who want to make sure the minimal essentials are there,
without over specifying the actual requirements for their library.
### Deep Dependencies
Alternatively, you can get a "deep" dependency list by using the `-d` flag
```
realreq -d -s ./path/to/mypackage > requirements.txt
```
This is beneficial for maintaining executable/standalone programs, by defining the exact requirements under which
the program will function.
### Adding aliases
Due to the way python packaging works, it is possible for a python package to have a different _install_
name than _import_ name. Realreq works by inspecting your _imports_ and then checking the versions
they were installed with. If the names mismatch, there will be an issue with realreq being unable to
find them.
This can be resolved by adding an `--alias`/`-a` flag, mapping the _import_ name to the _install_ name.
```
realreq -d -s ./path/to/mypackage -a bs4=beautifulsoup4 > requirements.txt
```
If you have a lot of these aliases you can also specify them in an alias-file:
```
cat << EOF > realreq-aliases.txt
bs4=beautifulsoup4
airflow=apache-airflow
dateutil=python-dateutil
EOF
realreq -d -s ./path/to/mypackage --alias-file realreq-aliases.txt > requirements.txt
```
## Additional tools
### Inverted Tree
Sometimes you may want to explore the reasons for certain dependencies. Realreq lets you see an
inverted tree view that displays all your dependencies and what libraries they are used by. For
example the inverted tree for realreq's test suite looks like this:
```
- attrs
|- pytest
|- pytest-mock
- iniconfig
|- pytest
|- pytest-mock
- pluggy
|- pytest
|- pytest-mock
- py
|- pytest
|- pytest-mock
- pyparsing
|- packaging
|- pytest
|- pytest-mock
- tomli
|- pytest
|- pytest-mock
```
Currently realreq does not support a regular tree view, though that feature is one that I want to
implement in the future.
Raw data
{
"_id": null,
"home_page": "https://github.com/Calder-Ty/realreq",
"name": "realreq",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Tyler Calder",
"author_email": "calder-ty@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/02/b6/223e689e37fbc750b53f663855070660a6b432430dd3f429e385b0287ab3/realreq-0.7.4.tar.gz",
"platform": null,
"description": "# realreq: real requirements for real projects\n\n  [](https://pypi.python.org/pypi/realreq/)\n\n`realreq` is _the_ lightweight tool that provides you with the actual\ndependencies used by your project.\n\n## Why use realreq?\n\n### Better dependency management\n\nIt is not a secret that python package management is not easy.\nSeparating package dependencies from tool dependencies is enough to make you pull\nyour hair out. Determining what packages are actual being used by your code, and\nwhat their dependencies are is a hassle. `realreq` fixes this for you by\nexamining your source files and parsing out the dependencies for you.\n\n### Lightweight\n\n`realreq` does not depend on any third party package, except for `pip`. It\ndoes not make any assumptions about the presence or absence of a virtual\nenvironment, or what tool you used to make your virtual environment. This\nmeans it will work with whatever tool set you are already using, without\ngetting in the way of your workflow\n\n## Install\n\n`realreq` is available for install via pip.\n\n`pip install realreq`\n\n## Usage\n\n### Shallow Dependencies\nBy default realreq delivers a \"shallow\" dependency specification, giving you a list of the packages\ndirectly used by your code:\n\n```\nrealreq -s ./path/to/mypackage > requirements.txt\n```\n\nThis is useful for Library maintainers who want to make sure the minimal essentials are there,\nwithout over specifying the actual requirements for their library.\n\n### Deep Dependencies\nAlternatively, you can get a \"deep\" dependency list by using the `-d` flag\n\n```\nrealreq -d -s ./path/to/mypackage > requirements.txt\n```\n\nThis is beneficial for maintaining executable/standalone programs, by defining the exact requirements under which\nthe program will function.\n\n### Adding aliases\n\nDue to the way python packaging works, it is possible for a python package to have a different _install_\nname than _import_ name. Realreq works by inspecting your _imports_ and then checking the versions\nthey were installed with. If the names mismatch, there will be an issue with realreq being unable to\nfind them.\n\nThis can be resolved by adding an `--alias`/`-a` flag, mapping the _import_ name to the _install_ name.\n\n\n```\nrealreq -d -s ./path/to/mypackage -a bs4=beautifulsoup4 > requirements.txt\n```\n\nIf you have a lot of these aliases you can also specify them in an alias-file:\n\n```\ncat << EOF > realreq-aliases.txt\nbs4=beautifulsoup4\nairflow=apache-airflow\ndateutil=python-dateutil\nEOF\nrealreq -d -s ./path/to/mypackage --alias-file realreq-aliases.txt > requirements.txt\n```\n\n## Additional tools\n\n### Inverted Tree\n\nSometimes you may want to explore the reasons for certain dependencies. Realreq lets you see an\ninverted tree view that displays all your dependencies and what libraries they are used by. For\nexample the inverted tree for realreq's test suite looks like this:\n\n```\n- attrs\n |- pytest\n |- pytest-mock\n- iniconfig\n |- pytest\n |- pytest-mock\n- pluggy\n |- pytest\n |- pytest-mock\n- py\n |- pytest\n |- pytest-mock\n- pyparsing\n |- packaging\n |- pytest\n |- pytest-mock\n- tomli\n |- pytest\n |- pytest-mock\n```\n\nCurrently realreq does not support a regular tree view, though that feature is one that I want to\nimplement in the future.\n",
"bugtrack_url": null,
"license": "",
"summary": "CLI tool to gather dependencies for imports actually used by your code",
"version": "0.7.4",
"project_urls": {
"Homepage": "https://github.com/Calder-Ty/realreq"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2d590c13ec9a065ba254aad6e3e5efd4d158efa5477cbe4b96f36ca884e2bc6f",
"md5": "81665b5ce6cdb73c575c64c09db07b92",
"sha256": "58fd9c3262aecac9136f99f326029084e57d1b99d4b7e37185639e8657b3519d"
},
"downloads": -1,
"filename": "realreq-0.7.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81665b5ce6cdb73c575c64c09db07b92",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 10625,
"upload_time": "2023-08-24T14:24:52",
"upload_time_iso_8601": "2023-08-24T14:24:52.414207Z",
"url": "https://files.pythonhosted.org/packages/2d/59/0c13ec9a065ba254aad6e3e5efd4d158efa5477cbe4b96f36ca884e2bc6f/realreq-0.7.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "02b6223e689e37fbc750b53f663855070660a6b432430dd3f429e385b0287ab3",
"md5": "98a2be20afbe6bfd2ad14b734662b294",
"sha256": "48c77e24f99f1fc550f74eb92f7c1ea28f29a7e1f387ae8b94d1b758cb283955"
},
"downloads": -1,
"filename": "realreq-0.7.4.tar.gz",
"has_sig": false,
"md5_digest": "98a2be20afbe6bfd2ad14b734662b294",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 13228,
"upload_time": "2023-08-24T14:24:54",
"upload_time_iso_8601": "2023-08-24T14:24:54.034639Z",
"url": "https://files.pythonhosted.org/packages/02/b6/223e689e37fbc750b53f663855070660a6b432430dd3f429e385b0287ab3/realreq-0.7.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-24 14:24:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Calder-Ty",
"github_project": "realreq",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "realreq"
}