mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #11757 from sbidoul/inspect-and-install-reports-stable-sbi
Declare inspect and install reports formats to be stable
This commit is contained in:
commit
b5be1da918
8 changed files with 9 additions and 35 deletions
|
@ -10,10 +10,7 @@ environment, including installed distributions.
|
||||||
|
|
||||||
The report is a JSON object with the following properties:
|
The report is a JSON object with the following properties:
|
||||||
|
|
||||||
- `version`: the string `0`, denoting that the inspect command is an experimental
|
- `version`: the string `1`. It will change only if
|
||||||
feature. This value will change to `1`, when the feature is deemed stable after
|
|
||||||
gathering user feedback (likely in pip 22.3 or 23.0). Backward incompatible changes
|
|
||||||
may be introduced in version `1` without notice. After that, it will change only if
|
|
||||||
and when backward incompatible changes are introduced, such as removing mandatory
|
and when backward incompatible changes are introduced, such as removing mandatory
|
||||||
fields or changing the semantics or data type of existing fields. The introduction of
|
fields or changing the semantics or data type of existing fields. The introduction of
|
||||||
backward incompatible changes will follow the usual pip processes such as the
|
backward incompatible changes will follow the usual pip processes such as the
|
||||||
|
@ -72,7 +69,7 @@ this (metadata abriged for brevity):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "0",
|
"version": "1",
|
||||||
"pip_version": "22.2.dev0",
|
"pip_version": "22.2.dev0",
|
||||||
"installed": [
|
"installed": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,10 +23,7 @@ When considering use cases, please bear in mind that
|
||||||
|
|
||||||
The report is a JSON object with the following properties:
|
The report is a JSON object with the following properties:
|
||||||
|
|
||||||
- `version`: the string `0`, denoting that the installation report is an experimental
|
- `version`: the string `1`. It will change only if
|
||||||
feature. This value will change to `1`, when the feature is deemed stable after
|
|
||||||
gathering user feedback (likely in pip 22.3 or 23.0). Backward incompatible changes
|
|
||||||
may be introduced in version `1` without notice. After that, it will change only if
|
|
||||||
and when backward incompatible changes are introduced, such as removing mandatory
|
and when backward incompatible changes are introduced, such as removing mandatory
|
||||||
fields or changing the semantics or data type of existing fields. The introduction of
|
fields or changing the semantics or data type of existing fields. The introduction of
|
||||||
backward incompatible changes will follow the usual pip processes such as the
|
backward incompatible changes will follow the usual pip processes such as the
|
||||||
|
@ -92,7 +89,7 @@ will produce an output similar to this (metadata abriged for brevity):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "0",
|
"version": "1",
|
||||||
"pip_version": "22.2",
|
"pip_version": "22.2",
|
||||||
"install": [
|
"install": [
|
||||||
{
|
{
|
||||||
|
|
2
news/11757.feature.rst
Normal file
2
news/11757.feature.rst
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
The inspect and installation report formats are now declared stabled, and their version
|
||||||
|
has been bumped from ``0`` to ``1``.
|
|
@ -46,11 +46,6 @@ class InspectCommand(Command):
|
||||||
self.parser.insert_option_group(0, self.cmd_opts)
|
self.parser.insert_option_group(0, self.cmd_opts)
|
||||||
|
|
||||||
def run(self, options: Values, args: List[str]) -> int:
|
def run(self, options: Values, args: List[str]) -> int:
|
||||||
logger.warning(
|
|
||||||
"pip inspect is currently an experimental command. "
|
|
||||||
"The output format may change in a future release without prior warning."
|
|
||||||
)
|
|
||||||
|
|
||||||
cmdoptions.check_list_path_option(options)
|
cmdoptions.check_list_path_option(options)
|
||||||
dists = get_environment(options.path).iter_installed_distributions(
|
dists = get_environment(options.path).iter_installed_distributions(
|
||||||
local_only=options.local,
|
local_only=options.local,
|
||||||
|
@ -58,7 +53,7 @@ class InspectCommand(Command):
|
||||||
skip=set(stdlib_pkgs),
|
skip=set(stdlib_pkgs),
|
||||||
)
|
)
|
||||||
output = {
|
output = {
|
||||||
"version": "0",
|
"version": "1",
|
||||||
"pip_version": __version__,
|
"pip_version": __version__,
|
||||||
"installed": [self._dist_to_dict(dist) for dist in dists],
|
"installed": [self._dist_to_dict(dist) for dist in dists],
|
||||||
"environment": default_environment(),
|
"environment": default_environment(),
|
||||||
|
|
|
@ -417,12 +417,6 @@ class InstallCommand(RequirementCommand):
|
||||||
)
|
)
|
||||||
|
|
||||||
if options.json_report_file:
|
if options.json_report_file:
|
||||||
logger.warning(
|
|
||||||
"--report is currently an experimental option. "
|
|
||||||
"The output format may change in a future release "
|
|
||||||
"without prior warning."
|
|
||||||
)
|
|
||||||
|
|
||||||
report = InstallationReport(requirement_set.requirements_to_install)
|
report = InstallationReport(requirement_set.requirements_to_install)
|
||||||
if options.json_report_file == "-":
|
if options.json_report_file == "-":
|
||||||
print_json(data=report.to_dict())
|
print_json(data=report.to_dict())
|
||||||
|
|
|
@ -38,7 +38,7 @@ class InstallationReport:
|
||||||
|
|
||||||
def to_dict(self) -> Dict[str, Any]:
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
"version": "0",
|
"version": "1",
|
||||||
"pip_version": __version__,
|
"pip_version": __version__,
|
||||||
"install": [
|
"install": [
|
||||||
self._install_req_to_dict(ireq) for ireq in self._install_requirements
|
self._install_req_to_dict(ireq) for ireq in self._install_requirements
|
||||||
|
|
|
@ -28,7 +28,7 @@ def test_inspect_basic(simple_script: PipTestEnvironment) -> None:
|
||||||
"""
|
"""
|
||||||
Test default behavior of inspect command.
|
Test default behavior of inspect command.
|
||||||
"""
|
"""
|
||||||
result = simple_script.pip("inspect", allow_stderr_warning=True)
|
result = simple_script.pip("inspect")
|
||||||
report = json.loads(result.stdout)
|
report = json.loads(result.stdout)
|
||||||
installed = report["installed"]
|
installed = report["installed"]
|
||||||
assert len(installed) == 4
|
assert len(installed) == 4
|
||||||
|
|
|
@ -26,7 +26,6 @@ def test_install_report_basic(
|
||||||
str(shared_data.root / "packages/"),
|
str(shared_data.root / "packages/"),
|
||||||
"--report",
|
"--report",
|
||||||
str(report_path),
|
str(report_path),
|
||||||
allow_stderr_warning=True,
|
|
||||||
)
|
)
|
||||||
report = json.loads(report_path.read_text())
|
report = json.loads(report_path.read_text())
|
||||||
assert "install" in report
|
assert "install" in report
|
||||||
|
@ -59,7 +58,6 @@ def test_install_report_dep(
|
||||||
str(shared_data.root / "packages/"),
|
str(shared_data.root / "packages/"),
|
||||||
"--report",
|
"--report",
|
||||||
str(report_path),
|
str(report_path),
|
||||||
allow_stderr_warning=True,
|
|
||||||
)
|
)
|
||||||
report = json.loads(report_path.read_text())
|
report = json.loads(report_path.read_text())
|
||||||
assert len(report["install"]) == 2
|
assert len(report["install"]) == 2
|
||||||
|
@ -78,7 +76,6 @@ def test_install_report_index(script: PipTestEnvironment, tmp_path: Path) -> Non
|
||||||
"Paste[openid]==1.7.5.1",
|
"Paste[openid]==1.7.5.1",
|
||||||
"--report",
|
"--report",
|
||||||
str(report_path),
|
str(report_path),
|
||||||
allow_stderr_warning=True,
|
|
||||||
)
|
)
|
||||||
report = json.loads(report_path.read_text())
|
report = json.loads(report_path.read_text())
|
||||||
assert len(report["install"]) == 2
|
assert len(report["install"]) == 2
|
||||||
|
@ -114,7 +111,6 @@ def test_install_report_vcs_and_wheel_cache(
|
||||||
str(cache_dir),
|
str(cache_dir),
|
||||||
"--report",
|
"--report",
|
||||||
str(report_path),
|
str(report_path),
|
||||||
allow_stderr_warning=True,
|
|
||||||
)
|
)
|
||||||
report = json.loads(report_path.read_text())
|
report = json.loads(report_path.read_text())
|
||||||
assert len(report["install"]) == 1
|
assert len(report["install"]) == 1
|
||||||
|
@ -142,7 +138,6 @@ def test_install_report_vcs_and_wheel_cache(
|
||||||
str(cache_dir),
|
str(cache_dir),
|
||||||
"--report",
|
"--report",
|
||||||
str(report_path),
|
str(report_path),
|
||||||
allow_stderr_warning=True,
|
|
||||||
)
|
)
|
||||||
assert "Using cached pip_test_package" in result.stdout
|
assert "Using cached pip_test_package" in result.stdout
|
||||||
report = json.loads(report_path.read_text())
|
report = json.loads(report_path.read_text())
|
||||||
|
@ -176,7 +171,6 @@ def test_install_report_vcs_editable(
|
||||||
"#egg=pip-test-package",
|
"#egg=pip-test-package",
|
||||||
"--report",
|
"--report",
|
||||||
str(report_path),
|
str(report_path),
|
||||||
allow_stderr_warning=True,
|
|
||||||
)
|
)
|
||||||
report = json.loads(report_path.read_text())
|
report = json.loads(report_path.read_text())
|
||||||
assert len(report["install"]) == 1
|
assert len(report["install"]) == 1
|
||||||
|
@ -203,11 +197,6 @@ def test_install_report_to_stdout(
|
||||||
str(shared_data.root / "packages/"),
|
str(shared_data.root / "packages/"),
|
||||||
"--report",
|
"--report",
|
||||||
"-",
|
"-",
|
||||||
allow_stderr_warning=True,
|
|
||||||
)
|
|
||||||
assert result.stderr == (
|
|
||||||
"WARNING: --report is currently an experimental option. "
|
|
||||||
"The output format may change in a future release without prior warning.\n"
|
|
||||||
)
|
)
|
||||||
report = json.loads(result.stdout)
|
report = json.loads(result.stdout)
|
||||||
assert "install" in report
|
assert "install" in report
|
||||||
|
|
Loading…
Reference in a new issue