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
Use dedicated requirements.txt for contrib.python.checks.checker
#7982
Use dedicated requirements.txt for contrib.python.checks.checker
#7982
Conversation
Running this results in the below error:
@jsirois does this overall approach look right? |
contrib.python.checks.checker
contrib.python.checks.checker
Never mind, got it working :) Was missing an entry in |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
python_requirements() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all these deps are used in just one place, together, you could forgo the requirements.txt and the separate targets per requirement, and just have
python_requirement_library(
requirements = [
python_requirement('six>=1.9.0,<2')
python_requirement('pycodestyle==2.4.0'),
python_requirement('pyflakes==2.0.0'),
]
)
Then you can depend on all of them at once by depending on
contrib/python/src/python/pants/contrib/python/checks/checker/3rdparty
Which would be more succinct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to use this approach, but the downside is that virtual_env
and release.sh
won't know to install / build wheels for those 3 dependencies, which we need them to do.
Problem
contrib.python.checks.checker
must keep support for Python 2, e.g. usingsix
, which we will soon drop from the rest of the codebase.Likewise, the module uses
pycodestyle
andpyflakes
, neither of which are used anywhere else in the project.We would like a way to provide requirements for specifically this module and to not pollute the rest of the project in doing so.
Solution
Introduce a dedicated
3rdparty/requirements.txt
for the module, per https://www.pantsbuild.org/3rdparty_py.html#3rdpartypython.We also indicate
pants_venv
should install these dependencies locally andrelease.sh
should build 3rd party wheels for this so that the released PEX continues to work for the contrib package.