Skip to content

Commit

Permalink
Show how to drop into other Python versions
Browse files Browse the repository at this point in the history
Also, fix devShell in py39 and py311
  • Loading branch information
zupo committed Oct 21, 2023
1 parent a6f793c commit 24db1fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
PYTHON: ${{ matrix.python }}
run: |
nix build .#checks.x86_64-linux.tests-$(echo $PYTHON)
nix build .#packages.x86_64-linux.impure-check-$(echo $PYTHON)
impure_tests:
name: Impure Tests
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,23 @@ $ make unit
$ make unit filter=foo
```

### Updating dependencies
### Multiple Python versions

This is a bit more involved since the `poetry.lock` needs to work in both Nix and
Docker environments, and also on multiple Python versions. This is how you do it:
By default, the development environment uses the latest supported Python version. This is how you drop into an environment with an older Python

On Linux:
```
# Comment out `poetry-core = "<1.1.0"` in `pyproject.toml`
$ poetry lock --no-update
# Uncomment out `poetry-core = "<1.1.0"` in `pyproject.toml`
$ direnv reload
$ nix develop .#devShells.x86_64-linux.default-python39
```

On macOS:

```
$ nix develop .#devShells.aarch64-darwin.default-python39
```



# TODO:

* docker image
9 changes: 2 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
''));

devShells =
{default=self'.devShells.default-python310;}
{default=self'.devShells.default-python311;}

//

Expand All @@ -163,11 +163,6 @@
buildInputs = with pkgs; [
poetry
self'.packages."testEnv-${python}"
pkgs.glibcLocales
# python311
# python310
# python39
# gitAndTools.pre-commit

# test dependency
nmap
Expand All @@ -184,7 +179,7 @@
# Install the package in editable mode
# This allows executing `clan` from within the dev-shell using the current
# version of the code and its dependencies.
PYTHONPATH=${pkgs.python3Packages.poetry-core}/${testEnv.sitePackages}:${testEnv}/${testEnv.sitePackages} ${pkgs.python3Packages.pip}/bin/pip install \
PYTHONPATH=${pkgs."python${lib.replaceStrings ["python"] [""] python}Packages".poetry-core}/${testEnv.sitePackages}:${testEnv}/${testEnv.sitePackages} ${pkgs."python${lib.replaceStrings ["python"] [""] python}Packages".pip}/bin/pip install \
--no-deps \
--disable-pip-version-check \
--no-index \
Expand Down

0 comments on commit 24db1fa

Please sign in to comment.