Skip to main content

Zeroncy

A simple python tool to make your projet more decoupled.

Just put your project variables on a config file instead store in encironment variable. You can use a .env for json file...

PyPI version Coverage Tests Code style: black License: GPL v2

Installing

pip install zeroncy

How to Use

  1. Using .env file
  • create a .env file in project root and set variables...

    DATABASE_URL=postgres://user:pwd@localhost:5432/psql
    ALLOWED_HOSTS=localhost, 127.0.0.0.1
    PORT=5000
    
  • Then you could use your variables on your settings module...

    >>> import zeroncy
    
    >>> zeroncy.config()
    
    >>> zeroncy.get("DATABASE_URL")
    'postgres://user:pwd@localhost:5432/psql'
    
    # If you want a diferent type you can pass the cast parameter
    
    >>> zeroncy.get("PORT", cast=int)
    5000
    
    # If your var has more than one value, you must set the many parameter to true...
    
    >>> zeroncy.get("ALLOWED_HOSTS", many=True)
    ['localhost', '127.0.0.0.1']
    
  1. Using .env.json file
  • Create a .env.json file on project root:

    {
        "DATABASE_URL": "postgres://user:pwd@localhost:5432/psql",
        "ALLOWED_HOSTS": "localhost, 127.0.0.0.1",
        "PORT": 5000
    }
    
  • Then you could use on a similar way as the previous

    >>> import zeroncy
    
    >>> zeroncy.config(dict) # passes dict as parameter
    
    >>> zeroncy.get("DATABASE_URL")
    'postgres://user:pwd@localhost:5432/psql'
    
    >>> zeroncy.get("PORT")
    5000
    
    >>> zeroncy.get("ALLOWED_HOSTS", many=True)
    ['localhost', '127.0.0.0.1']
    
    # Note that on Json config you don't need to passes cast parameter for other types (Integer in this example)
    

References


LICENSE

                GNU GENERAL PUBLIC LICENSE
                   Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. https://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Metadata

Release files for zeroncy 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zeroncy 1.0.2
File Size Uploaded Provenance Actions
zeroncy-1.0.2.tar.gz 19.5 kB Without provenance Details for zeroncy-1.0.2.tar.gz

Release files / zeroncy-1.0.2.tar.gz

Download URL zeroncy-1.0.2.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0ff110ee3de2d9cb683f17b5d019b5cf921651482935c8a3ed30e904f132f683
BLAKE2b-256 checksum
How to use checksums
610ae98844dd1659064a44c3df9d5e3d8f91fe8e4004e29a90691d1b35812bf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.6

Security for zeroncy 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page