Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Simple module for easily isolating temporary file I/O

Project Description

A simple module for easily isolating temporary file I/O to a directory. Ever developed a command-line tool which required a lot of file manipulation? Caching, perhaps? You don’t want to use the cwd and keeping all of your paths straight if you’re working outside of it can be a pain. This tool may be the pain-reliever you need!

A tale of sin and woe

Well, not really. I’ve just developed a bunch of tools that rely on various bits of temporary or isolated file I/O, and found myself implementing this pattern over and over again. Eventually, I got tired of doing it and decided to develop this handy module. Now I’m passing the savings on to you!


As far as I know, workdir is compatible with every version of Python from 2.6 through 3.5. It should also be compatible with all major platforms including Linux, OSX, and Windows. If not, let me know!


pip install workdir


Use it as a staging area for downloaded archives:

import workdir
import shutil
workdir.options.path = '~/.myfilecache'
with workdir.as_cwd():
    unpack_archive('somefile', 'somedir')
shutil.copy(workdir.path_to_file('somedir', 'unpackedfilefromarchive'),
            os.path.join('otherdir', 'unpackedfilefromarchive'))

Use it as a working directory in your git repo (added to .gitignore, of course):

import workdir
workdir.options.path = ''
with workdir.as_cwd():
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
workdir-0.3.5-py2.py3-none-any.whl (3.9 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel May 17, 2016
workdir-0.3.5.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 Source May 17, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting