passenv


Namepassenv JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryLoad environment variables from pass entries
upload_time2025-07-17 21:56:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords cli devops environment pass password
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PassEnv

Load environment variables from [pass](https://www.passwordstore.org/) entries seamlessly in your shell.

## Features

- **Secure**: Leverages the existing `pass` password manager
- **Simple**: Load/unload environment variables with a single command
- **Stateful**: Tracks what's loaded and prevents conflicts
- **Auto-completion**: Tab completion for pass entries
- **Shell Integration**: Works with bash and zsh

## Installation

### Prerequisites

- [pass](https://www.passwordstore.org/) must be installed and initialized
- Python 3.8 or higher

### Install from PyPI

```bash
pip install passenv
```

### Set up shell integration

After installation, run the setup command:

```bash
passenv install
passenv --install-completion
```

This will add the necessary shell function and completion to your `~/.bashrc` or `~/.zshrc`.

## Usage

### Basic Commands

```bash
# Load environment variables from a pass entry at database/envs
passenv load database/envs

# Check what's currently loaded
passenv status

# List available pass entries
passenv list

# Unload current environment
passenv unload
```

### Pass Entry Format

Store your environment variables in pass entries using the `KEY=VALUE` format:

```bash
# Create a pass entry
pass edit database/envs
```

Example entry content:
```
DATABASE_URL=postgres://user:pass@localhost/mydb
API_KEY=secret123
DEBUG=false
# This is a comment
LOG_LEVEL=info
```

### Advanced Usage

#### Environment Isolation

PassEnv automatically handles environment isolation:

- Loading a new set of environment variables automatically unloads the previous ones
- Tracks which variables were loaded to prevent conflicts
- Provides clear status information

## Examples

### Development Workflow

```bash
# Load development environment
passenv load myapp/development

# Run your application
python manage.py runserver

# Switch to staging environment
passenv load myapp/staging

# Deploy to staging
./deploy.sh

# Clean up
passenv unload
```

### Pass Entry Organization Suggestion

Organize your pass entries logically:

```
myapp/
├── development
├── staging
└── production

database/
├── local
├── staging
└── production
```

### Environment Variable Format

- **Comments**: Lines starting with `#` are ignored
- **Empty lines**: Skipped automatically
- **Format**: `KEY=VALUE` (spaces around `=` are stripped)
- **Quotes**: Optional quotes around values are removed
- **Variable names**: Must be valid shell variable names (`[A-Za-z_][A-Za-z0-9_]*`)

## Troubleshooting

### Common Issues

**Pass not found**
```
Error: 'pass' command not found. Please install pass.
```
Install pass using your package manager:
```bash
# Ubuntu/Debian
sudo apt install pass

# macOS
brew install pass

# Arch Linux
sudo pacman -S pass
```

**Pass not initialized**
```
Error: Pass store not initialized.
```
Initialize your pass store:
```bash
pass init your-gpg-key-id
```

**Entry not found**
```
Error: Pass entry 'myapp/staging' not found.
```
Create the entry:
```bash
pass edit myapp/staging
```

**Invalid variable format**
```
Error: Invalid line 'malformed-line' in pass entry.
```
Check your pass entry format. Each line should be `KEY=VALUE` or a comment.

### Getting Help

```bash
# Show help
passenv --help

# Show command-specific help
passenv load --help
```

## Development

### Local Development

```bash
# Clone the repository
git clone https://github.com/yourusername/passenv.git
cd passenv

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/ tests/
isort src/ tests/

# Type checking
mypy src/
```

### Testing

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=passenv

# Run specific test file
pytest tests/test_parser.py
```

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Run the test suite
6. Submit a pull request

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Related Projects

- [pass](https://www.passwordstore.org/) - The password manager this tool integrates with

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "passenv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "cli, devops, environment, pass, password",
    "author": null,
    "author_email": "Victor Gambarini <victor.gambarini@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b8/45/47541462e797aa8a5324aa5eef86857ef2db765594d630b9800b1fbb3615/passenv-0.1.0.tar.gz",
    "platform": null,
    "description": "# PassEnv\n\nLoad environment variables from [pass](https://www.passwordstore.org/) entries seamlessly in your shell.\n\n## Features\n\n- **Secure**: Leverages the existing `pass` password manager\n- **Simple**: Load/unload environment variables with a single command\n- **Stateful**: Tracks what's loaded and prevents conflicts\n- **Auto-completion**: Tab completion for pass entries\n- **Shell Integration**: Works with bash and zsh\n\n## Installation\n\n### Prerequisites\n\n- [pass](https://www.passwordstore.org/) must be installed and initialized\n- Python 3.8 or higher\n\n### Install from PyPI\n\n```bash\npip install passenv\n```\n\n### Set up shell integration\n\nAfter installation, run the setup command:\n\n```bash\npassenv install\npassenv --install-completion\n```\n\nThis will add the necessary shell function and completion to your `~/.bashrc` or `~/.zshrc`.\n\n## Usage\n\n### Basic Commands\n\n```bash\n# Load environment variables from a pass entry at database/envs\npassenv load database/envs\n\n# Check what's currently loaded\npassenv status\n\n# List available pass entries\npassenv list\n\n# Unload current environment\npassenv unload\n```\n\n### Pass Entry Format\n\nStore your environment variables in pass entries using the `KEY=VALUE` format:\n\n```bash\n# Create a pass entry\npass edit database/envs\n```\n\nExample entry content:\n```\nDATABASE_URL=postgres://user:pass@localhost/mydb\nAPI_KEY=secret123\nDEBUG=false\n# This is a comment\nLOG_LEVEL=info\n```\n\n### Advanced Usage\n\n#### Environment Isolation\n\nPassEnv automatically handles environment isolation:\n\n- Loading a new set of environment variables automatically unloads the previous ones\n- Tracks which variables were loaded to prevent conflicts\n- Provides clear status information\n\n## Examples\n\n### Development Workflow\n\n```bash\n# Load development environment\npassenv load myapp/development\n\n# Run your application\npython manage.py runserver\n\n# Switch to staging environment\npassenv load myapp/staging\n\n# Deploy to staging\n./deploy.sh\n\n# Clean up\npassenv unload\n```\n\n### Pass Entry Organization Suggestion\n\nOrganize your pass entries logically:\n\n```\nmyapp/\n\u251c\u2500\u2500 development\n\u251c\u2500\u2500 staging\n\u2514\u2500\u2500 production\n\ndatabase/\n\u251c\u2500\u2500 local\n\u251c\u2500\u2500 staging\n\u2514\u2500\u2500 production\n```\n\n### Environment Variable Format\n\n- **Comments**: Lines starting with `#` are ignored\n- **Empty lines**: Skipped automatically\n- **Format**: `KEY=VALUE` (spaces around `=` are stripped)\n- **Quotes**: Optional quotes around values are removed\n- **Variable names**: Must be valid shell variable names (`[A-Za-z_][A-Za-z0-9_]*`)\n\n## Troubleshooting\n\n### Common Issues\n\n**Pass not found**\n```\nError: 'pass' command not found. Please install pass.\n```\nInstall pass using your package manager:\n```bash\n# Ubuntu/Debian\nsudo apt install pass\n\n# macOS\nbrew install pass\n\n# Arch Linux\nsudo pacman -S pass\n```\n\n**Pass not initialized**\n```\nError: Pass store not initialized.\n```\nInitialize your pass store:\n```bash\npass init your-gpg-key-id\n```\n\n**Entry not found**\n```\nError: Pass entry 'myapp/staging' not found.\n```\nCreate the entry:\n```bash\npass edit myapp/staging\n```\n\n**Invalid variable format**\n```\nError: Invalid line 'malformed-line' in pass entry.\n```\nCheck your pass entry format. Each line should be `KEY=VALUE` or a comment.\n\n### Getting Help\n\n```bash\n# Show help\npassenv --help\n\n# Show command-specific help\npassenv load --help\n```\n\n## Development\n\n### Local Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/yourusername/passenv.git\ncd passenv\n\n# Install in development mode\npip install -e \".[dev]\"\n\n# Run tests\npytest\n\n# Format code\nblack src/ tests/\nisort src/ tests/\n\n# Type checking\nmypy src/\n```\n\n### Testing\n\n```bash\n# Run all tests\npytest\n\n# Run with coverage\npytest --cov=passenv\n\n# Run specific test file\npytest tests/test_parser.py\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Run the test suite\n6. Submit a pull request\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Related Projects\n\n- [pass](https://www.passwordstore.org/) - The password manager this tool integrates with\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Load environment variables from pass entries",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/VictorGambarini/passenv#readme",
        "Homepage": "https://github.com/VictorGambarini/passenv",
        "Issues": "https://github.com/VictorGambarini/passenv/issues",
        "Repository": "https://github.com/VictorGambarini/passenv"
    },
    "split_keywords": [
        "cli",
        " devops",
        " environment",
        " pass",
        " password"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e70d4c5defb3e468ad5e48fc9553bc76f9f478ee9ee682a758a4ea325b82790d",
                "md5": "e37142cdca16f24e0d846ebdd4402dcc",
                "sha256": "debebb5b689cabd50a0f1788e0864b62531220ab7e6bb1cc2f26b5430bbe34d6"
            },
            "downloads": -1,
            "filename": "passenv-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e37142cdca16f24e0d846ebdd4402dcc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8661,
            "upload_time": "2025-07-17T21:56:41",
            "upload_time_iso_8601": "2025-07-17T21:56:41.092296Z",
            "url": "https://files.pythonhosted.org/packages/e7/0d/4c5defb3e468ad5e48fc9553bc76f9f478ee9ee682a758a4ea325b82790d/passenv-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b84547541462e797aa8a5324aa5eef86857ef2db765594d630b9800b1fbb3615",
                "md5": "8b9d9719c784ca275bc4e6b7ae2b05e2",
                "sha256": "8283e5655b7ac46efe1dfe9bd1dcd454a533401b753571a5dd3bc844b5319f35"
            },
            "downloads": -1,
            "filename": "passenv-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8b9d9719c784ca275bc4e6b7ae2b05e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 8877,
            "upload_time": "2025-07-17T21:56:42",
            "upload_time_iso_8601": "2025-07-17T21:56:42.495983Z",
            "url": "https://files.pythonhosted.org/packages/b8/45/47541462e797aa8a5324aa5eef86857ef2db765594d630b9800b1fbb3615/passenv-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-17 21:56:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "VictorGambarini",
    "github_project": "passenv#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "passenv"
}
        
Elapsed time: 1.93198s