Skip to main content

Parse Python files and look for required environment variables

Project description

This is a small program which tries to guess what environment variables will be needed by other Python programs.

Build Status PyPI version

This tool should work on Python 2.7 and Python 3.3+


guessenv [-h] [-v] [-q] [-O] [-A] [-x EXCLUDE] [-X] files [files ...]

By default, guessenv will walk through all the files and directories specified on the command line, look for patterns which seem to be searching for an environment variable, and print out all of the "required" environment variables (those accessed through something akin to os.environ[...]).

If invoked with the -O argument, it will also print out optional environment variables (accessed through os.getenv(...) or os.environ.get(...).

If invoked with the -A argument, it will exit non-zero if any "required" environment variables are not currently present in the environment.

If invoked with the -v argument, it will print more verbose information about where variables were found.

If invoked with the -q argument, it will print nothing (unless -A is also passed and any variables are missing)

The -x and -X arguments allow you to exclude files or directories when doing recursive searches.


This work is licensed under the ISC license, a copy of which can be found in LICENSE.txt.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
guessenv-0.2-py2-none-any.whl (5.1 kB) Copy SHA256 hash SHA256 Wheel py2
guessenv-0.2-py3-none-any.whl (5.1 kB) Copy SHA256 hash SHA256 Wheel py3
guessenv-0.2.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page