{ "info": { "author": "Matthew Tardiff", "author_email": "mattrix@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "Temporary |Version| |Build| |Coverage| |Health|\n===============================================\n\n|Compatibility| |Implementations| |Format| |Downloads|\n\nContext managers for managing temporary files and directories.\n\n\n.. code:: python\n\n with temporary.temp_dir() as d:\n ...\n\n with temporary.temp_file(content='hello') as f:\n ...\n\n\nInstallation:\n\n.. code:: shell\n\n $ pip install temporary\n\n\nTemporary Directory Examples\n----------------------------\n\nThe temporary directory is created when entering the context manager, and\ndeleted when exiting it:\n\n.. code:: python\n\n >>> import temporary\n >>> with temporary.temp_dir() as temp_dir:\n ... assert temp_dir.is_dir()\n >>> assert not temp_dir.exists()\n\nThis time let's make the temporary directory our working directory:\n\n.. code:: python\n\n >>> import os\n >>> with temporary.temp_dir(make_cwd=True) as temp_dir:\n ... assert str(temp_dir) == os.getcwd()\n >>> assert not str(temp_dir) == os.getcwd()\n\nThe suffix, prefix, and parent_dir options are passed to the standard\n``tempfile.mkdtemp()`` function:\n\n.. code:: python\n\n >>> with temporary.temp_dir() as p:\n ... with temporary.temp_dir(suffix='suf', prefix='pre', parent_dir=p) as d:\n ... assert d.parent == p\n ... assert d.name.startswith('pre')\n ... assert d.name.endswith('suf')\n\nThis function can also be used as a decorator, with the ``in_temp_dir`` alias:\n\n.. code:: python\n\n >>> @temporary.in_temp_dir()\n ... def my_function():\n ... assert old_cwd != os.getcwd()\n ...\n >>> old_cwd = os.getcwd()\n >>> my_function()\n >>> assert old_cwd == os.getcwd()\n\n\nTemporary File Examples\n-----------------------\n\nThe temporary file is created when entering the context manager and\ndeleted when exiting it.\n\n.. code:: python\n\n >>> import temporary\n >>> with temporary.temp_file() as temp_file:\n ... assert temp_file.exists()\n >>> assert not temp_file.exists()\n\nThe user may also supply some content for the file to be populated with:\n\n.. code:: python\n\n >>> with temporary.temp_file('hello!') as temp_file:\n ... with temp_file.open() as f:\n ... assert f.read() == 'hello!'\n\nThe temporary file can be placed in a custom directory:\n\n.. code:: python\n\n >>> with temporary.temp_dir() as temp_dir:\n ... with temporary.temp_file(parent_dir=temp_dir) as temp_file:\n ... assert temp_file.parent == temp_dir\n\nIf, for some reason, the user wants to delete the temporary file before\nexiting the context, that's okay too:\n\n.. code:: python\n\n >>> with temporary.temp_file() as temp_file:\n ... temp_file.unlink()\n\n.. |Build| image:: https://travis-ci.org/themattrix/python-temporary.svg?branch=master\n :target: https://travis-ci.org/themattrix/python-temporary\n.. |Coverage| image:: https://img.shields.io/coveralls/themattrix/python-temporary.svg\n :target: https://coveralls.io/r/themattrix/python-temporary\n.. |Health| image:: https://codeclimate.com/github/themattrix/python-temporary/badges/gpa.svg\n :target: https://codeclimate.com/github/themattrix/python-temporary\n.. |Version| image:: https://img.shields.io/pypi/v/temporary.svg\n :target: https://pypi.python.org/pypi/temporary\n.. |Downloads| image:: https://img.shields.io/pypi/dm/temporary.svg\n :target: https://pypi.python.org/pypi/temporary\n.. |Compatibility| image:: https://img.shields.io/pypi/pyversions/temporary.svg\n :target: https://pypi.python.org/pypi/temporary\n.. |Implementations| image:: https://img.shields.io/pypi/implementation/temporary.svg\n :target: https://pypi.python.org/pypi/temporary\n.. |Format| image:: https://img.shields.io/pypi/format/temporary.svg\n :target: https://pypi.python.org/pypi/temporary\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/themattrix/python-temporary", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "temporary", "package_url": "https://pypi.org/project/temporary/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/temporary/", "project_urls": { "Homepage": "https://github.com/themattrix/python-temporary" }, "release_url": "https://pypi.org/project/temporary/3.0.0/", "requires_dist": [ "contextlib2", "pathlib2" ], "requires_python": "", "summary": "Context managers for managing temporary files and directories.", "version": "3.0.0" }, "last_serial": 2120192, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "67d2254a13908545770adc4dccb24a60", "sha256": "f60a8c82b2e2279e134b7853b657c745a0f29b875b4c7147497bb76b739ba389" }, "downloads": -1, "filename": "temporary-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "67d2254a13908545770adc4dccb24a60", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3986, "upload_time": "2015-01-29T23:06:29", "url": "https://files.pythonhosted.org/packages/99/aa/5b38d184baf2da27078bb488a85d2c2ce368ff145f654f780c1434684ba0/temporary-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b57fb0d7f53ac44bf5e148d563fffe2", "sha256": "a739d3e2c16a003b47b436391b4bf3046a25176dcde10809e516f4c10d4c2421" }, "downloads": -1, "filename": "temporary-1.0.0.tar.gz", "has_sig": false, "md5_digest": "3b57fb0d7f53ac44bf5e148d563fffe2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2744, "upload_time": "2015-01-29T23:06:27", "url": "https://files.pythonhosted.org/packages/bf/c3/7fa46c3b24ad38f30c7e08e5d13f95281cdc24f3e7d142c86ac5abcd9b63/temporary-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "2b9c1f6cf976c965e2e41ed464597267", "sha256": "b84c19c8978d527bfdd06325562307e9f1f70d85bb9e2d59b3ba56e9c4fe7407" }, "downloads": -1, "filename": "temporary-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2b9c1f6cf976c965e2e41ed464597267", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4216, "upload_time": "2016-05-15T01:47:43", "url": "https://files.pythonhosted.org/packages/56/c7/76f5048a5099cc8f5f6947f277ad39a80429e8ece47bdc6287136a321478/temporary-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "28ce194ed12a3a84c04d7042b590c295", "sha256": "daa2b33a31a39d93012d347149fc8b800c7557567562ff9107436f23a05f7b1c" }, "downloads": -1, "filename": "temporary-1.1.0.tar.gz", "has_sig": false, "md5_digest": "28ce194ed12a3a84c04d7042b590c295", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2728, "upload_time": "2016-05-15T01:47:48", "url": "https://files.pythonhosted.org/packages/72/91/1cd1636f44d84208ccbf8639f7ae0019d1fac08d9575040544a19a9ec87c/temporary-1.1.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "8c75569376388d82aea90844c38059fb", "sha256": "b6f8dbb7ea11196dd06d0df3c2f35f4200b5a48b3d0e18fd241ba9353ec190c0" }, "downloads": -1, "filename": "temporary-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8c75569376388d82aea90844c38059fb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4249, "upload_time": "2016-05-16T15:40:21", "url": "https://files.pythonhosted.org/packages/c8/fe/416d6ad09ee9858024ffddb01760a937e588980a6fdcf52a6b3ef5b9d662/temporary-2.0.0-py2.py3-none-any.whl" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "14d58ca1d5cd294cf3eaa890a4aef800", "sha256": "119a37331accca293e1e6745e965dfda78b047d6b78ec09d555252b06c5091f4" }, "downloads": -1, "filename": "temporary-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "14d58ca1d5cd294cf3eaa890a4aef800", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4250, "upload_time": "2016-05-16T16:58:59", "url": "https://files.pythonhosted.org/packages/10/cb/8316616281ee0f2bc3c3d0ca3a760fcccd2f6851bea9f2d39c65f37d8f14/temporary-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "23306b02a31a9da91d9fd076c4fb7c39", "sha256": "942aba697a8c4faa45a0f015d198210112df1ac3de351b39d7fd90b55081b3b8" }, "downloads": -1, "filename": "temporary-2.0.1.tar.gz", "has_sig": false, "md5_digest": "23306b02a31a9da91d9fd076c4fb7c39", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2762, "upload_time": "2016-05-16T16:59:12", "url": "https://files.pythonhosted.org/packages/fc/3e/c8145a330bf50811ca5f7285b748fc68656e91f29c139c1164e1fb08b54f/temporary-2.0.1.tar.gz" } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "73281325cc9555e5e76c34109e4f4b29", "sha256": "4d83707f978b7817e20f38fd967a68d3373786fa6ffd85868744cf0c08cb8199" }, "downloads": -1, "filename": "temporary-3.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "73281325cc9555e5e76c34109e4f4b29", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4337, "upload_time": "2016-05-17T16:25:21", "url": "https://files.pythonhosted.org/packages/bd/7d/418a93dcb56844cfb7aa500716716891d360d8e2b364705b9f55f4622ee8/temporary-3.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "66c46e2b674a7ec5d8e186180dc055ff", "sha256": "6a56e5cc0b5df7c1f55cefefba9fb5f71cc13332b2929f2c8976db9be3bed773" }, "downloads": -1, "filename": "temporary-3.0.0.tar.gz", "has_sig": false, "md5_digest": "66c46e2b674a7ec5d8e186180dc055ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2815, "upload_time": "2016-05-17T16:25:28", "url": "https://files.pythonhosted.org/packages/e3/07/09d77128298b67b5cd7a444604e393b43ccf32d19090b0167c13bb829328/temporary-3.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "73281325cc9555e5e76c34109e4f4b29", "sha256": "4d83707f978b7817e20f38fd967a68d3373786fa6ffd85868744cf0c08cb8199" }, "downloads": -1, "filename": "temporary-3.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "73281325cc9555e5e76c34109e4f4b29", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4337, "upload_time": "2016-05-17T16:25:21", "url": "https://files.pythonhosted.org/packages/bd/7d/418a93dcb56844cfb7aa500716716891d360d8e2b364705b9f55f4622ee8/temporary-3.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "66c46e2b674a7ec5d8e186180dc055ff", "sha256": "6a56e5cc0b5df7c1f55cefefba9fb5f71cc13332b2929f2c8976db9be3bed773" }, "downloads": -1, "filename": "temporary-3.0.0.tar.gz", "has_sig": false, "md5_digest": "66c46e2b674a7ec5d8e186180dc055ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2815, "upload_time": "2016-05-17T16:25:28", "url": "https://files.pythonhosted.org/packages/e3/07/09d77128298b67b5cd7a444604e393b43ccf32d19090b0167c13bb829328/temporary-3.0.0.tar.gz" } ] }