Add PEP 621-compliant pyproject.toml, keep setup.py and requirements.txt untouched as legacy
#428
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #170 and other issues
Root problem:
setup.pyrequires another package's build environment to havetorchinstalled - or it "helps" by trying to installtorchitself, which is not possible when usinguv,poetryor other non-pip build systemsMinimal reproducible setup:
Step into a temp directory, create an isolated environment with
uv(also works withpoetry):Create a new project:
Add grounding dino as git-dependency:
Try to resolve depednencies into a
requirements-lock.txtfile, observe error:uv pip compile pyproject.toml -o requirements-lock.txt Updated https://github.com/IDEA-Research/GroundingDINO.git (856dde20aee659246248e20734ef9ba5214f5e44) × Failed to build `groundingdino @ git+https://github.com/IDEA-Research/GroundingDINO.git@856dde2` ├─▶ The build backend returned an error ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1) [stderr] /Users/a.yushkovskiy/.cache/uv/builds-v0/.tmpKMLQB8/bin/python: No module named pip Traceback (most recent call last): File "<string>", line 32, in install_torch ModuleNotFoundError: No module named 'torch' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 14, in <module> File "/Users/a.yushkovskiy/.cache/uv/builds-v0/.tmpKMLQB8/lib/python3.10/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) File "/Users/a.yushkovskiy/.cache/uv/builds-v0/.tmpKMLQB8/lib/python3.10/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires self.run_setup() File "/Users/a.yushkovskiy/.cache/uv/builds-v0/.tmpKMLQB8/lib/python3.10/site-packages/setuptools/build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "/Users/a.yushkovskiy/.cache/uv/builds-v0/.tmpKMLQB8/lib/python3.10/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 37, in <module> File "<string>", line 34, in install_torch File "/Users/a.yushkovskiy/.pyenv/versions/3.10.10/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/Users/a.yushkovskiy/.cache/uv/builds-v0/.tmpKMLQB8/bin/python', '-m', 'pip', 'install', 'torch']' returned non-zero exit status 1. hint: This usually indicates a problem with the package or the build environment.Now, try to change dependency to current fork branch to test it:
Try again - success, dependencies locked! 🎉 Click below to see locked file.