Skip to content

Commit

Permalink
Use .env file instead of .envrc (astral-sh#1132)
Browse files Browse the repository at this point in the history
astral-sh#1131 shows that `direnv` installation is _most_ of the CI overhead
introduced by astral-sh#1105.

Instead of using `direnv`, let's just use a simple `.env` file that can
be loaded with `source` or [`direnv`'s `dotenv`
directive](https://direnv.net/man/direnv-stdlib.1.html#codedotenv-ltdotenvpathgtcode).
  • Loading branch information
zanieb committed Jan 26, 2024
1 parent 5cc4e5d commit 0cdde89
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PATH=$PWD/bin:$PATH
PUFFIN_PYTHON_PATH=$PWD/bin
3 changes: 0 additions & 3 deletions .envrc

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ jobs:
- uses: actions/checkout@v4
- name: "Install required Python versions"
run: |
sudo apt install direnv
scripts/bootstrap/install.sh
direnv allow .envrc
- name: "Install Rust toolchain"
run: rustup show
- uses: rui314/setup-mold@v1
Expand All @@ -71,7 +69,8 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "Tests"
run: |
direnv exec . cargo nextest run --all --all-features --status-level skip --failure-output immediate-final --no-fail-fast -j 12
source .env
cargo nextest run --all --all-features --status-level skip --failure-output immediate-final --no-fail-fast -j 12
# TODO(konstin): Merge with the cargo-test job once the tests pass
windows:
Expand Down
13 changes: 6 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,20 @@ Install required Python versions with the bootstrapping script:
scripts/bootstrap/install.sh
```

Then add the Python binaries to your path:
The installed Python binaries will be available in `<repo>/bin` and must be added to your path to be used. We
provide a `.env` file with the proper environment variables for development. You may activate it with:

```
export PATH=$PWD/bin:$PATH
source .env
```

We also strongly recommend setting the `PUFFIN_PYTHON_PATH` variable during development; this will prevent your
system Python versions from being found during tests:
Or, if you use `direnv` to manage your environment:

```
export PUFFIN_PYTHON_PATH=$PWD/bin
echo "dotenv" >> .envrc
direnv allow
```

If you use [direnv](https://direnv.net/), these variables will be exported automatically after you run `direnv allow`.

## Testing

To run the tests we recommend [nextest](https://nexte.st/). Make sure to run the tests with `--all-features`, otherwise you'll miss most of our integration tests.
Expand Down

0 comments on commit 0cdde89

Please sign in to comment.