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
Fix install_requires following PEP-508 #3114
Conversation
pipenv can not support code-based deps list Please see pypa/pipenv#2473 for details.
Codecov Report
@@ Coverage Diff @@
## master #3114 +/- ##
=======================================
Coverage 98.06% 98.06%
=======================================
Files 43 43
Lines 7837 7837
Branches 1354 1354
=======================================
Hits 7685 7685
Misses 56 56
Partials 96 96 Continue to review full report at Codecov.
|
Another related issue: #2703. The approach used here is considered the best way currently available to specify environment-specific requirements. Both the Python-based (currently in use) and |
setup.py
Outdated
'multidict>=4.0,<5.0', | ||
'async_timeout>=3.0,<4.0', | ||
'yarl>=1.0,<2.0', | ||
'idna-ssl>=1.0;python_version<"3.7"', |
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.
AFAIR pip (setuptools?) doesn't support this kind of notation in install_requires
(at least in certain range of versions).
I'd say it's better to go for extras-based syntax:
extra_requires = {
':python_version<"3.7"': [
'idna-ssl>=1.0',
],
}
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.
Is there any way to test this? There have been quite a few improvements in this area in pip v10.x, and support for PEP 508 came up more than once.
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.
@webknjaz it does today. And at least bundled pip for 3.5 support that. For older I think we shouldn't care.
In anyway, rule of thumb is: before install anything in new virtualenv, upgrade pip and setuptools first.
@uranusjr while it might be not recommended we target a wider range of envs and extras-based notation is better in this case. I'll need to check feature-support first. |
@webknjaz Unfortunately If Setuptools compatibility is an issue, Pytest’s approach may be more appropriate: I would also like to mention that I have not seen any real-life reports on Setuptools support on |
@uranusjr I only saw the warning at the bottom of this wheel documentation section but I don't know if it is still valid. |
@Victor-Savu The warning only applies for Update: There is a table in the middle of the PEP document listing available markers. All of them except |
I'm +1 this patch. While I share @webknjaz concerns about old setuptools/pip, today that shouldn't be a problem and, in general, I think we shouldn't let them slow down us, because users may easily upgrade them at any moment for free. -1 for extras - that's not right solution, because:
|
I changed code. please review again. |
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.
This iteration requires some additional work, but, honestly, we don't have to:
- Copy code from third-party project and deal with licenses;
- Have such wide/universal setuptools support - modern ones are enough and their upgrade is not a big deal for users.
- Complicated setup.py means complicated support of it. I think we shouldn't add additional rare cases by our own unless there would be bug reports about.
setup.py
Outdated
* https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-platform-specific-dependencies | ||
""" | ||
try: | ||
version = pkg_resources.parse_version(setuptools.__version__) |
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.
You forgot the import
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 will fix it
setup.py
Outdated
version = pkg_resources.parse_version(setuptools.__version__) | ||
if version >= pkg_resources.parse_version("36.2.2"): | ||
return 2 | ||
if version >= pkg_resources.parse_version("0.7.2"): |
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.
Should we care about such old versions? I think we shouldn't.
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.
OK
setup.py
Outdated
install_requires.append('idna-ssl>=1.0') | ||
def get_environment_marker_support_level(): | ||
""" | ||
Copied from https://github.com/pytest-dev/pytest/blob/master/setup.py |
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.
If you copy code from third party project, you need to add this reference to NOTICE file as ASF license stands for.
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 will drop this copied code
setup.py
Outdated
|
||
if sys.version_info < (3, 7): | ||
install_requires.append('idna-ssl>=1.0') | ||
if setuptools_version >= (36, 2, 2): |
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.
environment markers are supported since 20.5 version, but really get worked since 21.0. No need to require such high setuptools version.
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.
Also, version 21.0 released two years ago. Once again, do we need any checks against setuptools version at all? Unlikely any sane user will install latest aiohttp having legacy package management toolset.
setup.py
Outdated
'async_timeout>=3.0,<4.0', | ||
'yarl>=1.0,<2.0', | ||
] | ||
extras_require = {} |
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.
extras seems to be unused.
@kxepal I think checking setupools version is useless and I want to reset --hard to first commit. but someone commented setuptools versioni issue. I want to hear opinion of member of aiohttp |
@webknjaz |
Dropping setuptools version check is ok for me: env markers support is pretty old. |
Alright, I'm okay with that. It's just me having a habit to target maximum compatibility :) |
Since we chose to not care about compatibility with ancient setuptools.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
What do these changes do?
pipenv can not support code-based deps list.
this PR change install requires list following PEP-508
Please see pypa/pipenv#2473 for details.
Are there changes in behavior for the user?
no, there is only change to installation
Related issue number
pypa/pipenv#2473
Checklist
Please help me to check below. I do not check it myself
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.