From df984badb88a4e5332615792a17247eef56a2194 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 17 May 2024 09:01:48 -0400 Subject: [PATCH 1/2] add pyproject.toml with build dependencies Adding this metadata means it is possible to `pip install flash-attn` without pre-installing the packages imported in setup.py. It is still possible to follow the existing manual instructions, too, but by not requiring pre-installation it _also_ makes it easier for someone to build from the source dist. Signed-off-by: Doug Hellmann --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..dc450d8eb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "packaging", "psutil", "ninja", "torch", "wheel"] +build-backend = "setuptools.build_meta" \ No newline at end of file From 52224dc01ca1120cf4f1a5d30f8f35b8d548e84e Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 17 May 2024 09:02:15 -0400 Subject: [PATCH 2/2] update Makefile step for building sdist to use 'build' The build package provides a front-end to the standard APIs for generating build artifacts like sdists and wheels from source code. Using build means the pyproject.toml file is processed, which means the build dependencies imported by setup.py can be installed before setup.py itself is processed. Signed-off-by: Doug Hellmann --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 79aefc797..e6b857b7f 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,10 @@ clean_dist: rm -rf dist/* +# This step assumes there is already a virtualenv active. create_dist: clean_dist - python setup.py sdist + python -m pip install build + python -m build --sdist . upload_package: create_dist twine upload dist/*