-
Notifications
You must be signed in to change notification settings - Fork 42
Run snyk checks on requirements, but only for python 2.7 #40
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
Conversation
- snyk needs to check requirements.txt, so add one, but be warned it isn't actually used as part of installing this project's dependencies; see setup.py - setup.py needs ipaddress for all python 2.x and python <3.3, but we're only testing 3.x for versions 3.3 or greater. Therefore only check 2.7 since we'd expect the same snyk result for all python 2.x versions.
.travis.yml
Outdated
| - pip install coverage coveralls | ||
| - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then pip install pylint yapf; fi | ||
| - if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then pip install pylint yapf; fi | ||
| - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi |
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 we drop 2.6, we should remove this.
requirements.txt
Outdated
| @@ -0,0 +1,4 @@ | |||
| # NOTE: This project does not use requirements.txt, it uses 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.
I suspect some tooling will use this and it will cause issues. Why can't we just install it manually for Travis?
oschwald
left a comment
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.
Looks good. Two small changes.
setup.py
Outdated
| requirements.append('ipaddress') | ||
| if os.environ.get('SNYK_TOKEN'): | ||
| f = open('requirements.txt', 'w') | ||
| [f.write(r + '\n') for r in 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.
Using list comprehension to get a postfix for doesn't seem very Pythonic. Could you rewrite this as a normal for loop?
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, you don't close the file. This doesn't matter too much, but something like:
with open('requirements.txt', 'w') as f:
for r in requirements:
f.write(r + '\n')
Might be better.
isn't actually used as part of installing this project's dependencies;
see setup.py
only testing 3.x for versions 3.3 or greater. Therefore only check 2.7
since we'd expect the same snyk result for all python 2.x versions.