Package: gcsutils
Google Cloud Storage (GCS) UtilitiesThis project provides a few simple utility functions for interacting with GCS.AuthenticationTo function properly, this code needs credentials that it can use to authenticate against the Google Cloud Storage API.  Credentials can be provided in one of two ways, and the code will look for them in this order:Service Account Key.Before running this code, create an environment variable namedSERVICE_ACCOUNT_KEYcontaining the JSON key for a Google Cloud service account with the necessary permissions to perform the actions you're trying to perform in GCS.Personal Credentials.Before running this code, authenticate with the Google Cloud Storage API using thegcloudcommand line tool:$ gcloud auth application-default login --project GCP_PROJECT_NAMEDevelopmentThis project usesPipenvto manage virtual environments and dependencies. Development-time dependencies are documented in thePipfile. Follow thePipenvdocumentation to create a virtual environment and install the dependencies.This project also usespre-committo run various Python code quality checks (linting and styling) on every commit.  Before you begin any development work, install the pre-commit hook with:$pre-commitinstallMakefileThe includedMakefileprescribes actions to test, build, and publish this code to a Python Package Index (PyPI) repository as described in the following sections.$ make [test | build | publish]TestingWith the virtual environment active and the dependencies installed, usepytestto run the test suite.The integration tests interact with the actual GCS API to manipulate blobs in an actual GCS bucket. If needed, change the GCS project and bucket used for these tests by changing the variables in thetest_gcs.pymodule.The integration tests require credentials for the GCS bucket that is used for testing. When running the tests, you must provide credentials as described in the Authentication section above.To run only the unit tests, and skip the integration tests, run:$ pipenv run pytest -m "not integration"BuildingThis project uses thesetuptoolsPython package for packaging as describedhere.When building via themake buildcommand, you may optionally append to the package name using theprereleaseargument. For example, if the current version ofgcsutilsspecified in thesetup.pymodule is1.2.3, then$ make build prerelease=rc1will produce a package namedgcsutils-1.2.3rc1. The default is a beta prerelease name incremented by each git commit (eg/1.2.3b7for the seventh commit on this branch). Specify a final release with$ make build prerelease=""Note that prerelease names must comply withPEP 440.PublishingThis project uses thetwinePython package for distribution as describedhere.When publishing via themake publishcommand, the default PyPI repository istestpypi. To publish topypi.org, specify that repository:$ make publish pypi_repository=pypiThe credentials necessary to publish to the target PyPI repository can be provided in one of two ways.As these environment variables:Env VarNotesPYPI_REPOSITORY_USERNAMEPyPI account username. If authenticatingusing a token, use the literal string__token__.PYPI_REPOSITORY_PASSWORDPyPI account password. If authenticatingusing a token, use the token contents.At themake publishcommand:$ make publish pypi_repository_password="foo" pypi_repository_password="bar"