build: migrate to pyproject [build-system], drop legacy setup.py (fix…#42
Merged
Conversation
…es RTD build)
The Read the Docs 'latest' build started failing with:
ModuleNotFoundError: No module named 'pkg_resources'
... <string> line 12, in <module> (setup.py)
Root cause: the project carried a legacy PyScaffold-era setup.py whose first
import is , plus a
in setup.cfg. pyproject.toml had no
[build-system] table, so pip fell back to executing setup.py in its PEP 517
build-isolation overlay — where modern setuptools (RTD pulled 80+) no longer
exposes pkg_resources. The wheel build died before Sphinx ever ran. This was
latent and unrelated to the docs content; any recent RTD build would hit it.
Fix — make pyproject.toml the single source of build truth:
- Add [build-system] (setuptools>=61 + wheel, build_meta backend) so pip uses
the modern backend instead of executing setup.py.
- Add [tool.setuptools] + [tool.setuptools.packages.find] for the src/ layout
package discovery that setup.cfg previously provided.
- Remove setup.py entirely (pyproject now fully describes the build; runtime
version already comes from importlib.metadata, not pyscaffold).
- Strip the pyscaffold line from setup.cfg.
Verified: a clean isolated Processing /Users/jarvis/Projects/yapCAD
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: ezdxf>=1.1 in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (1.4.3)
Requirement already satisfied: pyglet<2,>=1.5 in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (1.5.31)
Requirement already satisfied: mpmath>=1.2 in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (1.3.0)
Requirement already satisfied: numpy>=1.22 in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (2.4.4)
Requirement already satisfied: mapbox-earcut>=1.0.3 in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (2.0.0)
Requirement already satisfied: PyYAML>=6.0 in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (6.0.3)
Requirement already satisfied: pyobjc-core in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (12.1)
Requirement already satisfied: pyobjc-framework-Cocoa in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (12.1)
Requirement already satisfied: pyobjc-framework-Quartz in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from yapCAD==1.0.0rc1) (12.1)
Requirement already satisfied: pyparsing>=2.0.1 in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from ezdxf>=1.1->yapCAD==1.0.0rc1) (3.3.2)
Requirement already satisfied: typing_extensions>=4.6.0 in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from ezdxf>=1.1->yapCAD==1.0.0rc1) (4.15.0)
Requirement already satisfied: fonttools in /opt/homebrew/Caskroom/miniconda/base/lib/python3.13/site-packages (from ezdxf>=1.1->yapCAD==1.0.0rc1) (4.61.1)
Building wheels for collected packages: yapCAD
Building wheel for yapCAD (pyproject.toml): started
Building wheel for yapCAD (pyproject.toml): finished with status 'done'
Created wheel for yapCAD: filename=yapcad-1.0.0rc1-py3-none-any.whl size=601187 sha256=b3902c76e8c9cf15e7cfdd7d9aff8dffacf78641a0908f7069310a0738a4fc9b
Stored in directory: /private/var/folders/0x/j8r1t__d7hv3tmx0gtl0bvvw0000gq/T/pip-ephem-wheel-cache-ow5jb_fm/wheels/2f/34/d7/b7b03f2ed450543536022679110dfbf1ddb25c7e20b7273eb4
Successfully built yapCAD
Installing collected packages: yapCAD
Successfully installed yapCAD-1.0.0rc1 with setuptools 82.0.1 now builds
the wheel via the pyproject backend, installs, and imports
(yapcad.__version__ == 1.0.0rc1) — reproducing RTD's environment.
Co-authored-by: jarvis-rich
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
overview
The Read the Docs 'latest' build is failing with:
ModuleNotFoundError: No module named 'pkg_resources'
... line 12, in (setup.py)
Root cause: the project carried a legacy PyScaffold-era setup.py whose first import is , plus a
in setup.cfg. pyproject.toml had no
[build-system] table, so pip fell back to executing setup.py in its PEP 517 build-isolation overlay — where modern setuptools (RTD pulled 80+) no longer exposes pkg_resources. The wheel build died before Sphinx ever ran. This was latent and unrelated to the docs content; any recent RTD build would hit it.
Fix — make pyproject.toml the single source of build truth:
Co-authored-by: jarvis-rich