https://pantsbuild.org/ logo
#general
Title
# general
r

refined-addition-53644

06/03/2022, 5:53 PM
Hi, is it possible to use
pants
with aws codeartifact? I see internally we are using it with npm packages. Codeartifact does support pip. Not sure how would I integrate it with pants though?
h

happy-kitchen-89482

06/03/2022, 6:25 PM
You should be able to follow the instructions here for setting up consuming distributions from a custom index: https://www.pantsbuild.org/docs/python-third-party-dependencies#custom-repositories
From browsing the codeartifact docs, it looks like the index URL should be
Copy code
<https://aws>:$CODEARTIFACT_AUTH_TOKEN@my_domain-111122223333.d.codeartifact.region.amazonaws.com/pypi/my_repo/simple/
after you run
Copy code
CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain my_domain --domain-owner 111122223333 --query authorizationToken --output text`
to get the token
But obviously you don't want to check that URL into the repo, so you probably want to use the env var
r

refined-addition-53644

06/03/2022, 6:35 PM
yeah I am trying something like that. As far as i understand this will add this custom URL to the default pypi server?
h

happy-kitchen-89482

06/03/2022, 6:38 PM
Depends how you configure it, you can either add it or replace it
Those docs explain how to do each
👍 1
r

refined-addition-53644

06/03/2022, 7:11 PM
It seems to be taking too long with pants when running tests. I tested installing the package using pip which works fine. Would pants be able to figure out required aws credentials which are needed to access the codeartifact repo?
I guess if there was any aws credential issue it should be throwing some error.
h

happy-kitchen-89482

06/03/2022, 7:15 PM
Yeah, from my brief investigation of codeartifact, it sounds like you have to manually run
aws
CLI to get credentials, Pants knows nothing about that
What exactly is running? For example, are there lockfiles involved?
r

refined-addition-53644

06/03/2022, 7:16 PM
no this is just a global requirements.txt It's stuck in the stage of building requirements.pex I am using pants 2.10
Now at least it's throwing some error. I had made a mistake in URL. I will debug further. Thanks for the help so far !
h

happy-kitchen-89482

06/03/2022, 7:27 PM
🤞
6 Views