Add requirements.txt for Python smoke tests.#289
Add requirements.txt for Python smoke tests.#289cjerdonek wants to merge 2 commits intoFreeAndFair:masterfrom
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.
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.
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 freezeto 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.
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.
Super. Can you update the PR to do it that way?
nealmcb
left a comment
There was a problem hiding this comment.
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.txtfile. That's a best practice that simplifies test setup and also ensures that test environments are deterministic / identical across users (by pinning dependencies).