Skip to main content

yapenv

Alpha

WARNING: This repo is still in alpha development phase and structure is subject to change.

Yet Another Python Environment manager (with less options).

Features

  1. Easy configuration via YAML files with optional inheritance.
  2. Named environments with per-environment configuration (test, dev, beta, prod, etc...).
  3. CLI interface with easy initialization.

NOTE: yapenv uses the package bole to handle configuration and logging

Install

pip install yapenv

Run in your project directory

yapenv init

Configuration

By default yapenv uses the following configuration file names.

  • .yapenv.yaml
  • .yapenv.yml
  • .yapenv
  • .yapenv.json

Core Configuration

python_version: "3.9" # Python version to use
python_executable: null # Path to python executable (overrides python_version)
venv_directory: .venv # Path to created virtualenv directory
pip_config_path: null # Path to the pip.conf file
inherit: false # Boolean, if true inherit parent directory's yapenv configuration
environments: [] # Optional environments, see environment configs

# These values are inherited from and overwritten by environment configuration
env_file: .env # Env file to load when running commands
pip_install_args: [] # List of arguments for pip install command
virtualenv_args: [] # list of arguments for virtualenv command
requirements: [] # List of requirements (see requirement configuration)

Environment Configuration

Enabled by using --env <environment_name> argument.

environments:
  dev: # Environment name
    env_file: .env # Env file to load when running commands
    pip_install_args: [] # List of arguments for pip install command
    virtualenv_args: [] # list of arguments for virtualenv command
    requirements: [] # List of requirements (see requirement configuration)

Requirement Configuration

requirements:
- package: mypackage # Pip package name string
- myotherpackage==0.0.1 # Pip package name string
- import: requirements.txt # Path to requirements.txt to import

Environment Variables

  • YAPENV_ENV_FILE: Env file to load when running commands (default=.env).
  • YAPENV_FULL_ERRORS: Boolean that tells yapenv to dump full traceback (default="false").
  • YAPENV_CONFIG_FILES: Array of yapenv config file names (default=".yapenv.yaml .yapenv.yml .yapenv .yapenv.json").
  • NO_COLOR: Boolean that disables colorized logging output (default="false")
  • VIRTUAL_ENV: File path of python virtualenv (default=None)

Example Configurations

Requirements File Method

python_version: "3.9"
venv_directory: .venv
environments:
  dev:
    requirements:
    - import: requirements.dev.txt
requirements:
- import: requirements.txt

Package List Method

python_version: "3.10"
venv_directory: .venv
environments:
  dev:
    requirements:
    - package: flake8
    - package: black
requirements:
- package: celery==5.2.6
- Flask>=2.1.2

Extra config and reading configuration values

yapenv allows extra configuration values to be embedded in its config file. e.g.

python_version: "3.10"
venv_directory: .venv
requirements:
 - black
 - flake8

my_custom_config:
  a_list: 
    - a_key: "my_custom_value"

Note: extra configuration values follow yapenv config inheritance rules.

You can read your configuration value by,

yapenv config "my_custom_config.a_list[0].a_key"

That should output my_custom_value

Or a yaml block (see format options in the command),

yapenv config "my_custom_config.a_list"

Should output,

- a_key: "my_custom_value"

Contribution

Feel free to ping me in issues or directly on LinkedIn to contribute.

Future implementation

We plan to support multiple python version per environment.

Looking for help on this subject.

License

Copyright © Zav Shotan and other contributors. It is free software, released under the MIT licence, and may be redistributed under the terms specified in LICENSE.

Metadata

Release files for yapenv 0.4.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yapenv 0.4.7
File Size Uploaded Provenance Actions
yapenv-0.4.7.tar.gz 17.9 kB Without provenance Details for yapenv-0.4.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yapenv 0.4.7
File Interpreter ABI Platform Actions
yapenv-0.4.7-py3-none-any.whl Python 3 none any Details for yapenv-0.4.7-py3-none-any.whl

Total release size: 41.1 kB

Release files / yapenv-0.4.7.tar.gz

Download URL yapenv-0.4.7.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d8fdbd969eb2f7083c26314583fb202d2e51557fb5303f8116bf8dc258e83c52
BLAKE2b-256 checksum
How to use checksums
21a50cc2916a3218579cea0f985a2f5d78c252402b78e7e9d1e31d8056c3a3f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / yapenv-0.4.7-py3-none-any.whl

Download URL yapenv-0.4.7-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
929b68355847eec089fc132bdf919d5a02fd77b6daf3dd3aed6dbc7d5ed3db76
BLAKE2b-256 checksum
How to use checksums
40c69b579f95a609059be862ebd810082f3acfb09c7cc0d66ceb207ba9a26d49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Security for yapenv 0.4.7

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page