gcs_pypi
gcs_pypi is a CLI for creating a Python Package Repository in an GCS bucket.
Getting started
Installation
Install gcs_pypi using pip:
pip install gcs_pypi
Usage
GCS Bucket
Create a new bucket
IAM (Role & Service Account)
Setup service account with the following permissions
storage.buckets.get
storage.buckets.getIamPolicy
storage.buckets.update
storage.objects.create
storage.objects.delete
storage.objects.get
storage.objects.getIamPolicy
storage.objects.list
storage.objects.setIamPolicy
Recommended that you create a custom Role which can be inherited by the service account
Example
Create Role “PYPI”
Assign Permissions
storage.buckets.get
storage.buckets.getIamPolicy
storage.buckets.update
storage.objects.create
storage.objects.delete
storage.objects.get
storage.objects.getIamPolicy
storage.objects.list
storage.objects.setIamPolicy
Create a Service Account e.g pypi
Select the “PYPI” Role created above
Add a condition to limit access to only that GCS bucket
resource.name == "mybucket"
Visit Cloud IAM Conditions for more information
Distributing packages
You can now use gcspypi to create Python packages and upload them to your GCS bucket. To hide packages from the public, you can use the --private option to prevent the packages from being accessible directly via the GCS bucket (they will only be accessible via your Domain or alternatively you can specify a secret subdirectory using the --secret option:
cd /path/to/your-project/
gcspypi --bucket mybucket [--private] [--secret SECRET]
Cache Header
Set cache-control header for index.html
$ gsutil setmeta -h "cache-control:public, must-revalidate, proxy-revalidate, max-age=0" gs://[BUCKET]/index.html
Installing packages
Install your packages using pip by pointing the --extra-index-url to your Custom domain (optionally followed by a secret subdirectory):
pip install your-project --extra-index-url https://pypi.example.com/SECRET/
Alternatively, you can configure the index URL in ~/.pip/pip.conf:
[global]
extra-index-url = https://pypi.example.com/SECRET/
Credits
Metadata
Release files for gcs-pypi 0.1.66
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gcs_pypi-0.1.66.tar.gz | 6.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gcs_pypi-0.1.66-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.8 kB
Release files / gcs_pypi-0.1.66.tar.gz
| Download URL | gcs_pypi-0.1.66.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
faf668856933c72b0477ea587e4288ca03fea25ae4c73e3d089a5b00d97f5cae
|
|
BLAKE2b-256 checksum How to use checksums |
29619b928c5c67cfb720da6532da67f4b9c761e7ff6692c9d7fca0ef6ef5f42e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Release files / gcs_pypi-0.1.66-py3-none-any.whl
| Download URL | gcs_pypi-0.1.66-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6060ade5533133baa67f150c81c34a1b645640d87e230d95262798949267607
|
|
BLAKE2b-256 checksum How to use checksums |
87e59a3b2d77fed095e58919d4ac6a3f25d3bfdab65dc38d1bbb05ef9eb18f5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Security for gcs-pypi 0.1.66
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.