{"id":18551770,"url":"https://github.com/tomhea/tempfiles","last_synced_at":"2025-05-15T11:10:26.962Z","repository":{"id":179700870,"uuid":"664000179","full_name":"tomhea/tempfiles","owner":"tomhea","description":"with TempFiles(3) as (path1, path2, path3):","archived":false,"fork":false,"pushed_at":"2023-12-01T22:31:35.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T16:25:01.508Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomhea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-08T16:40:55.000Z","updated_at":"2025-01-19T00:23:21.000Z","dependencies_parsed_at":"2023-12-01T22:26:58.510Z","dependency_job_id":"b4455326-5e0c-4620-a486-67ac7ecd34c2","html_url":"https://github.com/tomhea/tempfiles","commit_stats":null,"previous_names":["tomhea/tempfiles"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhea%2Ftempfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhea%2Ftempfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhea%2Ftempfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomhea%2Ftempfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomhea","download_url":"https://codeload.github.com/tomhea/tempfiles/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328389,"owners_count":22052633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T21:10:17.863Z","updated_at":"2025-05-15T11:10:21.953Z","avatar_url":"https://github.com/tomhea.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tempf - TempFiles\n\n[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/tomhea/tempfiles)](https://github.com/tomhea/tempfiles)\n[![GitHub](https://img.shields.io/github/license/tomhea/flip-jump)](LICENSE)\n[![PyPI - Version](https://img.shields.io/pypi/v/tempf)](https://pypi.org/project/tempf/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/tempf)](https://pypi.org/project/tempf/)\n\n\nMultiple temporary files in 1 line of code. \n\nTempFiles(X) returns a tuple of X non-used paths.\n\n```python\nfrom tempf import TempFiles\n\nwith TempFiles(3) as (path1, path2, path3):\n    with path1.open('w') as file1:\n        file1.write('See how easy it is?')\n```\n\n\n## Install\n```\n\u003e\u003e\u003e pip install tempf\n```\n\n\n## Example\nCompilation process:\n\n```python\nfrom pathlib import Path\nfrom tempf import TempFiles\n\n\ndef compile_run_and_check_output(code_path: Path, expected_output: str) -\u003e bool:\n    \"\"\"\n    Compile the code, run it, and assert the output is as expected.\n    :param code_path: The path to the code to compile.\n    :param expected_output: The expected output from running the code.\n    :returns: True if compilation and run went successful, and the run outputted the expected output. \n    \"\"\"\n    with TempFiles(4) as (compile_log_path, run_log_path, executable_path, run_output_path):\n        compile_file(code_path, log=compile_log_path, compiled=executable_path)\n        if not is_compile_log_ok(compile_log_path):\n            return False\n\n        run_compiled(executable_path, log=run_log_path, run_output=run_output_path)\n        if not is_run_log_ok(run_log_path):\n            return False\n\n        with run_output_path.open('r') as output_file:\n            return expected_output == output_file.read()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhea%2Ftempfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomhea%2Ftempfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhea%2Ftempfiles/lists"}