Skip to content

Add Python provider with click and pretalx corpus - #10

Merged
markoa merged 21 commits into
mainfrom
cursor/python-provider-532e
Aug 19, 2026
Merged

markoa merged 21 commits into
mainfrom
cursor/python-provider-532e

Conversation

@markoa

@markoa markoa commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Pulls Python support forward from post-v0, using the same corpus shape as Ruby.

Canonical test repos

Python has several first-class project shapes (pip / Poetry / uv / Pipenv, pytest vs unittest, Django vs Flask vs FastAPI). Not every shape gets a remote corpus entry:

Shape Covered by
Django + pip focused python-django fixture
PEP 621 library + uv.lock pallets/click
Production Django + uv pretalx/pretalx
Poetry, Pipenv, setup.py, competing lockfiles, Flask server unit tests
requirements.txt-only trees not project roots (too many false positives)
conda out of scope

This matches Ruby: ruby-rails fixture, ruby/rake library, basecamp/once-campfire app.

Provider

  • Identity: pyproject.toml, setup.py, or Pipfile, merged when they coexist
  • Managers from lockfiles / [tool.poetry|uv|pdm]; competing signals are an ambiguity
  • Runtime: .python-version, .tool-versions, requires-python, with source/pointer from the declaring file
  • Inferred commands: manager install, then pytest / unittest / manage.py test / Django/Flask server prefixed with uv run, poetry run, pipenv run, or pdm run when that manager is selected
  • Configured tools stay tool.configured when no matching command exists
  • GHA recognizes actions/setup-python, including GraalPy version-file pins
  • Named pip install <package> in CI is tool provisioning, including option-prefixed forms such as uv --directory . pip install ruff

idea.md and plan.md record the decision to pull Python into v0 as milestone 8.

Accuracy and evidence-contract fixes

  • Cites requirements.txt (including prefixed tools such as pytest-cov) instead of a fallback manifest
  • Parses only install_requires / tests_require / setup_requires / extras_require in setup.py
  • Treats [tool.poetry|uv|pdm] as the manager even when requirements.txt is also present
  • Keeps requirements.txt dependencies scoped to pip so Poetry/uv/PDM/Pipenv do not claim packages that file never installs
  • Unwraps nested runners so uv run python -m pytest is pytest
  • Keeps relative local pip installs (../shared, packages/widget) as repository commands
  • Discovers Django tests.py without treating helper modules such as testing.py as tests
  • Preserves uv run --directory / -C / --project so CI commands are attributed to that working directory, including Semaphore
  • Unwraps uv --directory packages/api run pytest and uv -C … tool run
  • Consumes uv run value flags such as --env-file and --with-requirements
  • Infers pip install -e . only for installable identities, not tool-only pyproject files
  • Merges setup.py / Pipfile with pyproject.toml so build-system-only or tool-only pyproject files do not hide installable identity
  • Cites Pipfile (not pyproject) when only Pipfile declares python_version
  • Reads [tool.pdm.dev-dependencies] so pytest/Ruff declared there are not missed
  • Limits prefix tool matching to pytest plugins; mypy-extensions is not tool.configured=mypy
  • Accepts Ruby engine aliases and GraalPy pins in shared version-file parsing
  • Does not treat pip/uv/Poetry -v as a version probe
  • Treats pip install -c constraints.txt <pkg> as remote tool provisioning
  • Skips named pip installs after uv/pip global options (uv --directory . pip install ruff, pip --index-url … install tox)
  • Classifies Python installs in ClassifyManager so CI poetry install conflicts with inferred uv sync instead of emitting two preparation commands
  • Skips virtualenvs via pyvenv.cfg or site-packages, not every directory named env
  • Describes mixed manager ambiguities as competing signals unless every candidate is a lockfile
  • Wraps inferred test/server commands in the selected manager environment
  • Parses dotted TOML keys (project.name, project.dependencies) as nested tables
  • Treats pytest plugins such as pytest-cov as pytest command signals
  • Cites the selected manager signal (Pipfile) on inferred Pipenv installs
  • Leaves expression-valued uv --directory on the enclosing project instead of fabricating a path
  • Matches requires-python with PEP 440 comma bounds and ~= compatible releases
  • Compares exact PEP 440 releases with zero padding so ==3.12 matches CI 3.12.0
  • Leaves prerelease Python bounds such as >=3.13rc1 unevaluable instead of treating rc tokens as zero
  • Activates extras and non-default dependency groups on inferred installs when pytest lives only there, including alongside requirements.txt
  • Quotes pip extras (pip install -e '.[test]') so zsh nomatch does not fail the command
  • Preserves setup.py extras_require extra names and does not treat tests_require as a main extra
  • Honors Poetry optional = true extras via [tool.poetry.extras], optional groups with --with, and [tool.poetry.dev-dependencies]
  • Ingests uv's deprecated [tool.uv] dev-dependencies as the default dev group
  • Uses PDM -G for both extras and groups
  • Keeps pip install --group and unresolved/$VAR wheel targets as visible CI commands
  • Classifies poetry sync and pipenv sync as dependency installation
  • Recognizes INI sections in setup.cfg and tox.ini for pytest, flake8, mypy, isort, and pylint
  • Interprets only unqualified tox / tox run / nox as tests
  • Unwraps poetry -C / pdm --project / uv --project globals before run

