Skip to main content
https://badge.fury.io/py/whichcraft.svg https://travis-ci.org/pydanny/whichcraft.svg?branch=master https://codecov.io/gh/pydanny/whichcraft/branch/master/graph/badge.svg 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.

Edgecase: Date function works perfectly on mac os and linux system, hence returns string. But is an in-built function in windows hence returns none as value when called in windows.

Sponsor

This work is sponsored by BriteCore, which does awesome things with Python, Django, JavaScript, and AWS. Apply for a job if you’re interested!

Code style: black

History

0.6.1 (2019-09-06)

  • Fix versioning issue

0.6.0 (2019-07-12)

  • Remove lingering unicode issues

  • Add BriteCore as a sponsor

0.5.3 (2018-10-10)

  • Add BriteCore as a sponsor

0.5.2 (2018-10-09)

  • Remove any mention of 3.2 and 3.3

0.5.1 (2018-10-09)

  • Fix setup.py so it works with older Python

0.5.0 (2018-10-09)

  • Add 3.7 support thanks to @rooterkyberian

  • Remove any mention of 2.6

0.4.2 (2018-04-16)

  • Use black for code formatting

  • Move status to production/stable

  • Drop Python 2.6 and 3.3 support

0.4.1 (2017-04-25)

  • Added tests to support Python 3.6

0.3.1 (2016-05-10)

  • Now testing for which directly, so we can support versions of Python 3 before 3.3 (@nickcoghlan)

0.3.1 (2016-04-24)

  • Correcting version in whichcraft.py

0.3.0 (2016-04-24)

  • Include tests in release source tarball (@Edwardbetts)

0.2.0 (2016-04-23)

  • Python 3.5 compatability

0.1.1 (2015-09-09)

  • Added lyrics

0.1.0 (2015-09-09)

  • First release on PyPI.

Release files for whichcraft 0.6.1

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

Source distribution (sdist)

Source distribution for whichcraft 0.6.1
File Size Uploaded
whichcraft-0.6.1.tar.gz 6.9 kB Details

Built distribution (wheel)

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

Total release size: 12.1 kB

Release files / whichcraft-0.6.1.tar.gz

Download URL whichcraft-0.6.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
acdbb91b63d6a15efbd6430d1d7b2d36e44a71697e93e19b7ded477afd9fce87
BLAKE2b-256 checksum
How to use checksums
67f5546c1494f1f8f004de512b5c9c89a8b7afb1d030c9307dd65df48e5772a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / whichcraft-0.6.1-py2.py3-none-any.whl

Download URL whichcraft-0.6.1-py2.py3-none-any.whl
Size 5.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
deda9266fbb22b8c64fd3ee45c050d61139cd87419765f588e37c8d23e236dd9
BLAKE2b-256 checksum
How to use checksums
b5a281887a0dae2e4d2adc70d9a3557fdda969f863ced51cd3c47b587d25bce5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.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