Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 'file:' for tests_require and install_require in setup.cfg #1074

Closed
althonos opened this issue Jun 29, 2017 · 4 comments
Closed

Allow 'file:' for tests_require and install_require in setup.cfg #1074

althonos opened this issue Jun 29, 2017 · 4 comments
Labels

Comments

@althonos
Copy link

Hi !

Most of the people use a requirements.txt file for managing their dependencies. Unfortunately, setuptools does not support reading from those files for the requirements tags, which means that devs have to either duplicate their requirements file in the install_requires parameter, or not use a requirement file at all. Since setuptools already supports reading some metadata from a file, it should probably be allowed to read those parameters as well.

@jaraco
Copy link
Member

jaraco commented Oct 14, 2017

What should happen if the requirements.txt includes syntax other than simple lists of requirements (perhaps with environment markers)? Presumably comments could be ignored, but what about options to pip like -i or -e?

Already, the guidance by the python packaging user's guide describes the distinct purposes intended for requirements.txt versus 'install_requires' and similar. By referencing a requirements.txt file for a package's declared minimum required versions, it violates some of the goals of a requirements.txt (showing pinned versions for an environment).

How do we reconcile these challenges?

@techtonik
Copy link
Contributor

Write user stories? I'd just paste requirements spec into setup.py as is.

@jaraco
Copy link
Member

jaraco commented Nov 14, 2017

I don't see a viable proposal here.

@jianlins
Copy link

Put this function in setup.py will do the job:
def parse_requirements(requirements_file):
requirements=open(os.path.join(os.path.dirname(file), requirements_file)).read().split('\n')
requirements=[r.strip() for r in requirements]
requirements=[r for r in requirements if len(r)>0 and not r.startswith('#')]
return requirements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants