Saravanan666/pypi-org huggingface dataset:
Package: environ-config
environ-config: Application Configuration With Env Variablesenviron-configallows you to configure your applications using environment variables – as recommended inThe Twelve-Factor Appmethodology – with elegant, boilerplate-free, and declarative code:>>>importenviron>>># Extracts secrets from Vault-via-envconsul: 'secret/your-app':>>>vault=environ.secrets.VaultEnvSecrets(vault_prefix="SECRET_YOUR_APP")>>>@environ.config(prefix="APP")...classAppConfig:...@environ.config...classDB:...name=environ.var("default_db")...host=environ.var("default.host")...port=environ.var(5432,converter=int)# Use attrs's converters and validators!...user=environ.var("default_user")...password=vault.secret()......env=environ.var()...lang=environ.var(name="LANG")# It's possible to overwrite the names of variables....db=environ.group(DB)...awesome=environ.bool_var()>>>cfg=environ.to_config(...AppConfig,...environ={..."APP_ENV":"dev",..."APP_DB_HOST":"localhost",..."LANG":"C",..."APP_AWESOME":"yes",# true and 1 work too, everything else is False...# Vault-via-envconsul-style var name:..."SECRET_YOUR_APP_DB_PASSWORD":"s3kr3t",...})# Uses os.environ by default.>>>cfgAppConfig(env='dev', lang='C', db=AppConfig.DB(name='default_db', host='localhost', port=5432, user='default_user', password=<SECRET>), awesome=True)>>>cfg.db.password's3kr3t'AppConfig.from_environ({...})is equivalent to the code above, depending on your taste.FeaturesDeclarative & boilerplate-free.Nested configuration from flat environment variable names.Default & mandatory values: enforce configuration structure without writing a line of code.Built on top ofattrswhich gives you data validation and conversion for free.Pluggable secrets extraction.
Ships with:HashiCorp Vaultsupport viaenvconsul.AWS Secrets Manager(needsboto3)INI files, because secrets in env variables are icky.Helpful debug logging that will tell you which variables are present and whatenviron-configis looking for.Built-in dynamic help documentation generation.You can find the full documentation including a step-by-step tutorial onRead the Docs.Project Informationenviron-configis maintained byHynek Schlawackand is released under theApache License 2.0license.
It targets Python 3.7 and newer, and PyPy.
Development takes place onGitHub.The development is kindly supported byVariomedia AG.environ-configwouldn't be possible without theattrsproject.environ-configfor EnterpriseAvailable as part of the Tidelift Subscription.The maintainers ofstructlogand thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.Learn more.Release InformationFixedType hints forenviron.config()now allow for arguments (e.g.@environ.config(prefix="")).#56Full Changelog
Package: environ-import
Environ ImportEnviron Import is a python package that allows you to import environment variables from itsenvironandenvnullmodules which are dynamically typed from.envfiles.QuickstartInstall using pippip install environ-importOnce installed, you can import environment variables from theenvironmodule.fromenvironimportPATHprint(PATH)# orimportenvironprint(environ.PATH)Environ Import automatically loads.envfiles usingpython-dotenv.Import from theenvnullmodule to avoid raisingAttributeErrorwhen importing an undefined environment variable.Dynamic TypingThestub filegenerator is automatically run when theenvironorenvnullmodules are imported. Types are generated based on the variables found in.envand.env.examplefiles.If you would like type hints to be availabe as soon a change has been made to a.envfile, Environ Import provides a watchdog to automatically regenerate stub files when a change is detected.python -m environ-import
Package: environize
Environize enables environment and state savvy DataMigration tools for DjangoDecoratorsadds a pair of decorators (only_inandexcept_in) for use with themigrations.RunPythonmethod.use django’s DataMigrations to allow dev data and prod data to be different.exclude large data creation migrations from tests which may define their own data.Command(s)adds aloaddatamethod that loads JSON fixtures into the database based on the state of the migration.different from./manage.py loaddataorcall_command("loaddata"), which both load fixtures to the database based on the current state of models.no more updating fixtures to keep them current. The data model in the fixture is tied to the state of your models in the migration.Decorators - UsageExclude Testsfromdjango.dbimportmigrationsimportenvironize# runs in every env except testing@environize.except_in(envs=["test"])defexcept_test_data(apps,schema_editor):Ham=apps.get_model("app","Ham")Ham.objects.create(name="not-test")@environize.except_in(envs=["test"])defremove_hams(apps,schema_editor):Ham=apps.get_model("app","Ham")Ham.objects.all().delete()classMigration(migrations.Migration):dependencies=[('app','0002_auto_20180916_1122'),]operations=[migrations.RunPython(except_test_data,remove_hams)]Production Only Datafromdjango.dbimportmigrationsimportenvironize# runs in every env except testing@environize.only_in(envs=["production"])defadd_prod_data(apps,schema_editor):Ham=apps.get_model("app","Ham")Ham.objects.create(name="not-test")@environize.only_in(envs=["production"])defremove_hams(apps,schema_editor):Ham=apps.get_model("app","Ham")Ham.objects.all().delete()classMigration(migrations.Migration):dependencies=[('app','0002_auto_20180916_1122'),]operations=[migrations.RunPython(add_prod_data,remove_hams)]Commands - Usageimportosfromdjango.dbimportmigrationsimportenvironizePATH='path/to/fixtures/'defload_fixture(apps,schema_editor):fixture_file=os.path.join(PATH,'myfixture.json')environize.loaddata(apps,fixture_file)classMigration(migrations.Migration):dependencies=[('app','0003_auto_20180916_1122'),]operations=[migrations.RunPython(load_fixture,lambdax,y:None)]Feature SupportEnvironize officially supports:Python 2.7 on Django 1.11 LTSPython 3.5+ on Django 2+InstallationTo install Environize, usepipenv(or pip, of course):$pipenvinstallenvironizeInside various settings files set an ENVIRONMENT variable.# /settings_production.pyENVIRONMENT='production'# /settings_qa.pyENVIRONMENT='qa'# /settings_dev.pyENVIRONMENT='dev'The default env keys are listed below but can be overridden by setting ENVIRONIZE_ENVS in your django settings:# these are the default env keysENVIRONIZE_ENVS=("dev","test","ci","qa","staging","production")# by default this key will be used if one is not set in a settings file.DEFAULT_ENV="dev"DocumentationTBDHow to ContributeCheck for open issues or open a fresh issue to start a discussion around a feature idea or a bug.Forkthe repositoryon GitHub to start making your changes to themasterbranch (or branch off of it).Write a test which shows that the bug was fixed or that the feature works as expected.Send a pull request. Make sure to add yourself toAUTHORS.
Package: environ-loader
Environ LoaderA module for loading environment variables from various sources, like Windows .bat files and Bash .sh files.Sometimes when writing a Python script, you want to load environment variables are defined in a text file. For example, when running Conan with the virtualenv generator,
Conan will generate shell files for Windows and Linux that contain variables like PATH that are configured to use the library/tool. So, if you are installing
a tool that the script uses with Conan, then you will have to load the environment variables before calling the tool. This is actually the original motivation
for the module.It is not very sophisticated yet, only simple variable declarations are supported right now (for examples, Bash's $VAR style variable expansion is not supported, only ${VAR}).FeaturesTODORequirementsTODOInstallationYou can installEnviron Loadervia [pip] from [PyPI]:$pipinstallenviron-loaderLicenseDistributed under the terms of the [MIT license][license],Environ Loaderis free and open source software.
Package: environmental
Map a python configuration from environment variables.Overviewenvironmentalallows you to map class properties to environment variables.By usingenvironmentalyou can keep your configuration in a single class your IDE understands and have convenient
and safe type conversions between the strings stored in your environment and python types.The created properties are also writable so if you assign to them they will change on your environment and will be
available to your child processes.Installation$sudopip3install--upgradeenvironmentalExampleimportenvironmentalimportosclassConfiguration:port=environmental.Int('MY_APPLICATION_HTTP_PORT',80)name=environmental.Str('MY_APPLICATION_NAME','Name')config=Configuration()config.port=8080assertos.environ['MY_APPLICATION_HTTP_PORT']=='8080'assertisinstance(os.environ['MY_APPLICATION_HTTP_PORT'],str)assertconfig.port==8080assertisinstance(config.port,int)CaveatsModifying mutable objects in the configuration (like lists) will not work:importos,environmentalclassConfiguration:list=environmental.List('LIST')os.environ['LIST']="[]"assertconfig.list==[]config.list.append('test')assertconfig.list==[]But doing something that reassigns the variable will:config.list+=['test']assertconfig.list==['test']LicenseCopyright 2015 Zalando SELicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package: environmentalist
# Environmentalist - use API secrets easilyEnvironmentalist helps API users to retrive API secrets from the environmenteasily.## The problemI'm tired of rewriting the following code over and over again to get my app keyfrom the environment variables.```pythonimport osfrom requests_oauthlib import OAuth1Sessionapi = OAuth1Session(client_key=os.environ.get('TWITTER_CLIENT_KEY'),client_secret=os.environ.get('TWITTER_CLIENT_SECRET'),resource_owner_token=os.environ.get('TWITTER_RESOURCE_OWNER_TOKEN'),resource_owner_secret=os.environ.get('TWITTER_RESOURCE_OWNER_SECRET'))```## Project dependencies1. N/A## UsageUse an instance to easily create your API instance, for example:```bash# Create environment variables with the same prefixset TWITTER_CLIENT_KEY=xxxset TWITTER_CLIENT_SECRET=xxxset TWITTER_RESOURCE_OWNER_TOKEN=xxxset TWITTER_RESOURCE_OWNER_SECRET=xxx``````pythonfrom environmentalist import Eapi = OAuth1Session(**E(prefix='TWITTER'))api.get('https://api.twitter.com/1.1/statuses/home_timeline.json')```When you create the `E` instance, it filter and strips the prefix out of theenvironment variables.Or you can dump all the environment variables for no reason:```pythonprint(E())# {'HOME': '...', ...}```
Package: environment-backups
Environment backupsCLI Application to back up environment variables.Documentation:https://luiscberrocal.github.io/environment-backupsGitHub:https://github.com/luiscberrocal/environment-backupsPyPI:https://pypi.org/project/environment-backups/Free software: MITInstallationpipintallenvironment-backupsConfigurationenvironment-backupsconfiginitExamplesFeaturesTODOCreditsThis package was created withCookiecutterand thewaynerv/cookiecutter-pypackageproject template.
Package: environment-extractor
Utility to create an environment.yml file from imports.Example:$ environment_extractor --dir C:\Users\user\Documents\project --ignored_libs "twine lightgbm" --name new_env --channels "pytorch defaults" --extra_libs "fiona geopandas"Installation:$ git clone https://github.com/Joshua-Brooke/Environment_extractor
$ cd environment_extractor
$ pip install .
or
$ pip install environment_extractor
Package: environment-file
Package information for the Environment File module.Home-page: https://github.com/gunthercox/environment-fileAuthor: Gunther CoxAuthor-email: gunthercx@gmail.comLicense: MITDownload-URL: https://github.com/gunthercox/environment-file/tarball/1.0.0Description:Environment File================Platform: anyClassifier: Development Status :: 4 - BetaClassifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: MIT LicenseClassifier: Environment :: Web EnvironmentClassifier: Operating System :: OS IndependentClassifier: Topic :: Software Development :: Libraries :: Python PACKAGEsClassifier: Topic :: InternetClassifier: Programming Language :: PythonClassifier: Programming Language :: Python :: 3Classifier: Programming Language :: Python :: 3.4Classifier: Programming Language :: Python :: 3.5
Package: environmentinator
EnvironmentinatorPython library to ensure the runtime executing your code meets application requirements.Capabilities include:Ensure a python runtime version is>or<Major.Minor version requirements (eg "only let this tool run on python3.10+")Ensurepippackages are installed, installing them to a.pyenvfolder if they do not exist on the hostExample usage# We do not assume environmentinator has been installed,# so we have one prelude to pip install ittry:importenvironmentinatorexcept:importpippip.main(['install','--user','environmentinator'])importenvironmentinator# First arg is comparison expression; eg '==3.10', '<3.7', '>=3.8'# Second argument is an optional list of alternative folders to# search for python runtimes that could match the requested version,# if the current one does not match.environmentinator.ensure_py_version('>3.8',)# If json5 exists in `.pyenv` great, if not use pip to install with `--target=.pyenv`json5=environmentinator.ensure_module('json5')Generating Library Docspythongen_docs.pyPublishing NotesHATCH_INDEX_USER='__token__'HATCH_INDEX_AUTH=$(cat/path/to/my/pypi-token.txt)pythonpublish.pyExamplesSee./examples/for all examples.example_01.py
Package: environment-mlflow-client
Environment MLFlow ClientHere we extend on the standard MLFlow client to manage different environments with the same MLFlow instance, which mainly involves the model registry and experiment management.
Our goal is to run multiple logical environments (acc, preprod, prod) in the same databricks workspace with proper permission controls. We wrote a blog about the combination of our MLFlow client and the basic permission structure that is available with the terraform Databricks provider.Featuresabstraction for environment scoped model nameshelper function for logging a model and registering a model versionautomatic model stage assignment based on the environmentabstraction for environment scoped experiment foldersmethods for common usage patterns (f.i. load latest model version of any model flavor)Usagepypi repository:https://pypi.org/project/environment-mlflow-client/>>pip install environment-mlflow-clientPython:from environment_mlflow_client import EnvMlflowClient

model_name = "deepar"

mlflow_client = EnvMlflowClient(env_name="test")

model_versions = mlflow_client.get_latest_versions(name=model_name)CompatibilityCompatible with MLFlow 2.x.Unit testsA fixture is included that starts a local MLFlow instance and cleans it up after the testing session is finished.
The unit tests are thus conducted against the MLFlow API to validate our client.PipelineGithub actions are triggered on pull requests to validate the code change against the unit tests.
When a commit is tagged on main a Python wheel is build and published to pypi and github releases.
Package: environment-parser
Environment-ParserA lightweight python library to parse environment variables from current shell or .env files.InstallationUsageCreate a new environment parser from shell context.from environment import Environment, SHELL
env = Environment(sources=[SHELL])You can also create a new environment parser from variables starting with a given prefix.
For example, to find all variables starting withXDG_, you could use the code below...xdgenv = env.extract_child_from_prefix('XDG_', remove_prefix=True)
print(xdgenv)... and this will output something like the following :CONFIG_DIRS                   /etc/xdg/xdg-budgie-desktop:/etc/xdg
SESSION_PATH                  /org/freedesktop/DisplayManager/Session0
MENU_PREFIX                   gnome-              
SESSION_DESKTOP               budgie-desktop      
SESSION_TYPE                  x11                 
GREETER_DATA_DIR              /var/lib/lightdm-data/sylvan
Package: environment-settings
Environment SettingsTheenvironment_settingspackage allows applications to manage multiple runtime environment configurations
in a central location using settings stored as normal python modules. Inspired by the [Django settings framework]
(https://docs.djangoproject.com/en/dev/ref/settings/), the settings are loaded dynamically using a
context manager at the application entry point. Additionally, the environment_settings module provides a decorator
that can be used to load the correct settings for automated tests.UsageThe following guide shows a typical application structure with support for multiple environment configurations.
Theconfpackage contains configuration files for each environment.my-app
|--my_app
|  |--conf
|  |  |--__init__.py
|  |  |--dev.py
|  |  |--uat.py
|  |  |--unittest.py
|  |  `--prod.py
|  |--app.py
|  `--lib.py
|--tests
|  `--unittests
|     `--test_lib.py
|--pyproject.toml
|--README.md
`--setup.pySettings package configurationAdd the following code to the packge__init__.pyto mark it as "settings enabled"# my_app/conf/__init__.pyfromenvironment_settingsimportSettingssettings=Settings(package=__name__)Settings file layoutEach settings file are implemented as normal python modules. Settings should be UPPERCASE as per the example below. Any
other python code will not be visible in the settings context.# my_app/conf/dev.pyGOOD_SETTING_EXAMPLE='I am visible'bad_setting_example='I am not visible'Initialising the settings context at the application entry pointBefore any setting can be used, the settings context needs to be activated. Failure to active the context
will result in anImproperlyConfiguredexception# my_app/app.pyfrommy_app.confimportsettingswithsettings.environment('dev'):print(settings.GOOD_SETTINGS_EXAMPLE)# Out[0]:# I am visibleprint(settings.GOOD_SETTINGS_EXAMPLE)# Out[1]:# Traceback (most recent call last):# ...# ImproperlyConfigured: Requested GOOD_SETTINGS_EXAMPLE, but settings are not configured. You must define the settings.environment(name)Using settings throughout the applicationThe centralised settings object can be imported anywhere throughout the application:# my_app/lib.pyfrommy_app.confimportsettingsdefmy_func():returnsettings.GOOD_SETTINGS_EXAMPLETestingenvironment_settingsalso provides a decorator that can be used to provide test specific settings in test cases:# my_app/conf/unittest.pyGOOD_SETTINGS_EXAMPLE='unittest example'# tests/unittests/test_lib.pyfrommy_app.confimportsettingsfrommy_appimportlib@settings.environment('unittest')classTestLib:deftest_lib(self):assertlib.my_func()=='unittest example'
Package: environments-utils
Environment UtilsUtilities to identify the environment in which your Python script is running.This includes determining whether you are in aJupyter Notebook, within a node of aSLURMcluster, the architecture of the system you are using, and the operating system.InstallationInstallenvironments_utilsfromPyPi:pipinstallenvironments_utilsExamplesDetect Rosetta on macOS with PythonRosettais a translation environment that enables you to run apps that contain x86_64 instructions on Apple silicon. In some cases, Rosetta may fail to translate an app successfully, and lead to crashes or other unexpected behavior. It is sometimes therefore useful to know whether the script is running within a macOS with Rosetta so to better understand whether the odd behaviour you may be experiencing is due to Rosetta or not.To detect Rosetta, simply run:fromenvironments_utilsimportis_macos_rosettaifis_macos_rosetta():print("I am running inside Rosetta!")is_tmuxReturn a boolean representing if the script is running within a TMUX-like terminal.fromenvironments_utilsimportis_tmuxifnotis_tmux():print("This script is long-running; consider starting it within a TMUX-like terminal.")is_notebookReturn a boolean representing if the script is running within a Jupyter notebook.fromenvironments_utilsimportis_notebookfromtqdmimporttqdm_notebook,tqdmastqdm_clitqdm=tqdm_notebookifis_notebook()elsetqdm_cliis_slurm_nodeReturns whether you are in aSLURMcluster node.fromenvironments_utilsimport(is_slurm_node,get_slurm_node_id,get_number_of_available_slurm_nodes)ifis_slurm_node():print("YAY! I'm in node{}of{}!".format(get_slurm_node_id(),get_number_of_available_slurm_nodes()))Operating System IdentifiersUtilities to identify the operating system running the app.fromenvironments_utilsimportis_macos,is_windows,is_linux,is_macos_with_armifis_macos():print("The OS is macOS")ifis_windows():print("The OS is Windows")ifis_linux():print("The OS is Linux")ifis_macos_with_arm():print("The machine is macOS with ARM processors like M1")Architecture IdentifiersUtilities to identify the architectures running the app.fromenvironments_utilsimportis_x86,is_x86_64,is_armifis_x86():print("This is a 32-bit system with x86 architecture.")ifis_x86_64():print("This is a 64-bit system with x86_64 architecture.")ifis_arm():print("This is an ARM machine, such as Mac M1")Internet ConnectionUtility to detect whether the user is connected to the internet.fromenvironments_utilsimportis_onlineifis_online():print("You are online.")else:print("You are offline")