API to parse requirements.txt for setup.py
See original GitHub issuerequirements.txt
could a convenient single declarative point for specifying dependencies if it could be pasted into setup.py
install_requires
as-is. But requirements.txt
contains comments and references to other requirements files, which seem to be incompatible with install_requires
(reference needed).
It would be nice to have official API that parses requirements.txt
file into a list suitable for install_requires
section.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:29
- Comments:21 (14 by maintainers)
Top Results From Across the Web
Reference requirements.txt for the install_requires kwarg in ...
It is possible to parse a relatively simple requirements.txt file from a setuptools setup.py script without pip. The setuptools project already contains ...
Read more >requirements-parser - PyPI
This is a small Python module for parsing Pip requirement files. The goal is to parse everything in the Pip requirement file format...
Read more >requirements.txt vs setup.py in Python - Towards Data Science
The requirements.txt is a file listing all the dependencies for a specific Python project. It may also contain dependencies of dependencies, as discussed ......
Read more >Welcome to Requirements Parser's documentation ...
Requirements parser is a Python module for parsing Pip requirement files. Requirements parser is (now) Apache 2.0 licensed. Quickstart: import requirements ...
Read more >[Distutils] Parsing requirements, pip has no API ...
You're better off putting it > directly in setup.py and using setup.py to install dependencies in a > virtualenv instead of requirements.txt ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
requirements.txt supports this, setup.py does not:
git+https://github.com/user/repo.git@master#egg=loggable
.setup.py gives an error like this:
error in setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Invalid requirement, parse error at "'+https:/'"
stuff like this this is still a valid question and a confusing issue years and years later.
this api should exist and maybe parse requirements.txt to return a dictionary of
{"dependency_links": [...], "install_requires": [....]}
which is suitable to use like this:setup(<other_setup_keywords>, **parse_requirements('requirements.txt'))
There’s also no support for environment markers in
install_requires
requirements (e.g.python-xlib==0.19; "linux" in sys_platform
will not work), something that is handled byextras_require
.Note that
install_requires
can just be a multi-lines string, so if you stick to a subset of pip’s requirements format that is supported by setuptools, you should be able to use something as simple as:in your
setup.py
.Also looks like a duplicate of #1074.