make check passes. requirements.txt pytest no longer produces poetry run pytest. ==3.12 folds CI 3.12.0 instead of conflicting. setup.cfg / tox.ini sections configure flake8, mypy, isort, and pylint.

Open in Web Open in Cursor 

cursoragent and others added 17 commits August 19, 2026 08:19
Python is pulled forward from post-v0 using the same corpus shape as
Ruby: a focused python-django fixture, pallets/click as a framework-free
library, and pretalx/pretalx as a production Django application.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Skip named pip installs as CI tool provisioning, matching the gem
install rule, and keep setup-python version files from treating
pyproject.toml table headers as versions.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Retain requirements.txt and prefixed-tool sources, parse only setup.py
dependency fields, honor explicit manager tables, unwrap nested runners,
keep relative pip installs, and detect Django tests.py modules.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Accept tests.py without treating helper modules such as testing.py as
tests, drop an unused manager helper, and fix setup.py parse lint.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Keep uv --directory/-C when unwrapping runners, infer pip install only
for installable Python identities, read PDM dev-dependencies, limit
prefix tool matching to pytest plugins, and accept Ruby engine aliases
in shared version-file parsing.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
factValues only collected tool.configured facts; name the helper for
that purpose instead of keeping an unused parameter.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Read setup.py and Pipfile alongside pyproject.toml, stop treating pip/uv
/Poetry -v as version probes, unwrap uv global options, apply captured
uv directories in Semaphore, skip env and site-packages trees, accept
GraalPy version-file pins, and describe mixed manager ambiguities as
signals rather than lockfiles.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Emit uv/poetry/pipenv/pdm run for test and server commands, cite the
actual Python version declaration source, consume uv run value flags
such as --env-file, and treat pip -c as a constraint rather than an
installable requirements file.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
firstNonEmpty was only used by the old Pipfile version fallback.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Recognize uv/poetry/pipenv/pdm/pip installs in ClassifyManager so a CI
poetry install conflicts with inferred uv sync, and skip named pip
installs that carry uv directory or pip index-url options.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Parse dotted pyproject keys, treat pytest-* plugins as pytest signals,
cite the selected manager (Pipfile) on inferred installs, and keep
expression-valued uv --directory on the enclosing project.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Evaluate requires-python with PEP 440 comma bounds and ~= compatible
releases so CI versions are not falsely merged or conflicted. Preserve
dependency-group provenance and activate extras or groups on inferred
installs. Interpret only unqualified tox and nox runs as tests, and
unwrap poetry/pipenv/pdm global directory flags before run.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Ignore sibling pytest plugins when choosing extras or groups, so Click
keeps uv sync. Pretalx now installs the dev extra that provides pytest,
and tox run -e typing is no longer labeled a test.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Keep extras and groups on requirements-based pip installs, honor optional
Poetry groups, use PDM -G for extras, quote pip extras, and parse legacy
Poetry dev-dependencies plus setup.cfg pytest settings. Consume pip
value flags and unresolved targets so --group and variable wheels stay
visible, and classify poetry/pipenv sync as dependency installation.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Do not skip every directory named env; treat uv --project as a project
directory; preserve setup.py and Poetry extra scopes; ingest uv
dev-dependencies; and leave prerelease Python bounds unevaluable.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
…ection.

Keep requirements.txt dependencies installable only under pip so Poetry,
uv, PDM, and Pipenv do not claim pytest from that file. Compare exact
PEP 440 releases with zero padding, and read setup.cfg/tox.ini sections
for flake8, mypy, isort, pylint, and pytest.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
gofumpt dropped extra blank lines left by conflict resolution.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/python-provider-532e branch from 872fa16 to 9fbd03c Compare August 19, 2026 08:26
cursoragent and others added 2 commits August 19, 2026 08:27
main's constraint matcher takes (runtime, declared, version); the
rebased Python cases still used the two-argument form.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
Expression-valued directory flags still go through expandDirectories so
composer --working-dir=\${{ matrix.dir }} can fan out. clap's pre-commit
workflow now reports the setup-python 3.x pin that GHA already observed.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
@markoa
markoa marked this pull request as ready for review August 19, 2026 08:32
cursoragent and others added 2 commits August 19, 2026 08:37
firstPythonTest no longer cites the first lexicographic test_*.py file.
Configured pytest testpaths and test/tests directories are searched
first so Django settings modules such as test_settings.py are not
treated as the project's test suite.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
The inferred pytest command now points at src/tests instead of the
Django test_settings module that sorted first by filename.

Co-authored-by: Marko Anastasov <markoa@users.noreply.github.com>
@markoa
markoa merged commit d2c17de into main Aug 19, 2026
1 check passed
@markoa
markoa deleted the cursor/python-provider-532e branch August 19, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants