-
Notifications
You must be signed in to change notification settings - Fork 179
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
chore(python): default local dev environment to 3.7 for api/shared-data #9708
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #9708 +/- ##
==========================================
- Coverage 75.45% 75.45% -0.01%
==========================================
Files 1937 1937
Lines 51039 51039
Branches 4855 4855
==========================================
- Hits 38512 38509 -3
- Misses 11610 11613 +3
Partials 917 917
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
CI is failing on this PR and I don't know why—GitHub isn't showing me logs, for some reason.
Other than that, this makes sense to me, in principle.
It's unfortunate that our build system is getting so complicated. I can't think of any better ways to solve this, though. :\
scripts/python.mk
Outdated
@@ -2,7 +2,7 @@ | |||
# python to run if pyenv is not available. it should always be set to | |||
# point to a python3.7 | |||
OT_PYTHON ?= python | |||
|
|||
OT_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.
I think the comment above might be confusing, given this change.
My understanding is that OT_PYTHON_VERSION
only matters when pyenv or similar is available. It influences which of the many installed Pythons are chosen by Pipenv. So it's kind of the opposite of OT_PYTHON
?
Maybe OT_PYTHON
and OT_PYTHON_VERSION
shouldn't be grouped together, or maybe they should have more specific names.
Aside: I haven't looked at It has these dynamically-built helper variables: opentrons/shared-data/python/Makefile Lines 31 to 32 in 32a5ed0
If you follow So, merely evaluating this expression will preempt the correct Pipenv command to set up the virtual environment, creating an incorrect one in its place. You might think this is okay because the definitions use opentrons/shared-data/python/Makefile Lines 71 to 72 in 32a5ed0
opentrons/shared-data/python/Makefile Lines 79 to 82 in 32a5ed0
So, apparently, even reading this Makefile will cause a Fortunately, it looks like a subsequent |
Overview
#9497 removed the block
[requires] python_version = "3.7"
fromapi/Pipfile
andshared-data/python/Pipfile
so thatpipenv
would allow CI to install the dev environments on other versions of Python so we could test against Python 3.10 in CI.(Unlike Poetry or other tools, Pipenv only allows to to specify an exact Python version requirement or nothing at all, which is super cool everyone.)
However, when running
make setup
locally for these projects, with the removal of that requirement,pipenv
will select whatever version of Python that it wants to create the virtual environments of these projects. If/whenpipenv
selects something other than 3.7, you'll start getting all sorts of lint and typecheck failures.Changelog
This PR updates our
Makefile
s to recognize anOT_VIRTUALENV_VERSION
environment variable which will default to Python 3.7, and feeds into the--python
option ofpipenv
. This means:make setup
will continue to select Python 3.7Python Setup
action can take apython-version
input and feed it into this variable, maintaining Python 3.10 CI forapi
andshared-data
Review requests
make teardown-py && make setup-py
does what you expect, leaving you with a collection of Python 3.7 virtual envsRisk assessment
Very low, local dev env + CI stuff, does not affect production Python evironment