semvec/pypi-packages huggingface dataset:
pyenv-configurator 0.1.0
Dynamic Config Class Creation using Environment Variables
License: MIT
Requires Python: >=3.9,<4.0
Keywords: config,environment,variables,env,config,class,dynamic,creation,pyenv-configurator,python

## PYENV_CONFIGURATOR

---

A utility library for Dynamic Config class generation. Now no more repeated boilerplate code...

Before `pyenv_configurator`, config classes used to be created as below.

```python
    class BaseConfig:
        APP = os.environ.get("APP")
        APP_ENV = os.environ.get("APP_ENV")

        # authentication related configuration
        # DB Credentials
        DB_USERNAME = os.environ.get("DB_USERNAME")
        DB_PASSWORD = os.environ.get("DB_PASSWORD")
        DB_HOST = os.environ.get("DB_HOST")
        DB_PORT = os.environ.get("DB_PORT")
        DB_NAME = os.environ.get("DB_NAME")
        DB_DRIVER = os.environ.get("DB_DRIVER")
```

This use to require a lot of boiler plate and redundant code With `pyenv_configurator` this can be reduced to below:

```python
from pyenv_configurator import BaseEnv, BaseConfig as Config_
class BaseConfig(BaseEnv):
    class Config(Config_):
        envs = ('APP',
        'APP_ENV',
        'DB_USERNAME',
        'DB_PASSWORD',
        'DB_PASSWORD',
        'DB_HOST',
        # defaults
        ('DB_PORT',3306),
        'DB_NAME',
        'DB_DROVER'
        )
```

### Benefits of using `pyenv_configurator` over Normal classes

---

- Low memory footprint.
- Lazily evaluates environment variable and only loads them when used.
- Once loaded, env variables are cached.
- Get defaults populated, in case of missing `env` variables.
- env attributes can be overridden easily.
- classes expose `instance` attribute preventing need to initialization and making it behave singleton.
- Loads `.env` files by default so you only need to focus on essentials.

### How to use

Let us refer below example:

```python
from pyenv_configurator import BaseEnv, BaseConfig as Config_
class BaseConfig(BaseEnv):
    class Config(Config_):
        envs = ('APP',
        'APP_ENV',
        'DB_USERNAME',
        'DB_PASSWORD',
        'DB_PASSWORD',
        'DB_HOST',
        # defaults
        ('DB_PORT',3306),
        'DB_NAME',
        'DB_DROVER'
        )
```

We can now use `BaseConfig` class create as below.

```python
>>>BaseConfig.instance.APP
```

Every class, subclassed from `BaseEnv` would expose `.instance` attribute which will be instance of the subclass. This instance can be used to access all the attributes on the class.

> For simplicity, `metaclass` pre-initialises created class, so to make it behave as singleton.

### How this works ?

---

`pyenv_configurator` uses `descriptors` under the hood to dynamically populate env variables as attributes, thus making them available on demand, `Lazily`.
pytest-maybe-context 0.1
Simplify tests with warning and exception cases.
License: MIT
Requires Python: >=3.10,<4.0
Keywords: pytest,plugin

# pytest-maybe-context

Makes it a bit easier to write warning and exception checks along other cases.

```python
from pytest import mark, raises, warns
from pytest_maybe_context import maybe_context, not_context

@mark.parametrize(('buffering', 'expected'), (
    (0, b'contents'),
    (1, warns(RuntimeWarning)),
    (.1, raises(TypeError))
))
def test_example(buffering, expected):
    with maybe_context(expected):
        file = open('file', 'rb', buffering)
    if not_context(expected):
        assert file.read() == expected
```

## Installation

```bash
poetry add pytest-maybe-context --group dev
```
altb 0.5.2
Cli tool for tracking over binaries and easily swapping between them
License: MIT
Requires Python: >=3.9,<4.0

# altb
altb is a cli utility influenced by `update-alternatives` of ubuntu.  
Linked paths are added to `$HOME/.local/bin` according to [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).  
Config file is located at `$HOME/.config/altb/config.yaml`.

### How to start?

**Must use Python > 3.9**
execute:
```bash
pipx install altb
```

to track new binary use:
```bash
altb track path <app_name>@<app_tag> /path/to/binary
```
for example:
```bash
altb track path python@2.7 /bin/python2.7
altb track path python@3.8 /bin/python3.8
# altb track path python ~/Downloads/python # will also work and generate a new hash for it
```

List all tracked versions:
```bash
$ altb list -a
python
|----   2.7 - /bin/python2.7
|----   3.8 - /bin/python3.8
```

Use specific version:
```bash
altb use <app_name>[@<app_tag>]
```

example:
```bash
altb use python@2.7
```
this will link the tracked path to `~/.local/bin/<app_name>` in this case - `~/.local/bin/python`

Copy specific standalone binary automatically to `~/.local/share/altb/versions/<app_name>/<app_name>_<tag>`
```bash
altb track path helm@3 ~/Downloads/helm --copy
```

You can run custom commands using:
```bash
altb track command special_command@latest "echo This is a command"
```
this especially useful for latest developments, example:
```bash
altb track command special_command@latest "go run ./cmd/special_command" --working-directory "$HOME/special_command"
```


## Docs
### Migrations
- [Migrate to v0.5.0 and above from lower versions](./docs/migrations/migrate_to_0_5_0.md)