-
-
Notifications
You must be signed in to change notification settings - Fork 684
add incremental building for setuptools>=79 #40616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Documentation preview for this PR (built with commit 4503938; changes) is ready! 🎉 |
…uring sagelib and distclean processes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements incremental building for setuptools>=79 to improve build times for editable installs of sagelib. The change adds logic to detect existing editable installations and perform incremental compilation instead of full reinstallation on subsequent builds.
- Adds support for Python 3.13 in project metadata
- Implements incremental build detection and compilation for editable installs
- Updates build system documentation and cleanup procedures
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| m4/setup_cfg_metadata.m4 | Adds Python 3.13 classifier |
| m4/pyproject_toml_metadata.m4 | Adds Python 3.13 support and updates version requirement |
| build/pkgs/sagelib/spkg-install.in | Implements incremental build logic for editable installs |
| Makefile | Updates cleanup procedures and adds documentation for incremental builds |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| export SETUPTOOLS_ENABLE_FEATURES=legacy-editable | ||
| sdh_pip_editable_install . | ||
| # Check if this is an incremental build by looking for existing editable install | ||
| if python3 -c "import importlib.metadata; importlib.metadata.distribution('sagemath-standard')" 2>/dev/null && \ |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition checks for 'sagemath-standard' distribution but this may not be the correct package name for all configurations. Consider using a more reliable method to detect existing editable installs or make the package name configurable.
| sdh_pip_editable_install . | ||
| # Check if this is an incremental build by looking for existing editable install | ||
| if python3 -c "import importlib.metadata; importlib.metadata.distribution('sagemath-standard')" 2>/dev/null && \ | ||
| python3 -c "import sage; import os; exit(0 if os.path.exists(os.path.join(os.path.dirname(sage.__file__), '..', 'setup.py')) else 1)" 2>/dev/null; then |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The complex inline Python code for detecting setup.py makes the script hard to read and maintain. Consider extracting this logic into a separate function or using a more straightforward file existence check.
| python3 -c "import sage; import os; exit(0 if os.path.exists(os.path.join(os.path.dirname(sage.__file__), '..', 'setup.py')) else 1)" 2>/dev/null; then | |
| [ -f "$(python3 -c 'import sage, os; print(os.path.abspath(os.path.join(os.path.dirname(sage.__file__), "..", "setup.py")))' 2>/dev/null)" ]; then |
| python3 -c "import sage; import os; exit(0 if os.path.exists(os.path.join(os.path.dirname(sage.__file__), '..', 'setup.py')) else 1)" 2>/dev/null; then | ||
| echo "Detected existing editable install - performing incremental build" | ||
| # Use setup.py build_ext --inplace for incremental compilation | ||
| python3 setup.py build_ext --inplace || sdh_die "Error during incremental build" |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using setup.py directly is discouraged in modern Python packaging. Consider using python3 -m build or pip install --no-build-isolation -e . for consistency with modern setuptools practices.
| python3 setup.py build_ext --inplace || sdh_die "Error during incremental build" | |
| # Use pip editable install for incremental compilation (modern practice) | |
| sdh_pip_editable_install . || sdh_die "Error during incremental build" |
Fix #40612 #40548, I try to add the incremental building property to the sagelib for
setuptools>=79, and usepip install -e .to install sagelib. @orlitzky I have fixed the problem last time I discussed in #40548 .📝 Checklist
⌛ Dependencies