New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

environconfig

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

environconfig

Application configuration from environment variables made easy

  • 1.7.0
  • PyPI
  • Socket score

Maintainers
1

environconfig

.. image:: https://img.shields.io/pypi/v/environconfig.svg :target: https://pypi.python.org/pypi/environconfig

.. image:: https://img.shields.io/pypi/pyversions/environconfig.svg :target: https://pypi.python.org/pypi/environconfig

.. image:: https://travis-ci.org/buguroo/environconfig.svg?branch=master :target: https://travis-ci.org/buguroo/environconfig

environconfig allows you to use environment variables in Python with a declarative syntax.

A quick example:

.. code-block:: python

from environconfig import EnvironConfig
from environconfig import StringVar, IntVar

class DBCfg(EnvironConfig):
    """Database configuration from the environment."""
    HOSTNAME = StringVar(default='localhost')
    PORT = IntVar(default=3306)
    USERNAME = StringVar()
    PASSWORD = StringVar()
    CHARSET = StringVar(default='utf8mb4')
    NAME = StringVar(default='mydatabase')

# Now you can start using it
connection = pymysql.connect(host=DBCfg.HOSTNAME,
                             user=DBCfg.USERNAME,
                             password=DBCfg.PASSWORD,
                             db=DBCfg.NAME,
                             charset=DBCfg.CHARSET,
                             cursorclass=pymysql.cursors.DictCursor)

You can check more examples in the examples directory.

Features

  • Built-in basic types: String, Bool, Int, Float...
  • Easy Customizable: CustomVar (just pass a callable to make the conversion)
  • No mocking necessary for testing: Just instantiate your config with a dictionary.
  • Easy build complex constructions with environment data: See MethodVar

Collaboration

  • We are always open to pull requests and accept new var types.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc