workdir
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!
Compatibility
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!
Installation
pip install workdir
Examples
Use it as a staging area for downloaded archives:
import workdir
import shutil
workdir.options.path = '~/.myfilecache'
with workdir.as_cwd():
download_remote_archive('somefile')
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 = '.gitrepo.work'
workdir.sync()
with workdir.as_cwd():
futz_with_source_tree()
more_futzing()
Metadata
Release files for workdir 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| workdir-0.3.5.tar.gz | 3.7 kB | Without provenance | Details for workdir-0.3.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| workdir-0.3.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for workdir-0.3.5-py2.py3-none-any.whl |
Total release size: 7.6 kB
Release files / workdir-0.3.5.tar.gz
| Download URL | workdir-0.3.5.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5629ad5907932e349922c75d93c5a985438837bebc5447eafc5d27b4db187118
|
|
BLAKE2b-256 checksum How to use checksums |
91744f2fe2c850a5fb503f57a39f4254be4c71c950648050980d51d1ae72177f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / workdir-0.3.5-py2.py3-none-any.whl
| Download URL | workdir-0.3.5-py2.py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e92e13b6d91620139f7207ae867ad9537ade75dc09f642455ef55f97ac60f62a
|
|
BLAKE2b-256 checksum How to use checksums |
8e8fe6d551b9075c2cd4bfe499fe78d3a157059b4fb7970583102a23a026a3d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for workdir 0.3.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.