Saravanan666/pypi-org huggingface dataset:
Package: env_cache
Get a Python environment for a Python version and requirements.txt fileenv_cachemanages a collection of Python environments. You request an
environment for a specific Python version and a set of requirements (preferably
with pinned versions, like frompip freeze). It can either create a new
environment with these packages, or retrieve one it already made with the same
arguments.To get different versions of Python,env_cachecan usepyenv,conda,
orspack. It can also work with a single ‘fixed’ Python
interpreter to create virtualenvs - in this case, only one Python version is
available.Usage (with pyenv):importsysfrompathlibimportPathfromenv_cacheimportPyenvEnvMaker,EnvsManageriflen(sys.argv)!=3:sys.exit("Usage: eg-pyenv.py 3.8.11 path/to/requirements.txt")py_version,reqs_path=sys.argv[1:]reqs=Path(reqs_path).read_text('utf-8')envmgr=EnvsManager(Path('my-envs'),PyenvEnvMaker())env_dir=envmgr.get_env(py_version,reqs)It returns apathlibPath
object (env_dirabove) pointing to the environment directory. Python can
be run frombin/pythonwithin this directory.It also records each time an environment is requested in a crudeusage.csvfile in the environment directory. This is meant to help with cleaning up
unused environments, but it may go away or change completely in a future version.This package is written primarily for internal use atEuropean XFEL, so it’s fairly rough, and we might make breaking
changes without warning.
Package: envcast
envcastPackage for environment variables parsing with type casting. Why do you need it? Because you can't just grab environment variables as is, you need to cast them to desired types for your application (for example like bool variable: how to cast stringsFalse,"",0to bool without boilerplaite?).This packages just cast needed environment variables to desired types with syntax very familiar toos.getenvusers.Plus this package has good test coverage and quality codebase.Written in modern python 3.7+ with full support of:https://www.python.org/dev/peps/pep-0526/https://www.python.org/dev/peps/pep-0484/https://www.python.org/dev/peps/pep-0008/https://www.python.org/dev/peps/pep-0257/https://www.python.org/dev/peps/pep-0518/https://www.python.org/dev/peps/pep-0585/TL;DRIt behaves very similar toos.getenv:importenvcast# result will be casted to strenvcast.env('SOME_ENV_VAR','defaultvalue',type_cast=str)# result will be casted to bool (if it like 1 or on or true/True -> if will be python True)# BUT, if there is no value, default value is None will be casted to bool, so it will be Falseenvcast.env('SOME_BOOL_ENV_VAR',type_cast=bool)Usage, API, more details and examplesSignature of env and dotenv absolutely similar and looks like this:# var_name is desired variable name# default_value going through type casting, so it must be in desired type# type_cast — desired variable type casting function# list_type_cast applies if type_cast is list, tupleenvcast.env(var_name:str,default_value:typing.Any=None,type_cast:type=str,list_type_cast:type=str)From environment variablesFor casting good old plain env variables you will need do following:importenvcastthis_will_be_bool:bool=envcast.env('SOME_ENV_VARIABLE','false',type_cast=bool))or_this_is_string_by_default:str=envcast.env('OTHER_ENV_VAR')this_is_int:int=envcast.env('MORE_ENV',type_cast=int)From .env fileIf your are using .env file, you can do it too:importenvcastenvcast.set_dotenv_path('.')# Can be any of the following :# envcast.set_dotenv_path('~/some/.env')# envcast.set_dotenv_path('/tmp/.env')# envcast.set_dotenv_path('/tmp/')this_will_be_bool:bool=envcast.dotenv('SOME_ENV_VARIABLE','false',type_cast=bool))or_this_is_string_by_default:str=envcast.dotenv('OTHER_ENV_VAR')this_is_int:int=envcast.dotenv('MORE_ENV',type_cast=int)Dont worry, file will be readed and parsed only once.Exceptionsenvcast.exceptions.IncorrectDotenvPathenvcast.exceptions.NotSettedDotenvPathenvcast.exceptions.BrokenDotenvStructureSupported casting typesYou can pass totype_castorlist_type_castany desired type casting callables.
It may be any builtin type, of Decimal, Path, or any other callable.Listing valuesIf you want to parse and cast environment variable with list of values:MY_FANCY_VAR=True, On, Ok, False, Disabled, 0You will need expression like this:envcast.env('MY_FANCY_VAR',type_cast=bool,list_type_cast=list)If you cares about what exactly can be separator for list values: it can be,,(space) or|.ChangelogYou can checkhttps://github.com/xfenix/envcast/releases/release page.
Package: envcat
envcatMix and merge env file values.Free software: Apache Software License 2.0Documentation:https://envcat.readthedocs.io.FeaturesMerge keys and values from any number of env files.Ignore missing env files.Output to STDOUT in env file format or a single line (good for passing to commands likeheroku config).CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.1 (2017-05-11)Add a dockerized versionAdd a –version argument0.1.0 (2017-05-09)First release on PyPI.
Package: envchain-shellenv
envchain shellenvInjecting secrets from envchain / keychain into your shell as environment variables, in batch.envchain-shellenv- prints export statements for your secrets in the keychainso that you can doeval "$(envchain-shellenv)".Use withenvchainfor maximum convenience.envchain shellenvQuick StartInstallationPrerequisitespipxpipUsage:ExampleExample config fileDevelopQuick Start# install envchain first, and add your secrets to your keychain app via envchain# for macOS with Homebrew, run `brew install envchain'.# see https://github.com/sorah/envchain for more details.# install envchain-shellenvpipxinstallenvchain-shellenv||pipinstallenvchain-shellenv# creates an example config at ~/.config/envchain-shellenv/keychain.inienvchain-shellenv--create-example-config# edit config file with your favorite editorvim~/.config/envchain-shellenv/keychain.ini# export your envchain secrets in the current shelleval"$(envchain-shellenv)"# optionally add this line to your shell startup fileInstallationPrerequisitesRequired:envchainOptional:keyringkeyringis installed by default if you installenvchain-shellenvwith pipx.To use keyring when installing withpip, dopip install 'envchain-shellenv[keyring]'.pipxThis is the recommended installation method.$ pipx install envchain-shellenvpip$ pip install envchain-shellenvUsage:envchain-shellenvprints export statements for your secrets in the keychain,when you need your secrets in your shell env, just doeval "$(envchain-shellenv)".$ eesh -h # `eesh' is just an alias for `envchain-shellenv', you can use either.

