Skip to content

Instantly share code, notes, and snippets.

@Geremie
Created April 13, 2022 08:47
Show Gist options
  • Save Geremie/1095be7b6aa3c67332dff21484e0ba23 to your computer and use it in GitHub Desktop.
Save Geremie/1095be7b6aa3c67332dff21484e0ba23 to your computer and use it in GitHub Desktop.
Manage your Private Python Packages with Artifact Registry (Part 1)
# Clone the sample python package
git clone https://gitlab.com/marcdjoh/sample-python-package.git
# Create a python virtual environment (command for python3)
python3 -m venv py3-env
# Activate the python virtual environment
source py3-env/bin/activate
# Install twine, keyrings.google-artifactregistry-auth and wheel
pip install twine keyrings.google-artifactregistry-auth wheel
# Build the sample python package
python setup.py bdist_wheel
# Authenticate to your GCP project
gcloud config set account <your_gcp_account_email>
gcloud config set project <your_gcp_project>
gcloud auth application-default login
# Deploy the sample python package to artifact registry
twine upload https://<your_repository_location>-python.pkg.dev/<your_gcp_project>/<your_repository_name> dist/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment