From 7991916ed3894d55970cf1de7deee7cd8b08a163 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Mon, 17 Jun 2024 17:10:48 +0200 Subject: [PATCH] Add missing tools directory --- tools/generate_requirements_txt.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tools/generate_requirements_txt.py diff --git a/tools/generate_requirements_txt.py b/tools/generate_requirements_txt.py new file mode 100644 index 00000000..a148c339 --- /dev/null +++ b/tools/generate_requirements_txt.py @@ -0,0 +1,19 @@ +from __future__ import annotations + +from pathlib import Path + +import tomllib + +this_script = Path(__file__) +root = this_script.parents[1] +pyproject = root / 'pyproject.toml' + +with open(pyproject, 'rb') as f: + metadata = tomllib.load(f) + dependencies = metadata['project']['dependencies'] + +with open('requirements.txt', 'w') as f: + this_script_rel = this_script.relative_to(root) + f.write(f'# generated by {this_script_rel}\n') + f.write('\n'.join(dependencies)) + f.write('\n')