This package provides cross-platform cross-python shutil.which functionality.
Python PowerShell Batchfile Makefile
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
appveyor
.editorconfig
.gitignore
.travis.yml
AUTHORS.rst
CONTRIBUTING.rst
HISTORY.rst
LICENSE
MANIFEST.in
Makefile Create the project Sep 10, 2015
README.rst
appveyor.yml
requirements-dev.txt
setup.cfg
setup.py
test_whichcraft.py
tox.ini
whichcraft.py

README.rst

whichcraft

https://travis-ci.org/pydanny/whichcraft.svg?branch=master http://codecov.io/github/pydanny/whichcraft/coverage.svg?branch=master https://ci.appveyor.com/api/projects/status/v9coijayykhkeu4d?svg=true Code style: black
That code in my care
That sly command-line stare
That strips my operating system bare
It's whichcraft

This package provides cross-platform cross-python shutil.which functionality.

Usage

On Linux, Mac, Windows for Python 2.7 or any of the maintained 3s:

>>> from whichcraft import which
>>> which('date')
'/bin/date'
>>> which('calendar')
'/bin/calendar'
>>> which('cookiecutter')
'/Users/pydanny/.envs/fun/bin/cookiecutter'
>>> which('a-made-up-name') is None
True

Notes

This is a shim of the shutil.which function that's designed to work across multiple versions of Python and inside of windows. The code for Python 2.x is based on Python 3 code that I extracted from source. I originally did this for Cookiecutter but pulled it out in order to reduce line count for that project.