Pushing packages to a Python artifact registry repository

706 Views Asked by At

what are ways to push packages to an AR Python repository? I tried to look at the API documentation, but only operation there I could find related to uploading a package, is the UpdateRepositoryRequest, which seems to update the repository with another.

As the repositories should be buckets, uploading to a bucket blob should be possibly but I wasn't able to achieve this. All errors related to bucket not being found. What would be the correct URL for a bucket corresponding to an AR repository?

I know the gcloud CLI tools allow for this quite easily (and I used it successfully), but I was wondering if there was any way to do it with the Python API?

1

There are 1 best solutions below

0
Mazlum Tosun On

To publish Python packages in Artifact Registry, you can check the official documentation

The package upload should be done with python3 command line and twine as an usual Python package and private repo.

pip install twine
  • Build your Python package

  • Upload the packages to the repository from your dist directory :

python3 -m twine upload --repository-url https://us-central1-python.pkg.dev/PROJECT_ID/quickstart-python-repo/ dist/*