Make install-requires/tests-require pyproject.toml-aware (closes #38)#39
Merged
Conversation
isee install-requires / tests-require (and the install-packages action's dependency-files path) only understood setup.cfg, hard-failing on pyproject.toml-only repos with 'No file with name setup.cfg'. - pip_utils now resolves dependency metadata, preferring pyproject.toml [project] (dependencies / optional-dependencies) and falling back to setup.cfg ([options] install_requires / tests_require). - Empty deps are a logged no-op; only a total absence of metadata raises, now with an actionable message. - New resolve_install_requires/resolve_tests_require expose the resolution without pip side effects (and back the tests). - install-packages action accepts .toml in dependency-files. - tomli fallback dep for Python 3.10 (tomllib is 3.11+). Closes #38
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.
Summary
isee install-requires/isee tests-require— and therefore theinstall-packagesaction'sdependency-filespath — only understoodsetup.cfg, hard-failing onpyproject.toml-only repos withRuntimeError: No file with name "setup.cfg" exist .... This silently broke CIfor any pyproject-only repo whose
ci.ymlstill passed a.cfg.Fixes #38.
What changed
isee/pip_utils.py— new_metadata_source()resolver: preferpyproject.tomlwhen it has a[project]table, otherwise fall back tosetup.cfg.install_requires→[project].dependencies(else[options] install_requires).tests_require→[project.optional-dependencies](first present oftesting/test/tests/dev, overridable viatest_extras; else[options] tests_require).No <kind> packages to install); only a totalabsence of metadata raises, now with an actionable message.
resolve_install_requires/resolve_tests_requireexpose resolution without invoking pip (and back the tests).
read_setup_config/extras_require/install_extraskept.actions/install-packages/action.yml— the Install Dependencies step nowtriggers on
*.tomlas well as*.cfg; input description updated.pyproject.toml—tomlifallback dependency for Python 3.10 (tomllibis 3.11+).
tests/test_pip_utils.py— covers pyproject resolution, custom extras,empty-deps no-op, pyproject-preferred-over-cfg, cfg fallback when pyproject
carries only tool config, and the clear error when neither file exists.
Testing
pytest tests/test_pip_utils.py→ 9 passed. Full suite: only the 3pre-existing
local_cli--bindfailures remain (unrelated to this change;they also fail on
master).