Skip to content

Commit

Permalink
Some doc fixes suggested by users. (pantsbuild#18393)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjyw authored Mar 2, 2023
1 parent 1891088 commit eca724a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/markdown/Docker/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ Most authentication mechanisms will also require tools exposed on the `$PATH` to
[docker]
env_vars = ["DOCKER_CONFIG=%(homedir)s/.docker"]
tools = [
"docker-credential-gcloud",
"docker-credential-gcr",
"dirname",
"readlink",
"python3",
Expand All @@ -332,7 +332,7 @@ You may need to set additional environment variables with `[docker].env_vars`.
> It can help to simulate a hermetic environment by using `env -i`. With credential helpers, it also helps to directly invoke the helper without Docker and Pants. For example, you can symlink the tools you think you need into a directory like `/some/isolated/directory`, then run the below:
>
> ```
> ❯ echo europe-north1-docker.pkg.dev | env -i PATH=/some/isolated/directory docker-credential-gcloud get
> ❯ echo europe-north1-docker.pkg.dev | env -i PATH=/some/isolated/directory docker-credential-gcr get
> {
> "Secret": "ya29.A0ARrdaM-...-ZhScVscwTVtQ",
> "Username": "_dcgcloud_token"
Expand Down
10 changes: 9 additions & 1 deletion docs/markdown/Python/python/python-distributions.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,18 @@ Although alternatives exist, and PEP 517 enables them, Setuptools is still by fa

You can either author `setup.py` yourself (which is necessary if building native extensions), or have Pants generate one for you (see below).

By default Pants will generate a `setup.py` for every `python_distribution` target, unless you set `generate_setup = False` on the target. But you can flip this behavior by setting `generate_setup_default = false` in the `[setup-py-generation]` section of your `pants.toml` config file. In that case Pants will only generate a `setup.py` for `python_distribution` targets that have `generate_setup = True` set on them.
By default, Pants will generate a `setup.py` for every `python_distribution` target, unless you set `generate_setup = False` on the target. But you can flip this behavior by setting `generate_setup_default = false` in the `[setup-py-generation]` section of your `pants.toml` config file. In that case Pants will only generate a `setup.py` for `python_distribution` targets that have `generate_setup = True` set on them.

So if you expect to use handwritten `setup.py` scripts for most distributions in your repo, you probably want to set `generate-setup-default = false` and override it as needed. If you expect to mostly use generated `setup.py` scripts, you can set `generate-setup-default = true` (or just not set it, since that is the default).

> 📘 3rdparty requirements in `setup.py`
>
> If you use a handwritten `setup.py`, the generated distribution will have requirements on the packages you list in the `install_requires` key, as expected. But Pants will not automatically use those as dependencies of the underlying sources, e.g., when running tests. They are strictly used when generating a distribution.
>
> Instead, the "universe" of possible requirements of your source files must be specified as described [here](doc:python-third-party-dependencies), and Pants will use dependency inference to select an appropriate subset as needed.
>
> If Pants generates a `setup.py` for you then the `install_requires` value will be generated from the actual requirements of your source files.
Using a generated `setup.py`
----------------------------

Expand Down

0 comments on commit eca724a

Please sign in to comment.