This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Tempman can be used to create temporary directories. These temporary directories can then be easily cleaned up by calling close, or using the directory as a context manager.

By using a fixed root for temporary directory, Tempman also allows cleanup of directories older than a specified timeout.

Example

import tempman

with tempman.create_temp_dir() as directory:
    assert os.path.exists(directory.path)
    assert os.path.isdir(directory.path)

assert not os.path.exists(directory.path)

API

tempdir.create_temp_dir(dir=None)

Creates a temporary directory and returns an instance of TemporaryDirectory. The directory will be deleted when the instance of TemporaryDirectory is closed.

If dir is set, the temporary directory is created as a sub-directory of dir.

TemporaryDirectory

Has the following attributes:

  • path - path to the temporary directory
  • close() - delete the temporary directory, including any files and sub-directories

TemporaryDirectory is a context manager, so using with will also delete the temporary directory.

tempdir.root(dir, timeout=None)

Creates a factory for temporary directories, all of which will be under the directory dir. Returns Root.

If timeout is set, any sub-directories with an age greater than timeout seconds will be deleted on cleanup. Cleanup occurs during root.create_temp_dir(), and can also be triggered manually by calling root.cleanup(). The age of a sub-directory is determined by the modification or access time, whichever is later. timeout can either be a number of seconds, or an instance of datetime.timedelta.

Root

Has the following attributes:

  • create_temp_dir(): creates a temporary directory in the same way as tempman.create_temp_dir(), except that the parent directory is always the directory of the Root. Also calls cleanup().
  • cleanup(): if timeout is set, delete old sub-directories as described above.

Installation

pip install tempman
Release History

Release History

0.1.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
tempman-0.1.3.tar.gz (2.5 kB) Copy SHA256 Checksum SHA256 Source Jul 5, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development 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