All Projects → BigRoy → acre

BigRoy / acre

Licence: LGPL-3.0 license
Lightweight configurable environment management in Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to acre

Envinject Plugin
This plugin makes it possible to setup a custom environment for your jobs
Stars: ✭ 74 (+270%)
Mutual labels:  environment, environment-variables
dart environment config
Environment specific config generator for Dart and Flutter applications during CI/CD builds
Stars: ✭ 87 (+335%)
Mutual labels:  environment, environment-variables
Fig
A minimalist Go configuration library
Stars: ✭ 142 (+610%)
Mutual labels:  environment, environment-variables
Sweet
Official repository for Semantic Web for Earth and Environmental Terminology (SWEET) Ontologies
Stars: ✭ 69 (+245%)
Mutual labels:  environment, environment-variables
rune
tool to query for tokens and passwords for use as environment variables
Stars: ✭ 13 (-35%)
Mutual labels:  environment, environment-variables
Conf
Go package for loading program configuration from multiple sources.
Stars: ✭ 70 (+250%)
Mutual labels:  environment, environment-variables
Emacs Direnv
direnv integration for emacs
Stars: ✭ 194 (+870%)
Mutual labels:  environment, environment-variables
envy
Use envy to manage environment variables with your OS keychain
Stars: ✭ 23 (+15%)
Mutual labels:  environment, environment-variables
dotenvy
Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents
Stars: ✭ 31 (+55%)
Mutual labels:  environment, environment-variables
Environ Config
Python Application Configuration With Environment Variables
Stars: ✭ 210 (+950%)
Mutual labels:  environment, environment-variables
Variable Injector
Continuous Integration Tool for Swift Projects
Stars: ✭ 63 (+215%)
Mutual labels:  environment, environment-variables
DBEnvironmentConfiguration
Easily switch between iOS development environments/ configurations
Stars: ✭ 18 (-10%)
Mutual labels:  environment, environment-variables
Env
Simple lib to parse environment variables to structs
Stars: ✭ 2,164 (+10720%)
Mutual labels:  environment, environment-variables
Env Providers
👷 Load Laravel service providers based on your application's environment.
Stars: ✭ 73 (+265%)
Mutual labels:  environment, environment-variables
Phpdotenv
Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
Stars: ✭ 11,648 (+58140%)
Mutual labels:  environment, environment-variables
Envy
Envy automatically exposes environment variables for all of your Go flags
Stars: ✭ 150 (+650%)
Mutual labels:  environment, environment-variables
envmnt
Environment variables utility functions.
Stars: ✭ 16 (-20%)
Mutual labels:  environment, environment-variables
angular-environment
AngularJS Environment Plugin
Stars: ✭ 78 (+290%)
Mutual labels:  environment, environment-variables
Env Var
Verification, sanitization, and type coercion for environment variables in Node.js
Stars: ✭ 201 (+905%)
Mutual labels:  environment, environment-variables
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (+260%)
Mutual labels:  environment, environment-variables

Acre

Acre is a lightweight cross-platform environment management Python package that makes it trivial to launch applications in their own configurable working environment.

Examples

Compute a dynamic environment acre.compute

This sample will compute the result of a dynamic environment that has values that use values from other keys in the environment.

To compute the result of a dynamic environment use acre.compute

import acre

data = {
    "MAYA_VERSION": "2018",
    "MAYA_LOCATION": "C:/Program Files/Autodesk/Maya{MAYA_VERSION}"

}

env = acre.compute(data)
assert env["MAYA_LOCATION"] == "C:/Program Files/Autodesk/Maya2018"

This also works with recursion.

import acre

data = {
    "MAYA_VERSION": "2018",
    "PIPELINE": "Z:/pipeline",
    "APPS": "{PIPELINE}/apps",
    "MAYA_LOCATION": "{APPS}/Autodesk/Maya{MAYA_VERSION}"
}

env = acre.compute(data)
assert env["MAYA_LOCATION"] == "Z:/pipeline/apps/Autodesk/Maya2018"

Platform specific paths acre.parse

You can set up your data with platform specific paths, by using a dictionary. These need to be parsed with acre.parse

import acre

data = {
    "VERSION": "2018",
    "MY_LOCATION": {
        "windows": "C:/path/on/windows/{VERSION}",
        "darwin": "/path/on/mac/osx/{VERSION}",
        "linux": "/path/on/linux/{VERSION}"
    }
}

env = acre.parse(data, platform_name="windows")
assert env["MY_LOCATION"] == "C:/path/on/windows/{VERSION}"

env = acre.compute(env)
assert env["MY_LOCATION"] == "C:/path/on/windows/2018"

# When *not* explicitly providing a platform name, the current active
# platform is used. So for your active OS:
env = acre.parse(data)
env = acre.compute(env)
print(env["MY_LOCATION"])

Apply the environment on your system

The final touch for getting your environment ready and in use is to merge it with your environment. So:

import os
import acre

data = {
    "PIPELINE": {
        "windows": "P:/pipeline",
        "darwin": "//share/pipeline",
        "linux": "//share/pipeline",
    },
    "CUSTOMPATH": "{PATH}",
    "DATAPATH": "{PIPELINE}/mydata"
}

# Parse the platform specific variables
env = acre.parse(data, platform_name="windows")

# Compute the dynamic environment
env = acre.compute(env)

# Merge it with your local environment
env = acre.merge(env, current_env=os.environ)

# Update your local environment
os.environ.update(env)

# Now it's live!
assert os.environ["DATAPATH"] == "P:/pipeline/mydata"

More samples?

For more usage examples see tests/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].