-
Notifications
You must be signed in to change notification settings - Fork 131
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 specific version of python for requirements #348
Conversation
5cdbe0e
to
7ec4414
Compare
7ec4414
to
9ffc7a4
Compare
Cool, thanks. Let's update the. |
I tried something that can help. But as travis does not use tox, I can't see anything change. |
11382a9
to
084c6cf
Compare
What you did is basically what I had in mind. |
.travis.yml
Outdated
@@ -11,7 +11,7 @@ python: | |||
- '3.4' | |||
- '3.5' | |||
install: | |||
- travis_retry pip install -r requirements-${TRAVIS_PYTHON_VERSION}.txt --allow-external | |||
- travis_retry pip install -e . | |||
argparse |
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 think argparse is the argument for --allow-external option so should delete both or neither.
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.
thanks a lot.
da76adc
to
62d282e
Compare
Looking at the travis logs for this pr vs others, it seems like the installation is already happening, that these statements are just for requirements, so maybe try deleting that After this, tox integration is definitely the next step. If you want to play around with travis config, feel free to open few dummy PRs to kick off builds. |
62d282e
to
78d6601
Compare
For now, I just deal with travis. Your first comment just made me realize tox was not yet in there so my changes were not tested. The next run should pass. |
78d6601
to
0197c7a
Compare
Looks like it's passing :-) Any reason you're installing in dev mode? |
It's just an habit. If you want me to remove that, I can. |
Yeah, now that it's passing, I'd like to make the code maybe a tiny bit more readable. Don't have time right this moment, but I'll take a look and give more specific comments w/in 24-48hrs. |
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.
Thanks for working on this!
.travis.yml
Outdated
@@ -11,8 +11,7 @@ python: | |||
- '3.4' | |||
- '3.5' | |||
install: | |||
- travis_retry pip install -r requirements-${TRAVIS_PYTHON_VERSION}.txt --allow-external | |||
argparse | |||
- travis_retry pip install -e . |
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.
Yeah, should probably not test in dev mode.
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.
fixed.
setup.py
Outdated
REQS.update(list(filter(lambda s: s and not s.startswith('#'), requirements_file.readlines()))) | ||
with open(os.path.join(directory, 'requirements.txt')) as requirements_file: | ||
REQS.update(list(filter(lambda s: s and not s.startswith('#'), requirements_file.readlines()))) | ||
print(REQS) |
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 this a debugging message?
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.
Yes, removed, sorry.
setup.py
Outdated
|
||
def _get_specific_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.
This function should probably take version as input and return a list of requirements instead using and setting variables outside of its scope.
Also would be nice to have a docstring, even a oneliner.
setup.py
Outdated
version_specific_requirements_path = 'requirements-3.5.txt' | ||
else: | ||
version_specific_requirements_path = 'requirements-2.7.txt' | ||
with open(os.path.join(directory, version_specific_requirements_path)) as requirements_file: |
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.
Maybe use pip.req
?
http://jelly.codes/articles/python-pip-module/
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.
Otherwise, this should at least be a function to avoid duplicate code.
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.
Yes, I will deduplicate. Thanks for pip.req, I didn't know it :)
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.
in fact pip.req
seems not to be a good idea : https://stackoverflow.com/questions/14399534/reference-requirements-txt-for-the-install-requires-kwarg-in-setuptools-setup-py :
You really don't want to do this. Speaking as a pip maintainer pip does not support being called as an API like this at all. In fact pip 1.6 (next version at this time) moves this function. – Donald Stufft Mar 26 '14 at 0:59
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 are correct.
but :-( would be nice if they supported this
setup.py
Outdated
|
||
def _get_specific_requirements(): | ||
directory = dirname(__file__) | ||
version_specific_requirements_path = 'requirements-{}.{}.txt'.format(py_version.major, py_version.minor) |
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 it possible to make these nested if statements into just one if...elif...elif...else ?
Or maybe something like.
if is_pypy:
pypy_name = "pypy"
else:
pypy_name = ""
version_specific_requirements_path = 'requirements-{}{}.{}.txt'.format(pypy_name, py_version.major, py_version.minor)
and then rename the requirements files accordingly.
Overall goal would be to make logic easier to decipher at first glance.
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.
because of pypy3 I think you meant :
pypy_name = ''
if is_pypy:
pypy_name = "pypy"
version_specific_requirements_path = 'requirements-{}{}.{}.txt'.format(pypy_name, py_version.major, py_version.minor)
With that I have to create multiple requirements file for pypy3.3/pypy3.2/pypy3.5, are you ok with that? (pypy doc : http://doc.pypy.org/en/latest/index-of-release-notes.html#cpython-3-5-compatible-versions)
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.
The way you ended up doing it looks great and passes travis.
setup.py
Outdated
params['test_suite'] = 'unittest.collector' | ||
params['extras_require']['doc'] = ['Sphinx>=1.0.5'] |
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.
so, this answer suggests using this value to solve this whole problem. Not sure if it will work with pypy
but maybe worth a shot?
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 did not knew it. I think I will make a full rework.
75e6e77
to
4847d2a
Compare
4847d2a
to
ac83fab
Compare
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.
Looking much better.
Don't necessarily need to make changes, but would like get your response to these last couple comments.
return requirements | ||
|
||
|
||
def per_version_requirements(extra_requires_dict): |
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.
Am I missing something? Is this getting called anywhere? If not, how is travis passing?
Also, you don't need to pass in the old version, you can just have something like
params['extra_require'].update(per_version_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.
you don't miss anything.
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.
fixed
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.
Weird that it was passing though.
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.
In fact, tox is not used so the build is passing but tox is out of service.
I commit once the full tox run is over.
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.
yes, but your travis should still be running this code when you do pip install .
Then the tests should fail if proper requirements are not installed.
(Wouldn't fail with the old .travis.yaml
, this should have failed with the new one)
tox.ini
Outdated
@@ -3,7 +3,7 @@ envlist=py27,py33,py34,pypy,docs,self27,cov27 | |||
|
|||
# Default settings for py27, py33, py34 and pypy | |||
[testenv] | |||
deps=-r{toxinidir}/requirements.txt | |||
deps=-e {toxinidir} |
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.
-e
still here...have you tested it with tox? I haven't been able to make tox generally happy so trusting the committer until we get tox integrated with travis.
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.
For me tox run in a quite verbose way and is just failing in the doc env.
I commit something that makes it working better but tox is not totally ready I think.
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 it closer to passing than on master, the same, or worse for you? If this makes it better, I'll merge. Not going to release until I get tox passing on travis though.
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.
we've git exactky the same error in fact.
I also think that one problem we have for documentation is that we use a very old version of sphinx + we do not add the "sphinx_rtd_theme" module.
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 think I found what I missed.
ac83fab
to
575f0cc
Compare
575f0cc
to
8ba1d47
Compare
Hello, for the name : yes : we use nose2 at work so I use my "working" alias instead of the pseudo I used to (artragis) If you want me to amend, I can. |
I don't care one way or the other. |
Ok I come back with a fix to tox as soon as possible :) |
This aims to fix #344
For now, I'm not used to jython and pypy so I don't know how to handle them.
Moreover I'm not sure using the sys.version instead of
sys.version_info
is the right thing to do.