Skip to main content
https://img.shields.io/pypi/v/exec-wrappers.svg https://img.shields.io/pypi/pyversions/exec-wrappers.svg https://img.shields.io/pypi/l/exec-wrappers.svg See Build Status on Travis CI See Build Status on AppVeyor https://codecov.io/gh/gqmelo/exec-wrappers/branch/master/graph/badge.svg https://img.shields.io/badge/code%20style-black-000000.svg

A command line tool to create wrappers around executable files

Rationale

exec-wrappers is useful whenever you need a single executable file, but have to do some setup before executing it.

If you develop using some kind of environment isolation like conda, schroot, virtualenv you probably wanted to configure a GUI application like an IDE to use the executables available inside these environments.

But you normally have to create a script that do some setup/activation step and then run the command but creating such a script for each executable is tedious.

exec-wrappers helps automating that as it detects executable files and create a wrapper for each of them. It also already provides some wrappers for common tools.

Also, as the wrappers are intended to be used non-interactively, they are normally much simpler than the interactive counterpart.

For example, the conda wrappers are much faster than doing an activate and executing the command:

  • Regular activate:

$ echo 'source activate test 2> /dev/null; "$@"' > /tmp/activate-and-run && chmod a+x /tmp/activate-and-run
$ time /tmp/activate-and-run python --version
Python 2.7.11 :: Continuum Analytics, Inc.

real    0m0.354s
user    0m0.288s
sys 0m0.040s
  • Using python wrapper created by exec-wrappers:

$ time /tmp/conda_wrappers/python --version
Python 2.7.11 :: Continuum Analytics, Inc.

real    0m0.003s
user    0m0.000s
sys 0m0.000s

Having a low overhead is very important if you are executing the command non-interactively.

Features

  • automatically detect executables in a given directory

  • wrappers written in plain shell and batch scripts

  • low overhead (as low as possible)

  • built-in wrappers for common tools

Requirements

python is the only dependency to create wrappers. To properly use the generated wrappers you need the tool used by the wrapper (conda, schroot, etc.).

Installation

$ python setup.py install

How it works

Creating conda wrappers:

$ create-wrappers  -t conda --bin-dir ~/miniconda/envs/test/bin --dest-dir /tmp/conda_wrappers --conda-env-dir ~/miniconda/envs/test

This will create in /tmp/conda_wrappers a wrapper for each executable found in ~/miniconda/envs/test/bin. So if you run the python wrapper:

$ /tmp/conda_wrappers/python -c "import sys; print(sys.executable)"
/home/username/miniconda/envs/test/bin/python

It will actually activate the conda environment and set necessary variables, and then execute the real python interpreter. So you can use the wrapper to configure you IDE, for example.

Also a run-in script will be created, which you can use to run any arbitrary command:

$ /tmp/conda_wrappers/run-in bash -c 'echo $CONDA_DEFAULT_ENV'
/home/username/miniconda/envs/test

Examples

  • conda:

$ create-wrappers  -t conda -b ~/miniconda/envs/test/bin -d /tmp/conda_wrappers --conda-env-dir ~/miniconda/envs/test
  • virtualenv:

$ create-wrappers  -t virtualenv -b ~/python3-env/bin -d /tmp/virtualenv_wrappers --virtual-env-dir ~/python3-env
  • schroot:

$ create-wrappers  -t schroot -b ~/chroots/centos5/bin -d /tmp/schroot_wrappers --schroot-name centos5
$ create-wrappers  -t schroot -b ~/chroots/centos5/bin -d /tmp/schroot_wrappers --schroot-name centos5 --schroot-options="-p -d /"
  • custom:

$ echo -e '#!/bin/sh\necho "$@"' > /tmp/custom-script && chmod a+x /tmp/custom-script
$ create-wrappers  -t custom --custom-script=/tmp/custom-script -b /usr/bin -d /tmp/custom_wrappers
  • wrap only specified files:

$ create-wrappers  -t schroot -f gcc:gdb -d /tmp/schroot_wrappers --schroot-name centos5
  • chain multiple wrappers:

$ create-wrappers  -t conda -b ~/miniconda/envs/test/bin -d /tmp/conda_wrappers --conda-env-dir ~/miniconda/envs/test
$ create-wrappers  -t schroot -b /tmp/conda_wrappers -d /tmp/schroot_wrappers --schroot-name centos5

License

Distributed under the terms of the MIT license, exec-wrappers is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Release files for exec-wrappers 1.1.4

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

Source distribution (sdist)

Source distribution for exec-wrappers 1.1.4
File Size Uploaded
exec-wrappers-1.1.4.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for exec-wrappers 1.1.4
File Interpreter ABI Platform
exec_wrappers-1.1.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 18.8 kB

Release files / exec-wrappers-1.1.4.tar.gz

Download URL exec-wrappers-1.1.4.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d9c0aedec7cf14c4fc5d44deaa48ae35dfa8c5bc8b4a1bb58c4a7387f071fdb0
BLAKE2b-256 checksum
How to use checksums
fcded2b98c930387c4348017621290048e072fdc19997c387033c789eb437943
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.15

Release files / exec_wrappers-1.1.4-py2.py3-none-any.whl

Download URL exec_wrappers-1.1.4-py2.py3-none-any.whl
Size 9.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b457265eb858a70946b5d4e47caad5762eb1de0b6e67748bc661f67a4fd6a0fa
BLAKE2b-256 checksum
How to use checksums
7858e23e561a0b2bd7b9e67c2486b553e9150602ec53c0d90fc582bc543880cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.15

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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