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
Compliance with PEP517 and PEP632 #4212
base: main
Are you sure you want to change the base?
Conversation
Added metadata to pyproject.toml for pip to grab.
Added metadata to setup.cfg for python 3.6 builds because pip does not look for metadata in the pyproject.toml in python 3.6
Reordered setup script for organization, removed usage of distutils, removed metadata
Changed the install command to use pip wheel instead of calling the setup.py script directly, msvc analyze option is now detected as an environment variable in the setup.py script instead of an argument
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.
Hi,
thanks for this cleanup work. Nice improvements.
I have a proposal below for merging this in pieces... What do you think?
These two commits could be merged in already if they were in a separate PR:
For the reorder commit it would be good if it could be smaller atomic commits. So it's easier to see what is changing, and also so that we can bisect more easily if there is a bug and we need to track it down later.
The pyproject.toml one is breaking things, so I think that one would need more work. Best keep it aside for now and let's get the other pieces merged in?
@@ -168,8 +168,7 @@ 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% -m pip wheel . --wheel-dir=dist" |
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.
It would be better if the "-j4" part was passed in. However, it's not the end of the world, because it doesn't seem to help as much as it used to help. Now it only saves 2-4 minutes total off the build time.
Description
This PR is an extension of PR #4211 with the goal of continuing to remove deprecated libraries, simplifying the build process and bringing the Pygame build configuration into compliance with PEP-517 and PEP-632. This PR is focused on the refractor of the
setup.py
file, the introduction ofpyproject.toml
and the removal ofdisutils
fromsetup.py
. The end goal is a more simplified and intuitive build system that usespip install
as the primary build command rather than runningsetup.py install
.Changes
pyproject.toml
: This was added and metadata information and build dependencies that were previously defined insetup.py
have been moved here.pyproject.toml
file brings the build structure in line with PEP-517 allowing for build dependencies and thesetuptools
backend to be specified within.setup.cfg
: Added duplicate metadata to allow builds on Python 3.6.pip
looked for metadata within thesetup.cfg
rather than thepyproject.toml
. Duplicating the metadata was a simple fix to ensure continued support for Python 3.6.setup.py
: Refactored for organization,distutils
was removed and replaced withsetuptools
, and metadata was removed.disutils
was removed in most places in compliance with PEP-632, usages ofdistutils
have been replaced by the appropriate counterparts insetuptools
. If no appropriate counterpart was found a custom implementation of the utility was created.setup.py
file in favor of being moved topyproject.toml
andsetup.cfg
as described above.buildconfig/appveyor.yml
: Appveyor build changed to usepip
instead of callingsetup.py
directly.USE_ANALYZE
, which gets detected by thesetup.py
script similar toPYGAME_DETECT_AVX2
. This is because you cannot pass arguments to thesetup.py
when building withpip
.Tests
These changes will be tested through Appveyor to ensure that the build process works similar to PR #4211. If the Appveyor targets record successful builds with all tests passing then that will be our indication that the updated build system functions as intended and works within the legacy code base.