-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare for Python 3.9 (not compatible yet) (#8)
- Loading branch information
Showing
4 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,9 +65,9 @@ $ brew install python3 | |
$ brew install poetry | ||
``` | ||
|
||
When you're done, make sure that the `python` on your `$PATH` is Python 3 from | ||
Homebrew (in `/usr/local`). By default, you'll get the standard Python 2 that | ||
comes with MacOS. | ||
When you're done, you probably want to set up your profile so the `python` on | ||
your `$PATH` is Python 3 from Homebrew (in `/usr/local`). By default, you'll | ||
get the standard Python 2 that comes with MacOS. | ||
|
||
### Debian | ||
|
||
|
@@ -88,6 +88,46 @@ Then, install Poetry in your home directory: | |
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python | ||
``` | ||
|
||
## Configure Poetry's Python Interpreter | ||
|
||
At this point, you can either let Poetry use its defaults, or tell it explicity | ||
which Python interpreter you want it to use. On MacOS anyway, Poetry >= v1.1.3 | ||
seems to be quite aggressive about using the most recent version of Python | ||
available on my system (even if it's not on my `$PATH`), which is not always | ||
what I want. | ||
|
||
To force Poetry to use a particular version of Python on the `$PATH`, do this: | ||
|
||
``` | ||
$ poetry env use 3.8 | ||
``` | ||
|
||
To force Poetry to use a version that isn't on the `$PATH`, you can't just use | ||
the version number as shown above. You have to provide the whole path: | ||
|
||
``` | ||
$ poetry env use /usr/local/Cellar/[email protected]/3.9.0/bin/python3.9 | ||
``` | ||
|
||
You can check the version that is in use with: | ||
|
||
``` | ||
$ poetry env info | ||
``` | ||
|
||
If you switch between versions, it is a good idea to sanity check what is | ||
actually being used. I've noticed that if I start on 3.8 and then switch to | ||
3.9 (in the order shown above), then `python env info` still reports Python | ||
3.8.6 when I'm done. The fix seems to be to remove the virutalenvs and start | ||
over: | ||
|
||
``` | ||
$ poetry env list | ||
$ poetry env remove <item> | ||
``` | ||
|
||
For more background, see [this discussion](https://github.com/python-poetry/poetry/issues/522) and also [Poetry PR #731](https://github.com/python-poetry/poetry/pull/731). | ||
|
||
## Activating the Virtual Environment | ||
|
||
Poetry manages the virtual environment used for testing. Theoretically, the | ||
|
@@ -113,6 +153,7 @@ Usage: run <command> | |
- run install: Setup the virtualenv via Poetry and install pre-commit hooks | ||
- run activate: Print command needed to activate the Poetry virtualenv | ||
- run requirements: Regenerate the docs/requirements.txt file | ||
- run checks: Run the PyLint and MyPy code checkers | ||
- run format: Run the Black code formatter | ||
- run test: Run the unit tests | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters