I can't seem to get `TWINE_USERNAME` and `TWINE_PA...
# general
m
I can't seem to get
TWINE_USERNAME
and
TWINE_PASSWORD
working with an "extra" repository on
python_distribution
My python_distribution:
Copy code
python_distribution(
  name = "my-wheel",
  dependencies = [
    "..."
  ],
  provides = python_artifact(
    name="...",
    version="0.0.1",
  ),
  repositories = [
    "<https://my-private-repo>",
  ]
)
And I'm calling
publish
like:
Copy code
TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token pants publish :my-wheel
From gitlab's CI/CD
Do I need to set up a "named" repo in
pants.toml
somewhere? Or do I just pass
TWINE_REPOSITORY
in as an env var as well?
I get a
404
, but the URL is definitely correct, so I assume it's something to do with the creds
c
Hi, I donโ€™t recall exactly, but you may need to provide the var names in the
pants.toml
configuration in order for it to come through.
a named repo is only needed if you want to use the
TWINE_<REPO>_USERNAME
form of variables I think..
m
Where are the named repos configured? In pants.toml, or pypirc?
c
pypirc
๐Ÿ‘ 1
ah yes, you need the env vars in pants config, and for named repos the name was at the end. The docs for python publishing never came out of draft it seems.. so the tests are the next best thing to look at https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/python/goals/publish_test.py#L51-L55
๐Ÿ‘€ 1
m
Ok, I figured this out (and I feel dumb)... I was using
Copy code
<https://gitlab.example.com/api/v4/projects/><project_id>/packages/pypi/simple
instead of
Copy code
<https://gitlab.example.com/api/v4/projects/><project_id>/packages/pypi
... I just goofed when copying the gitlab URL. The former is for consuming packages, and the latter is for publishing ๐Ÿ™ƒ
c
good find.