Enhancement: parse `install_requires` and `python_requires` in `setup.py`

Abierto
#718 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python, typescript
Área
backend, devtools

Línea de trabajo

Start with the Python scanner in src/core-open/scanners/python-scanner.ts, especially PYTHON_MANIFEST_FILES and the scan loop around lines 1344–1363, then inspect nearby parser tests. Add coverage in test/python-setup-py.test.ts using literal setup.py inputs; never execute the file as Python. Done means literals are extracted with the stated precedence and optional dependency behavior, while dynamic values are skipped without failing the scan.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement help wanted
  • Difficulty: medium
  • Area: Python scanner
Problem

setup.py is in PYTHON_MANIFEST_FILES (src/core-open/scanners/python-scanner.ts, around lines 1251–1260), so a directory that contains only setup.py is treated as a Python project. The scan loop (around lines 1344–1363) parses pyproject.toml, setup.cfg, Pipfile, and requirements files only. There is no parseSetupPy, and no test mentions setup.py as a dependency source.

A setuptools project that has not migrated to pyproject.toml / setup.cfg is discovered, then reported with no dependencies and no runtime, even when the file is a straightforward literal:

setup(
    name="demo",
    python_requires=">=3.11",
    install_requires=[
        "requests>=2.31",
        "flask>=3.0",
    ],
    extras_require={"dev": ["pytest>=7"]},
)

Do not execute setup.py.

Expected behaviour

A conservative, literal reader (regex / small AST of string lists only — no exec, no import of the project) extracts name, python_requires, install_requires, and optionally extras_require when they are string literals or lists of string literals, including the setuptools.setup(...) and from setuptools import setup forms. Dynamic values (install_requires=read_requirements(), computed lists) are skipped, not guessed. python_requires is a runtime fallback, with the same precedence as setup.cfg (pyproject.toml still wins when both exist). Extras are optionalDependencies. A package already in install_requires stays production.

Acceptance
  • A setup.py-only project with literal install_requires and python_requires reports those packages and the Python runtime.
  • extras_require literals are optional rows.
  • A setup.py that only builds its requirements dynamically reports no invented packages and does not fail the scan.
  • pyproject.toml / setup.cfg in the same directory still win for name, runtime, and duplicate package sections.
  • Tests live in a new test/python-setup-py.test.ts. Never run the file as Python.

Lenguaje dominante
TypeScript
Estrellas
4
Forks
3
Merge medio
1 d 22 h
PR fusionados (30 d)
76

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vibgrate/cli

Todos los issues de vibgrate/cli

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.