usage: envchain-shellenv [-h] [-c CONFIG] [--create-example-config] [-u {envchain,keyring}] [--version]

envchain shellenv - prints export statements for your secrets in the keychain

options:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        config file (default: /Users/tscp/.config/envchain-shellenv/keychain.ini)
  --create-example-config
                        create example config file (default: False)
  -u {envchain,keyring}, --use {envchain,keyring}
                        What to use to extract secrets (default: envchain)
  --version, -V         show program's version number and exit

Created by Teddy Xinyuan Chen || Homepage: https://github.com/tddschn/envchain-shellenvExampleExample config filetest:TEST:TEST_SECMULTILINE:aws:# the envchain namespaceAWS_SECRET_KEY:AWS_ROOT_PW:envchain-aws-root-pw# sets AWS_ROOT_PW env var to envchain-aws-root-pw in the aws namespace of envchainno-item:# this will be skippedDevelop$ git clone https://github.com/tddschn/envchain-shellenv.git
$ cd envchain-shellenv
$ poetry install
Package: envcheck
envcheckA small, simple command line utility to check for, compare and merge environment variables between environment files and their .example counterpartsInstallpython3 -m pip install envcheckUsecd dir/to/check
envcheckWhat it doesIf you have a file ofenvorenvironmentit will be foundIf there's a matchingenv.exampleorenvironment.examplefile it will compare the two and give you some help merging themWrites a new file,env.neworenvironment.newThis tool doesn't update your environment file
Please do for yourself: check the new file and update your existing environment fileHow it compares🔑 👍 List and count the matching variables (matching both variable name and value)🔑 🚨 List and count variables in the environment file but not found at all in the example (maybe stale or maybe the example is bad)🔑 ✅ List and count new variables in the exampleIf new variables are in the example you will be prompted to add them to the new environment file, with auto-fillable values from the example
Package: envcheckr
=========envcheckr=========.. image:: https://img.shields.io/pypi/v/envcheckr.svg:target: https://pypi.python.org/pypi/envcheckr.. image:: https://img.shields.io/travis/adamjace/envcheckr.svg:target: https://travis-ci.org/adamjace/envcheckr.. image:: https://readthedocs.org/projects/envcheckr/badge/?version=latest:target: https://envcheckr.readthedocs.io/en/latest/?badge=latest:alt: Documentation Status.. image:: https://pyup.io/repos/github/adamjace/envcheckr/shield.svg:target: https://pyup.io/repos/github/adamjace/envcheckr/:alt: UpdatesA really simple CLI tool that checks and compares two .env files for missing variablesUsage--------$ envcheckr [-h] FILE FILECredits---------This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
Package: envclass
EnvClassManage environment variables in a simple and elegant wayMade from 100% pure PythonWhy does this existTo manage environment variables in an easy
way that works for any device (like a cell phone
with termux)If you intend to run in production, usepydantic-settingsInstallationpipinstallenvclassQuick Start.envHOST=0.0.0.0
PORT=1234

