Skip to content

Support PEP 508 dependency specifications #239

@MarcelBochtler

Description

@MarcelBochtler

I have the following requirements.txt:

pydantic==2.11.7 ; python_full_version < '3.11'

python-inspector is running on a system with Python 3.11, but I'm setting the version to 3.10:

python-inspector --python-version 310 --json-pdt result.json --requirement requirements.txt

This is the result:

  {
    "headers": {
    "tool_name": "python-inspector",
    "tool_homepageurl": "https://github.com/aboutcode-org/python-inspector",
    "tool_version": "0.14.3",
    "options": [
      "--index-url https://pypi.org/simple",
      "--json-pdt result-minimal.json",
      "--operating-system linux",
      "--python-version 310",
      "--requirement requirements-minimal.txt"
    ],
    "notice": "Dependency tree generated with python-inspector.\npython-inspector is a free software tool from nexB Inc. and others.\nVisit https://github.com/aboutcode-org/python-inspector/ for support and download.",
    "warnings": [],
    "errors": []
  },
  "files": [
    {
      "type": "file",
      "path": "requirements-minimal.txt",
      "package_data": [
        {
          "type": "pypi",
          "namespace": null,
          "name": null,
          "version": null,
          "qualifiers": {},
          "subpath": null,
          "primary_language": "Python",
          "description": null,
          "release_date": null,
          "parties": [],
          "keywords": [],
          "homepage_url": null,
          "download_url": null,
          "size": null,
          "sha1": null,
          "md5": null,
          "sha256": null,
          "sha512": null,
          "bug_tracking_url": null,
          "code_view_url": null,
          "vcs_url": null,
          "copyright": null,
          "license_expression": null,
          "declared_license": null,
          "notice_text": null,
          "source_packages": [],
          "file_references": [],
          "extra_data": {},
          "dependencies": [
            {
              "purl": "pkg:pypi/[email protected]",
              "extracted_requirement": "pydantic==2.11.7; python_full_version < \"3.11\"",
              "scope": "install",
              "is_runtime": true,
              "is_optional": false,
              "is_resolved": true,
              "resolved_package": {},
              "extra_data": {
                "is_editable": false,
                "link": null,
                "hash_options": [],
                "is_constraint": false,
                "is_archive": null,
                "is_wheel": false,
                "is_url": null,
                "is_vcs_url": null,
                "is_name_at_url": false,
                "is_local_path": null
              }
            }
          ],
          "repository_homepage_url": null,
          "repository_download_url": null,
          "api_data_url": null,
          "datasource_id": "pip_requirements",
          "purl": null
        }
      ]
    }
  ],
  "packages": [],
  "resolved_dependencies_graph": []
}

The expected outcome would be that the packages and the resolved dependency graph is correctly populated, but because I'm running on python 3.11 this dependency is not considered as relevant, and excluded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions