Publish a Python Wheel to GCP Artifact Registry with Poetry
a year ago
- #GCP
- #Python
- #DevOps
- The author needed a runnable Python file instead of a Docker image to interact directly with the machine and GPU drivers.
- Poetry was used to build a wheel file for the Python project, with configurations in pyproject.toml to include the main directory.
- A Python registry was created in GCP's Artifact Registry to store the wheel file, requiring setup for both pushing and pulling the file.
- Dynamic versioning was implemented in pyproject.toml to avoid overriding files in the registry, using a timestamp-based version number.
- The VM in GCP was configured with the necessary permissions and settings to pull the wheel file from the Artifact Registry.
- The project was installed using pip, which checks both the public registry and the custom GCP registry for dependencies.
- The application was run directly using Python, bypassing the need for Docker, though manual dependency management in the VM was noted as a drawback.