A utility for managing .env files using Google Cloud Secret Manager
Project description
grasp-env-handler
A utility for managing .env files using Google Cloud Secret Manager for Grasp teams.
Overview
This tool helps Grasp teams securely manage their .env files by storing them in Google Cloud Secret Manager. It uses your GitHub repository name to organize secrets logically and provides simple commands to push and pull environment variables across your team.
Features
- Pull .env files from Secret Manager with
grasp env pull - Push .env files to Secret Manager with
grasp env push - Support for recursive operations with the
-rflag - Ignore specific .env files with
.envignore
Installation
Install the package directly from PyPI using pip or uv:
pip install grasp-env-handler
uv pip install grasp-env-handler
Development Installation
For development:
# Clone the repository
git clone https://github.com/username/grasp-env-handler.git
cd grasp-env-handler
# With pip
pip install -e .
# With uv
uv pip install -e .
Requirements
- Python 3.8+
- Google Cloud SDK installed and configured
- Git repository connected to GitHub
GCP Setup
Before using this tool, make sure:
- You have the Google Cloud SDK installed
- You are authenticated with GCP:
gcloud auth login - You have set a default project:
gcloud config set project YOUR-PROJECT-ID - The Secret Manager API is enabled in your project:
gcloud services enable secretmanager.googleapis.com - You have the necessary permissions to create and access secrets
Usage
# Pull all .env files in current directory
grasp env pull
# Pull .env files recursively from all subdirectories
grasp env pull -r
# Push all .env files in current directory
grasp env push
# Push .env files recursively from all subdirectories
grasp env push -r
.envignore
Create a .envignore file in your repository to exclude specific .env files:
# Example .envignore
path/to/secret.env
*.test.env
See .envignore.example for more examples.
Publishing to PyPI (for maintainers)
To publish a new version of this package to PyPI:
-
Increment the version number in
pyproject.toml(e.g., from0.1.0to0.1.1). -
Build the package:
uv buildThis will create distribution files (a
.tar.gzand a.whl) in thedist/directory. -
Publish to PyPI: You will need an API token from PyPI. Generate one from your PyPI account settings if you don't have one. Then, run the following command, replacing
YOUR_PYPI_API_TOKENwith your actual token:uv publish dist/* -t YOUR_PYPI_API_TOKEN
Alternatively, you can set the
UV_USERNAME=__token__andUV_PASSWORD=YOUR_PYPI_API_TOKENenvironment variables and then runuv publish dist/*.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grasp_env_handler-0.1.2.tar.gz.
File metadata
- Download URL: grasp_env_handler-0.1.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
410c45a54f319bb8a30e8d5834d65f05f2c73bb2e0c5a1ff7e93391e41b0c224
|
|
| MD5 |
60fa7def6ab07354274e2c413d5fe792
|
|
| BLAKE2b-256 |
11a31d1888a4aaafd121381521fa09222c8f1e16fa8c143edc662a656b89cc11
|
File details
Details for the file grasp_env_handler-0.1.2-py3-none-any.whl.
File metadata
- Download URL: grasp_env_handler-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79a2c60ffa2da95b6a5f5ef690ecf6476577a8f885d5f30894128c1f0ac7e5cd
|
|
| MD5 |
e487ff45837c2ffb8a510b94c5da81cf
|
|
| BLAKE2b-256 |
7728fbc75f1581598636c6737fa2a29731179e1c43cb1dc45dbbf8c459074301
|