-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add requirements.txt for Python smoke tests. #289
base: master
Are you sure you want to change the base?
Add requirements.txt for Python smoke tests. #289
Conversation
Wow - thanks, Chris! This is a model PR with just the sort of help folks should indeed be able to use! And I just learned some nice things about Checking out pull requests locally - User Documentation, e.g. this syntax for doing a
Do you know if
|
Hi Neal! Yes, I know it works, but I don't have recent experience installing it on Ubuntu via It's good for you to be nailing this down though and documenting it, because once you can create virtualenvs on your system, everything becomes "easy." Many Python folks view virtualenvs as essential for working day-to-day. |
Indeed. I've used This works, it turns out: So the instructions on that page need some help on at least some environments. |
Ah, cool, glad you figured it out so quickly! (Btw, I misunderstood the "unable to locate" error as being unable to locate the package after installation, but now I see it meant it couldn't locate it in the package management repository.) |
test/smoketest/requirements.in
Outdated
# The sibling requirements.txt file contains the corresponding concrete / | ||
# pinned dependencies. You can use pip-tools to automatically update | ||
# requirements.txt from this file: | ||
# https://github.com/jazzband/pip-tools |
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.
Interesting. But I'm normally reluctant to introduce new tooling requirements. Can you contrast this with other options for maintaining requirements.txt?
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.
pip-tools
wouldn't be mandatory. It would only be useful to / potentially used by someone who wanted to update requirements.txt, e.g. to check for upgrades in package dependencies and/or when adding a new abstract dependency.
One possible "manual" approach to updating requirements.txt would be--
- Create a fresh virtualenv
- Manually invoke
pip install ...
with whatever abstract dependencies you want (e.g. requests, etc). - Write the output of
pip freeze
to a file (e.g.pip freeze > requirements.txt
.
(This is essentially what pip-tools does.)
One reason I mentioned pip-tools
is that it lets you specify the abstract dependencies in a stand-alone requirements.in
file, which is nice. I'm not sure other tools like pip recognize such a file format (though they might).
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.
Okay, I confirmed another option to updating requirements.txt is to run the following after creating a fresh virtualenv:
pip install -r requirements.in
pip freeze > requirements.txt
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.
Super. Can you update the PR to do it that way?
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.
Great work - much appreciated!
Could change it as discussed to use only standard Python tools, and document their usage, in the requirements.in file or wherever.
Also, please note the need with Python 3.4 Ubuntu to use different python3.4-venv package name in some cases.
623cf2a
to
6e3152c
Compare
Thanks for the review, @nealmcb! I've updated the PR to address your comments. |
Hi!
I was reading the README for the smoketest directory and noticed that you can use a
requirements.txt
file. That's a best practice that simplifies test setup and also ensures that test environments are deterministic / identical across users (by pinning dependencies).