Skip to main content

Standardized fencing off of python virtual environments on a per-project basis

Project description

Development Status Latest Version Downloads/month Supported Python versions Wheel Status

Standardized fencing off of python virtual environments on a per-project basis. The idea is to take a directory as an input and create and manage a python virtual environment in a known location.

Master on Linux

Travis-ci build status Coveralls coverage (from travis)

Master on Windows

Appveyor build status

How does it work?

fencepy is fairly simple. After parsing arguments, it calls out to the correct copy of virtualenv (based on the location of the running python interpreter) with a pre-generated base directory. Upon successful creation of the virtual environment, it applies various modifications based on the contents of the directory from which it was run.

Opinionated hooks

The goal is to make this framework attractive to users of other compatible products. For instance, as a user of git and sublime text, I added functionality related to those.

git

If the directory provided as input (defaults to cwd) is part of a git repository, the virtual environment created will be relative to the root of that repository.

sublime text

The sublime linter plugin is very easy to configure. Pointing it to a particular installation of python is as simple as putting some json into a configuration file. If there is a .sublime-project file in the input directory, then it will be configured to respect the virtual environment that is being created.

requirements.txt

As a helpful shortcut, if there is a requirements.txt file in the input directory, then those requirements will be installed upon virtualenv creation.

Usage

fencepy -c: Create a new virtual environment

. `fencepy -a`: Activate the virtual environment in a bash-like shell

source (fencepy -a): Activate the virtual environment in fish shell

. $(fencepy -a): Activate the virtual environment in windows powershell

fencepy -e: Remove the virtual environment

Additional notes

Python versions

Both python 2 and 3 are supported. Additionally, both can be used for one project, as they will be stored in separate directories.

Cross-platform support

Both Windows and UNIX shells are supported! I have not yet figured out how to activate in one command from within CMD.exe. If anyone knows the solution, please let me know!

Extending fencepy

Additional functionality should be very easy to implement. Each of the hooks mentioned above is implemented as a “plugin” that takes the full dict of parsed arguments as input. Additionally, inverse cleanup methods are planned for the future.

Alternatives

Project details


Download files

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

Source Distribution

fencepy-0.4.3.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distributions

fencepy-0.4.3-py3-none-any.whl (8.9 kB view hashes)

Uploaded Python 3

fencepy-0.4.3-py2-none-any.whl (8.9 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page