Any recommendations on how to install python requi...
# general
h
Any recommendations on how to install python requirement from a private repository which only support keyring based authentication. I have wheels in google artifact reporitory(GAR) https://cloud.google.com/artifact-registry/docs/python/authentication#sa-key Essentially this has 2 dependency,
keyrings
and
keyrings.google-artifactregistry-auth
I see there is an issue on adding support for keyring https://github.com/pantsbuild/pants/issues/14928 but no recent activity.
c
Using this hint, this should be possible to setup as-is, I think: https://github.com/pantsbuild/pants/issues/14928#issuecomment-1436268420
h
1. I found the path of keyring
Copy code
which keyring
/opt/homebrew/Caskroom/miniforge/base/bin/keyring
2. Adding that path in
pants.toml
Copy code
[subprocess-environment]
env_vars.add = [
  "PATH=$PATH:/opt/homebrew/Caskroom/miniforge/base/bin"
]
3.
Copy code
(base) aditya@Adityas-MacBook-Pro-2 zippin_tech % pants generate-lockfiles --resolve=temp
19:23:54.30 [INFO] Initializing scheduler...
19:24:00.38 [INFO] Scheduler initialized.
19:24:00.44 [WARN] DEPRECATED: option 'extra_type_stubs' in scope 'mypy' is scheduled to be removed in version 2.18.0dev0.

Extra type stubs are now installed from a named resolve, as described at <https://www.pantsbuild.org/v2.16/docs/python-lockfiles>.
19:24:00.55 [ERROR] 1 Exception encountered:

Engine traceback:
  in `generate-lockfiles` goal

TypeError: dict() got multiple values for keyword argument 'PATH'
So it seems like I am doing something wrong here. Any suggestion ?
Also, it seems like
keyring
should be explicitly installed on the host(before any
pants
command like
generate-lockfiles
), is that right ?
c
Yes,
keyring
would need to be managed out of band. Also, ouch: https://github.com/pantsbuild/pants/issues/19157
I wonder if
PATH
is "leaked" in this case.. so if you try and set PATH outside of pants, does that work?
h
I would guess that https://github.com/pantsbuild/pants/issues/19157 is not hard to fix, if you want to take a whack at it, @helpful-rocket-63313?
h
Untitled
regarding setting
pATH
explicitly, i made a local patch and it works, i am able to set
PATH
, will submit a PR. However turns out
PATH
is leaked, and
keyring
is already in path, still it cannot find the private packages.
Copy code
which keyring
/opt/homebrew/Caskroom/miniforge/base/bin/keyring
If i install manually, it works
Copy code
(base) aditya@Adityas-MacBook-Pro-2 zipzap_tech % pip install --index-url <https://us-central1-python.pkg.dev/zipzapdeveloper/zipzap-pypi/simple/> zipzaptools-edge-media-client
Looking in indexes: <https://us-central1-python.pkg.dev/zipzapdeveloper/zipzap-pypi/simple/>
Collecting zipzaptools-edge-media-client
  Downloading <https://us-central1-python.pkg.dev/zipzapdeveloper/zipzap-pypi/zipzaptools-edge-media-client/zipzaptools_edge_media_client-1.1.6-py2.py3-none-any.whl> (26 kB)
Requirement already satisfied: pydantic<2.0.0,>=1.9.0 in /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages (from zipzaptools-edge-media-client) (1.9.0)
  Downloading <https://us-central1-python.pkg.dev/zipzapdeveloper/zipzap-pypi/zipzaptools-edge-media-client/zipzaptools_edge_media_client-1.1.5-py2.py3-none-any.whl> (26 kB)
however with
pants generate-lockfiles
it isn't working , see that
keyring
path is already. a part of path set by
pants
Copy code
"--python-path", "/Users/aditya/.pyenv/shims:/Users/aditya/.pyenv/bin:/opt/homebrew/Caskroom/miniforge/base/bin:
Hi @curved-television-6568 Any thoughts on this ? it seems like
PATH
is leaked. how do you think i can debug this ?
c
thanks for looking into this @helpful-rocket-63313, I can see if I have any input on this tomorrow
👍 1
h
Hi @curved-television-6568 thanks for merging my PR, however just want to clarify, even that PR doesn't fix the keyring problem, it just supports adding PATH in subsystem, but since PATH was already leaking path to
keyring
was anyways accessible, so the problem is somewhere else.
👍 1
c
yea. thanks for the PR anyway, it resolved #19157 😉