Description
tempdirs is a library which allows users to safely and cleanly create any number of temporary directories. Temporary directories are automatically deleted. It was created as a testing utility.
Installation
Install using pip:
pip install pyusps
or easy_install:
easy_install pyusps
Examples
You can tempdirs.makedirs as a decorator passing in the number of temporary directories needed:
import os
import tempdirs
@tempdirs.makedirs(2)
def test_foo(**kwargs):
(srcdir, dstdir) = kwargs['tempdirs_dirs']
srcfile = os.path.join(srcdir,'foo')
dstfile = os.path.join(dstdir,'bar')
with open(srcfile, 'w') as fp:
fp.write('src content\n')
with open(dstfile, 'w') as fp:
fp.write('dst content\n')
You can also use tempdirs.makedirs as a Context Manager:
import os
import tempdirs
with tempdirs.makedirs(2) as (srcdir, dstdir):
srcfile = os.path.join(srcdir,'foo')
dstfile = os.path.join(dstdir,'bar')
with open(srcfile, 'w') as fp:
fp.write('src content\n')
with open(dstfile, 'w') as fp:
fp.write('dst content\n')
Developing
External dependencies
python-dev
python-setuptools
python-virtualenv
Setup
To start developing run the following commands from the project’s base directory. You can download the source from https://github.com/thelinuxkid/tempdirs:
# I like to install the virtual environment in a hidden repo. virtualenv .virtual # I leave the magic to Ruby developers (.virtual/bin/activate) .virtual/bin/python setup.py develop
Release files for tempdirs 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tempdirs-0.0.8.tar.gz | 3.1 kB | Details |
Release files / tempdirs-0.0.8.tar.gz
| Download URL | tempdirs-0.0.8.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f29a34c6435a6101a03222b9d073f9a8c9f1e30b10d08dbaf173f6c294565c6
|
|
BLAKE2b-256 checksum How to use checksums |
743f1d5d1859a79fcdfc2f054efaeeebdcd9b448b43e167f95d8aa1571a1cf09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |