Skip to content
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

FAQ: remove reference to tox "isolated_build" and improve spelling #8658

Merged
merged 6 commits into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ If your package will be used as an application, it might be worth to define an u

### Is tox supported?

**Yes**. By using the [isolated builds](https://tox.readthedocs.io/en/latest/config.html#conf-isolated_build) `tox` provides,
you can use it in combination with the PEP 517 compliant build system provided by Poetry.
**Yes**. Provided that you are using `tox` >= 4, you can use it in combination with
the PEP 517 compliant build system provided by Poetry. (With tox 3, you have to set the
[isolated build](https://tox.wiki/en/3.27.1/config.html#conf-isolated_build) option.)

So, in your `pyproject.toml` file, add this section if it does not already exist:

Expand All @@ -97,10 +98,9 @@ build-backend = "poetry.core.masonry.api"
`tox` can be configured in multiple ways. It depends on what should be the code under test and which dependencies
should be installed.

#### Usecase #1
#### Use case #1
```ini
[tox]
isolated_build = true

[testenv]
deps =
Expand All @@ -112,10 +112,9 @@ commands =
`tox` will create an `sdist` package of the project and uses `pip` to install it in a fresh environment.
Thus, dependencies are resolved by `pip`.

#### Usecase #2
#### Use case #2
```ini
[tox]
isolated_build = true

[testenv]
allowlist_externals = poetry
Expand All @@ -126,13 +125,12 @@ commands =
```

`tox` will create an `sdist` package of the project and uses `pip` to install it in a fresh environment.
Thus, dependencies are resolved by `pip` in the first place. But afterwards we run Poetry,
Thus, dependencies are resolved by `pip` in the first place. But afterward we run Poetry,
which will install the locked dependencies into the environment.

#### Usecase #3
#### Use case #3
```ini
[tox]
isolated_build = true

[testenv]
skip_install = true
Expand Down Expand Up @@ -198,7 +196,7 @@ For example, if Poetry builds a distribution for a project that uses a version t

### Poetry busts my Docker cache because it requires me to COPY my source files in before installing 3rd party dependencies

By default running `poetry install ...` requires you to have your source files present (both the "root" package and any directory path dependencies you might have).
By default, running `poetry install ...` requires you to have your source files present (both the "root" package and any directory path dependencies you might have).
This interacts poorly with Docker's caching mechanisms because any change to a source file will make any layers (subsequent commands in your Dockerfile) re-run.
For example, you might have a Dockerfile that looks something like this:

Expand Down