Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark, in light modeAuto light/dark, in dark modeSkip to content
Python Packaging User Guide
Python Packaging User Guide
Back to top

Recording the Direct URL Origin of installed distributions

This document specifies adirect_url.json file in the*.dist-info directory of an installed distribution, to record theDirect URL Origin of the distribution. The general structure and usage of*.dist-info directories is described inRecording installed projects.

Specification

Thedirect_url.json file MUST be created in the*.dist-infodirectory by installers when installing a distribution from a requirementspecifying a direct URL reference (including a VCS URL).

This file MUST NOT be created when installing a distribution from an othertype of requirement (i.e. name plus version specifier).

This JSON file MUST be a UTF-8 encoded,RFC 8259 compliant, serialization of theDirect URL Data Structure.

Note

When the requested URL has thefile:// scheme and points to a local directory that happens to contain aVCS checkout, installers MUST NOT attempt to infer any VCS information andtherefore MUST NOT output any VCS related information (such asvcs_info)indirect_url.json.

Note

As a general rule, installers should as much as possible preserve theinformation that was provided in the requested URL when generatingdirect_url.json. For example user:password environment variablesshould be preserved andrequested_revision should reflect the revision that wasprovided in the requested URL as faithfully as possible. This information ishoweverenriched with more precise data, such ascommit_id.

Example pip commands and their effect on direct_url.json

Commands that generate adirect_url.json:

  • pipinstallhttps://example.com/app-1.0.tgz

  • pipinstallhttps://example.com/app-1.0.whl

  • pipinstall"app@git+https://example.com/repo/app.git#subdirectory=setup"

  • pipinstall./app

  • pipinstallfile:///home/user/app

  • pipinstall--editable"app@git+https://example.com/repo/app.git#subdirectory=setup"(in which case,url will be the local directory where the git repository has beencloned to, anddir_info will be present with"editable":true and novcs_info will be set)

  • pipinstall-e./app

Commands thatdo not generate adirect_url.json

  • pipinstallapp

  • pipinstallapp--no-index--find-linkshttps://example.com/

History

  • March 2020: This specification was approved throughPEP 610.

On this page

[8]ページ先頭

©2009-2026 Movatter.jp