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

オープン
#718 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, typescript
領域
backend, devtools

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
4
フォーク
3
平均マージ
1日 22時間
マージ済み PR(30日)
76

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vibgrate/cli のほかの issue

vibgrate/cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。