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
Phasing Out Distutils And Bringing the Build System Up To PEP 517 #4198
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for this epic amount of cleanup.
Would you be able to send smaller changes you are confident in already as separate PRs?
For the commit messages, I'm trying to follow a git / linux kernel way where the context is first, and the module is too.
buildconfig: appveyor: Fix old way of doing something to new way
More description, details, why, how, etc...
@@ -168,8 +168,9 @@ install: | |||
- "%PYTHON% -m pip install Sphinx==4.5.0 sphinxcontrib-applehelp==1.0.2 pip install sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5" | |||
- "%PYTHON% setup.py docs" | |||
- "%WITH_COMPILER% %PYTHON% -m buildconfig" | |||
- "%WITH_COMPILER% %PYTHON% setup.py build -j4 %USE_ANALYZE%" | |||
- "%WITH_COMPILER% %PYTHON% setup.py -setuptools %DISTRIBUTIONS%" | |||
# - "%WITH_COMPILER% %PYTHON% setup.py build -j4 %USE_ANALYZE%" |
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.
This is used to turn on the compiler static analysis. I guess there will be some new way to pass flags through or extend the compiler?
buildconfig/config_emsdk.py
Outdated
@@ -183,7 +183,7 @@ def configure(self, incdirs, libdirs): | |||
except ImportError: | |||
self.found = 0 | |||
if self.found and self.header: | |||
fullpath = os.path.join(get_python_inc(0), self.header) | |||
fullpath = os.path.join(get_path('include'), self.header) |
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.
This whole file isn't used, so it can be removed.
pyproject.toml
Outdated
Twitter = "https://twitter.com/pygame_org" | ||
|
||
[build-system] | ||
requires = ["setuptools>=42", "wheel", "cython~=3.0.0"] |
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.
I think it's good to require specific versions here. Especially with Cython. Things can sometimes go eerie when folks use slightly different versions.
This is to fix an issue with pip not grabbing the metadata from the project table of the pyproject.toml on python 3.6
Specified latest cached versions except for cython==3.0.0
Changed version requirement to grab latest version for each python environment. This allows python 3.6 to use version 59.6.0 while allowing python 3.12 to use a later version that supports 3.12
Changed the setup.py script to search for the USE_ANALYZE env variable rather than arguments. This is because you cannot pass args to the setup.py script with pip wheel.
This file is not longer used
With the deprecation of
distutils
in Python 3.10, my senior design team thought it would be helpful to bring pygame's build system up to the PEP 517 standards. This is still a work on progress, but we are submitting this PR to run our changes through AppVeyor and get feedback from the core development team.We opted to use a
pyproject.toml
to house the metadata while using thesetup.py
as the build backend to retain the complex build logic.The
setup.py
has been reorganized to for maintainability. Additionally, most instances ofdistutils
have been replaced by theirsetuptools
counterparts. Our goal is to reduce the length and complexity of thesetup.py
script by leveraging the encapsulation offered bysetuptools
.We removed all but 1 instance of
distutils
from thebuildconfig
module.We have also updated the AppVeyor script to use
pip wheel
instead of callingsetup.py
directly per PEP 517 standards.Overall, we want to bring the pygame build system up to date to ensure the longevity of the project. We will continue to polish out these changes to fully eliminate
distutils
. We are open to any feedback, suggestions, or questions you have about our work.