CONFIG_FILE=fromenvclassimportEnvClass# When declaring the class with _env_file it# reads the file and casts all attributesclassMyEnv(EnvClass):_env_file='.env'TESTING:bool=FalseHOST:str='localhost'PORT:intCONFIG_FILE:str# Return: '0.0.0.0'MyEnv.HOST# Return: FalseMyEnv.TESTING# Return: 1234MyEnv.PORT# Return: NoneMyEnv.CONFIG_FILESupported TypesCurrently, only primitive types have been tested, such as:strintboolfloatBooleansAttributes follow Python language conventions
for conversion, butboolattributes have specific
interpretations when reading environment variables:boolattributes can be:True,true, or1for true.False,false, or0for false.Read Only AttributesWhen this configuration is defined,
it is not possible to change the attributesExample:fromenvclassimportEnvClassclassEnvLock(EnvClass)KEY:str=None# Generates an AttributeError stating# that it is read-onlyEnvLock.KEY='Value'Lower AttrubutesLowercase attributes work the same way,
I just thought leaving everything capitalized
would look betterSince the name is closest to the environment variable readExample:.envLOWER_KEY='lower'fromenvclassimportEnvClassclassEnvLower(EnvClass):_env_file='.env'lower_key='upper'# Return: 'lower'EnvLower.lower_keySee your variablesThe class is seen this way:.envENV_A=3
ENV_B=1
ENV_C=10fromenvclassimportEnvClassclassEnv(EnvClass):_env_file='.env'_prefix='ENV'A:strB:bool=FalseC:intprint(Env)Output:ENV_A='3'
ENV_B=True
ENV_C=10Special AttributesEnv FileBy default, this is set toNone.It is used to read the file like.envExample:# file: no_load_env.pyfromenvclassimportEnvClassclassNoEnv(EnvClass):WAIT_TIME:int=10print(NoEnv.WAIT_TIME)Execution on Linux:$WAIT_TIME=5pythonno_load_env.py5Strict ModeBy default, this is set toTrue.This allows usingenviron[key]to signal when an
environment variable is not defined, generating
the defaultKeyErrorerror if the variable
does not have a default value. If set toFalse, attributes that do not exist
will returnNone.Examples:fromenvclassimportEnvClass# Disabled strict modeclassNotStrict(EnvClass):_strict=FalseNOT_EXISTS:str# Returns NoneNotStrict.NOT_EXISTS# Enabled strict mode# Generates a KeyErrorclassStrict(EnvClass):_strict=TrueNOT_EXISTS:strPrefixBy default, there isNoneThis allows adding a string at the beginning
of the environment variable name,
making it easier to organize.Example:.envDB_USER=dev_user
DB_KEY=dev_key_123fromenvclassimportEnvClassclassDataBase(EnvClass):_env_file='.env'_prefix='DB'NAME:str='Dev'HOST:str='localhost'USER:strKEY:str# Return: 'Dev'DataBase.NAME# Return: dev_key_123DataBase.KEY
Package: envclasses
envclassesenvclassesis a library to map fields on dataclass object to environment variables.InstallationpipinstallenvclassesUsageDeclare a class withdataclassandenvclassdecorators.fromenvclassesimportenvclass,load_envfromdataclassesimportdataclass@envclass@dataclassclassFoo:v:intfoo=Foo(v=10)load_env(foo,prefix='foo')print(foo)Run the script$ python foo.py
Foo(v=10)Run with environment variable$ FOO_V=100 python foo.py
Foo(v=100)
Package: env-cleanup-utils
env_cleanup_utilsA Python package for cleaning up virtual environments (venv),__pycache__, andnode_modulesdirectories within a directory tree. It also saves the requirements of virtual environments to arequirements.txtfile.
It is capable of traversing the subdirectories and finding all virtual environmentsInstallationYou can install theenv_cleanup_utilspackage using pip:pipinstallenv_cleanup_utilsUsageCommand Line UsageYou can useenv_cleanup_utilsas a command-line utility by running the following command:python-menv_cleanup_utils[OPTIONS]ROOT_DIRReplaceROOT_DIRwith the root directory where you want to search for virtual environments.Options:--delete-all: Delete venvs,__pycache__, andnode_modulesdirectories.--delete-venv: Delete virtual environments.--delete-pycache: Delete__pycache__directories (confirmed automatically).--delete-node: Deletenode_modulesdirectories.-y: Auto-confirm all deletion prompts.--debug: Enable debug mode for additional logging.Python APIYou can also useenv_cleanup_utilsprogrammatically in your Python code. Import the necessary functions and classes from the package and call them as needed.Example:fromenv_cleanup_utilsimport(find_venv_dirs,find_pycache_dirs,find_node_modules_dirs,save_requirements,delete_venv,delete_pycache,delete_node_modules,)# Use the functions and classes as needed.Sample Usage# Example command line usage:python-menv_cleanup_utils./my_project_directory--delete-venv--debug# Example Python API usage:fromenv_cleanup_utilsimport(find_venv_dirs,save_requirements,delete_venv,)root_dir="./my_project_directory"venv_dirs=find_venv_dirs(root_dir)forvenv_dirinvenv_dirs:save_requirements(venv_dir)delete_venv(venv_dir)ContributingIf you would like to contribute to the development of theenv_cleanup_utilspackage by adding more functionality, you are welcome to open a pull request.ReferencesGithub repositoryPyPI packagePlease ensure you have the required permissions before running the tool, and use it responsibly. This package is provided as-is, without any warranty or guarantee.
Package: env-cmd
A simple wrapper for executing virtualenv commands and passing them environment variables via a config file.Use caseLet’s say you deploy a Django site named “example.com”. You follow all
the best practices and deploy it as a Python package, installed in an
isolated virtualenv at/usr/share/python/example-com(asdh_virtualenvwould do).Configuration is read from environment variables in the Django settings.When you want to run a Django management command on your server, you would
type:ENV_VAR_1=value ENV_VAR_2=other … /usr/share/python/example-com/bin/django-admin <command>You could useenvdiror bash’ssourcecommand to expose your environment variables, butEnv-cmdeases
that further. It allows you to read a configuration file, expose values in
the environment and run a command simply by adding a setuptools entry point
in yoursetup.py. With the entry point symlinked to/usr/bin, your
command becomes:example-com django-admin <command>Env-cmd:Reads a configuration file using the default location provided, or an
override.Exposes configuration values as environment variables.Resolves the path of your virtualenv.Shells out to the virtualenv command.Installationpip install env-cmdUsageIn<yourproject>/cli.py:importenv_cmdread_environ=env_cmd.read_environ('PRCONFIG',# name of the env var that allows overriding of the# config path.'/etc/yourproject.conf',# default config path.{'SOME_ENV_VARIABLE':'DEFAULT_VALUE',# Some default environment'OTHER_VARIABLE':'OTHER VALUE'},# variables.)main=env_cmd.main(read_environ)In yoursetup.py:setup(…entry_points={'console_scripts':['yourproject=yourproject.cli:main']},)Then symlink/path/to/virtualenv/bin/yourprojectto/usr/bin/yourproject.You can run a command from your virtualenv with:yourproject <command>Override the default config path with:PRCONFIG=/path/to/config.conf yourproject <command>Configuration syntax is the following:KEY=value
OTHER=some other value
QUOTED="quotes are stripped."
ALSO='single quotes too'
WHITESPACE=    is stripped as well.
# comments work like this

# empty lines are skippedIf you run a web server withGunicorn, you can
use theon_reloadhook to read configuration on server reload, allowing
zero-downtime configuration updates:# gunicorn.conf.pyimportosfromyourprojectimportread_environdefon_reload(server):server.log.info("Reading environ")os.environ=read_environ()server.log.info(os.environ)
Package: env-colab-pass
Env-colab-passPython package that check for key value in env and colab userdata. If key is not found then it will asks for it using getpassIf Colab has key but access is not granted then it will ask for access and use it.UsageInstall packagepip install env-colab-passImport modulefrom env_colab_pass import passutilTo get the value of a env variable / colab user data / ask userpassutil.get_secret_value(key_name)Few more examples## Read env variable
key_name = "TEMP"
value = passutil.get_secret_value(key_name)
print(f"The value for {key_name} is: {value}")

## Read from keylab userdata
key_name = "KEY_FROM_COLAB"
value = passutil.get_secret_value(key_name)
print(f"The value for {key_name} is: {value}")

## ask for value for new key
key_name = "NEW_KEY"
value = passutil.get_secret_value(key_name)
print(f"The value for {key_name} is: {value}")
Package: env-color-logger
env_color_loggerA simple logger that prints colored messages to the console and uses environment variables to control the basic setup.Seeexample.envfor a list of environment variables that can be used to control the logger.Installpipinstall--upgradeenv_color_loggerUsageThe usage in Python is very basic. Just import the logger and use it as you would use the standardloggingmodule. The logger will automatically use the environment variables to configure itself. This is done to aid in development of apps that are run in isolated environments, such as Docker containers.fromenv_color_loggerimportEnvLoggerlogger=EnvLogger(__name__)logger.info("Hello World!")RequirementsTested with & designed for python 3.10, seerequirements.txtfor additional dependenciesContributingFor bugs / feature requests please submitissuesIf you would like to contribute to this project, you are welcome
tosubmit a pull requestWarranty / Liability / Official supportThis project is being developed independently, we provide the
package "as-is" without any implied warranty or liability, usage is your own responsibilityAdditional infoJust because I like badges
Package: envconfig
A module for reading configuration values from the OS environment variables.Compared to using straight os.getenv() this module provides a view
convenience functions, for example, for parsing booleans.I was not happy with using straight os.getenv() because we’ve had a
number of errors that were related to missing config values in .env
files. This module should help with that by providing a clean way for
accessing config variables.Usage$pipinstallenvconfigimportenvconfigboolopt=envconfig.bool("BOOL_OPTION")intopt=envconfig.int("INTEGER_OPTION")stropt=envconfig.int("STRING_OPTION")listopt=envconfig.list("LIST_OPTION")dictopt=envconfig.dict("DICT_OPTION")MetaDaniel Bader –@dbader_org–mail@dbader.orgDistributed under the MIT license. SeeLICENSE.txtfor more information.https://github.com/dbader/envconfigHistory0.2.1 (2021-07-23)envconfig.list(): return [] if env var is emptyenvconfig.dict(): return {} if env var is empty0.2.0 (2021-07-23)Add envconfig.dict()0.1.0 (2013-05-27)Initial release
Package: env-credentials
Env CredentialsManage environment variables use the dotenv pattern with encrypted files.This project is an attempted port of thecredentials patternfound in Ruby on Rails.InstallationUsing pip:pipinstallenv-credentials[django]Using poetry:poetryaddenv-credentials[django]UsageInitializing and editing the encrypted credentials file is only supported with Django at this time. Additional CLI
tooling can be built for framework-less projects or projects using other frameworks.DjangoAfter adding the dependency to your project, add the Django appINSTALLED_APPS=[# ...'django_credentials',# ...]You can then initialize the credentials files with./manage.pyinit_credentialsThis will create a two new files calledmaster.keyandcredentials.env.encin your root folder. If a.gitignorefile exists in the same directory, it will also addmaster.keyto it.Be sure to ignore your master.key file if the gitignore file cannot be automatically updated.You can then edit the values in the file using./manage.pyedit_credentialsBe sure that your$EDITORenvironment variable is set, as that is what the decrypted file will be opened with.Finally, to load the values into your environment, you should add the following code to yourwsgi.pyandmanage.pyfilesfromenv_credentials.credentialsimportCredentialsCredentials().load()
Package: envdataclass
envdataclassParses .env files against dataclass based schema validationpip install envdataclassSupported schema typesintstrList[int]boolExample usage (short and sweet)fromdataclassesimportdataclassfromtypingimportListfromenvdataclassimportfrom_string@dataclassclassmy_cool_config_schema:test_list_int:List[int]foo=from_string(my_cool_config_schema,'test_list_int=1,2,3,5')print(foo)print(type(foo.test_list_int))print(type(foo.test_list_int[1]))Output:my_cool_config_schema(test_list_int=[1,2,3,5])<class'list'><class'int'>Example usage (longer version)Define a data class for your config schema:@dataclassclassmy_cool_config_schema:test_list_int:List[int]test_int:inttest_string:str='123'test_bool:bool=Falsetest_string_d:str='hello'test_int_d:int=1234test_bool_d:bool=FalseThe variables without a default value assigned will be assumed to be required. This means an exception will be thrown when
any number of required variables are not present or are invalid in the environment file.Example:TypeError: __init__() missing 1 required positional argument: 'test_int'Setup a.envfile:test_string_d=hellofromtheotherside
test_int=98766
test_bool_d=true
test_list_int=123,456,123Load it:foo=from_file(my_cool_config_schema,'/path/.env')Result:lol(test_list_int=[123,456,123],test_int=98766,test_string='123',test_bool=False,test_string_d='hellofromtheotherside',test_int_d=1234,test_bool_d=True)test_list_intgot parsed from astrequal to'123,456,123'to aListequal to[123, 456, 123]test_bool_dgot parsed fromstrequal to'true'toTrue