rich-london-74860
12/05/2023, 5:36 PMpants
, we publish packges using twine
(which I believe pants publish
uses as well), which uses the environment variables TWINE_REPOSITORY_URL
, TWINE_USERNAME
, TWINE_PASSWORD
.
When using pants
, it’s not possible to use environment variables in the repositories parameter of python_distribution, so instead we dynamically generate a ~/.pypirc
file with values pulled from environment variables. In the .pypirc
file, we defined an index alias
[distutils]
index-servers = artifacts
[artifactory]
username = xxxx
password = xxxx
repository = <https://artifacts.our-host.com/some/path/pypi/pypi-local>
Therefore, in the python_distribution
target, repositories=["@artifacts"]
.
With this setup pants publish
publishes packages to our private pypi repository as expected. Recently a bug in CI stopped generating this .pypirc
file. Now there is no .pypirc
file, but the TWINE_*
environment variables are still defined, but somehow pants publish
still works?
If there is no .pypirc
file, then how does pants
know what @artifacts
is?
Is twine
defaulting to the environment variables?
If that is the case, then could any dummy alias be set for repositories
- e.g. repositories=["@null"]
(pants publish
will skip a package entirely if repositories
is not set at all)curved-television-6568
12/05/2023, 5:46 PMcurved-television-6568
12/05/2023, 5:47 PMTWINE_PASSWORD
etc, that will be used, but you can have per repo settings using TWINE_PASSWORD_ARTIFACTS
etc..curved-television-6568
12/05/2023, 5:49 PMrich-london-74860
12/05/2023, 5:50 PMTWINE_REPOSITORY_URL
, TWINE_USERNAME
, TWINE_PASSWORD
are definedcurved-television-6568
12/05/2023, 5:51 PMcurved-television-6568
12/05/2023, 5:51 PMcurved-television-6568
12/05/2023, 5:52 PMTWINE_USERNAME
etc…rich-london-74860
12/05/2023, 5:52 PMcurved-television-6568
12/05/2023, 5:52 PMcurved-television-6568
12/05/2023, 5:53 PMcurved-television-6568
12/05/2023, 5:53 PMrich-london-74860
12/05/2023, 5:54 PM