py2docfx 0.1.20.dev2245492__py3-none-any.whl → 0.1.20.dev2246430__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py2docfx/convert_prepare/diagnostics.py +95 -0
- py2docfx/convert_prepare/get_source.py +1 -1
- py2docfx/convert_prepare/package_info.py +27 -37
- py2docfx/convert_prepare/pip_utils.py +156 -19
- py2docfx/convert_prepare/tests/test_get_source.py +1 -3
- py2docfx/convert_prepare/tests/test_package_info.py +1 -159
- py2docfx/docfx_yaml/build_finished.py +1 -1
- {py2docfx-0.1.20.dev2245492.dist-info → py2docfx-0.1.20.dev2246430.dist-info}/METADATA +1 -1
- {py2docfx-0.1.20.dev2245492.dist-info → py2docfx-0.1.20.dev2246430.dist-info}/RECORD +11 -10
- {py2docfx-0.1.20.dev2245492.dist-info → py2docfx-0.1.20.dev2246430.dist-info}/WHEEL +0 -0
- {py2docfx-0.1.20.dev2245492.dist-info → py2docfx-0.1.20.dev2246430.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,95 @@
|
|
1
|
+
# diagnostics.py (or inline with your existing helper module)
|
2
|
+
|
3
|
+
import os, re, json, textwrap
|
4
|
+
from pathlib import Path
|
5
|
+
from py2docfx import PACKAGE_ROOT
|
6
|
+
from py2docfx.docfx_yaml.logger import get_logger, run_async_subprocess
|
7
|
+
|
8
|
+
# Reuse your global install options if you like
|
9
|
+
pip_install_common_options = ["--no-compile", "--disable-pip-version-check", "-vvv"]
|
10
|
+
|
11
|
+
SECRET_PATTERN = re.compile(r"(//[^:/]+:)([^@]+)(@)") # //user:pass@ → //user:****@
|
12
|
+
|
13
|
+
def _mask(s: str) -> str:
|
14
|
+
if not s:
|
15
|
+
return s
|
16
|
+
return SECRET_PATTERN.sub(r"\1****\3", s)
|
17
|
+
|
18
|
+
def _env_var(name: str) -> str:
|
19
|
+
val = os.environ.get(name)
|
20
|
+
return f"{name}={_mask(val)}" if val else f"{name}="
|
21
|
+
|
22
|
+
async def pip_diag_bundle(
|
23
|
+
exe_path: str,
|
24
|
+
package_name: str,
|
25
|
+
extra_install_options: list[str],
|
26
|
+
report_dir: str = "pip_reports",
|
27
|
+
include_metadata_peek: bool = True,
|
28
|
+
):
|
29
|
+
"""
|
30
|
+
Collect a comprehensive diagnostic snapshot for pip in the current venv:
|
31
|
+
- pip/python version
|
32
|
+
- pip config (with origins)
|
33
|
+
- pip debug (platform & tags)
|
34
|
+
- env vars likely to affect pip
|
35
|
+
- pip list (packages in the venv)
|
36
|
+
- dry-run resolver report for the target package (JSON)
|
37
|
+
- optional: METADATA/Requires-Dist peek for any downloaded wheel
|
38
|
+
"""
|
39
|
+
logger = get_logger(__name__)
|
40
|
+
out_dir = Path(PACKAGE_ROOT) / report_dir
|
41
|
+
out_dir.mkdir(parents=True, exist_ok=True)
|
42
|
+
|
43
|
+
# 0) Write a quick "header" file with env context (sanitized)
|
44
|
+
ctx = {
|
45
|
+
"cwd": str(PACKAGE_ROOT),
|
46
|
+
"PIP_INDEX_URL": os.environ.get("PIP_INDEX_URL"),
|
47
|
+
"PIP_EXTRA_INDEX_URL": os.environ.get("PIP_EXTRA_INDEX_URL"),
|
48
|
+
"HTTPS_PROXY": os.environ.get("HTTPS_PROXY") or os.environ.get("https_proxy"),
|
49
|
+
"HTTP_PROXY": os.environ.get("HTTP_PROXY") or os.environ.get("http_proxy"),
|
50
|
+
}
|
51
|
+
(out_dir / "00_env_context.txt").write_text(
|
52
|
+
"\n".join(_env_var(k) for k in ctx.keys()), encoding="utf-8"
|
53
|
+
)
|
54
|
+
|
55
|
+
# 1) pip/python versions
|
56
|
+
await run_async_subprocess(exe_path, ["-m", "pip", "--version"], logger, cwd=PACKAGE_ROOT)
|
57
|
+
await run_async_subprocess(exe_path, ["-c", "import sys; import platform; print(sys.executable); print(sys.version); print(platform.platform())"], logger, cwd=PACKAGE_ROOT)
|
58
|
+
|
59
|
+
# 2) Effective pip config
|
60
|
+
await run_async_subprocess(exe_path, ["-m", "pip", "config", "list", "-v"], logger, cwd=PACKAGE_ROOT) # [2](https://pip.pypa.io/en/stable/topics/configuration.html)
|
61
|
+
|
62
|
+
# 3) Platform & wheel tag info
|
63
|
+
await run_async_subprocess(exe_path, ["-m", "pip", "debug"], logger, cwd=PACKAGE_ROOT) # [3](https://pip.pypa.io/en/stable/cli/pip_debug/)
|
64
|
+
|
65
|
+
# 4) Snapshot venv packages (if any)
|
66
|
+
await run_async_subprocess(exe_path, ["-m", "pip", "list", "--format=freeze"], logger, cwd=PACKAGE_ROOT)
|
67
|
+
|
68
|
+
# 5) Resolver dry run with JSON report (no env changes)
|
69
|
+
report_path = out_dir / f"{package_name.replace('==', '-').replace(' ', '_')}.dryrun.report.json"
|
70
|
+
dry_run_cmd = (
|
71
|
+
["-m", "pip", "install", "--dry-run", "--ignore-installed", "--report", str(report_path)]
|
72
|
+
+ pip_install_common_options
|
73
|
+
+ extra_install_options
|
74
|
+
+ [package_name]
|
75
|
+
)
|
76
|
+
await run_async_subprocess(exe_path, dry_run_cmd, logger, cwd=PACKAGE_ROOT) # [1](https://pip.pypa.io/en/stable/cli/pip_install/)
|
77
|
+
|
78
|
+
# 6) Optional: peek at any already-downloaded wheel METADATA for quick "Requires-Dist" visibility
|
79
|
+
if include_metadata_peek:
|
80
|
+
try:
|
81
|
+
import zipfile, glob
|
82
|
+
wheel_candidates = glob.glob("**/*.whl", recursive=True)
|
83
|
+
wheel_candidates = [w for w in wheel_candidates if "microsoft_teams_ai-2.0.0a1-" in w or "microsoft-teams-ai-2.0.0a1-" in w]
|
84
|
+
if wheel_candidates:
|
85
|
+
wheel_candidates.sort()
|
86
|
+
whl = wheel_candidates[-1]
|
87
|
+
with zipfile.ZipFile(whl) as zf:
|
88
|
+
meta_name = [n for n in zf.namelist() if n.endswith(".dist-info/METADATA")][0]
|
89
|
+
meta_text = zf.read(meta_name).decode("utf-8", "replace")
|
90
|
+
(out_dir / "wheel_METADATA.txt").write_text(meta_text, encoding="utf-8")
|
91
|
+
except Exception as _:
|
92
|
+
# Non-fatal
|
93
|
+
pass
|
94
|
+
|
95
|
+
logger.info(f"[pip-diag] Wrote diagnostic bundle to: {out_dir}")
|
@@ -54,7 +54,7 @@ def update_package_info(executable: str, pkg: PackageInfo, source_folder: str):
|
|
54
54
|
for meta_info in metadata:
|
55
55
|
meta_info_array = meta_info.split(":")
|
56
56
|
meta_field = meta_info_array[0].strip().lower()
|
57
|
-
if meta_field in attrs
|
57
|
+
if meta_field in attrs:
|
58
58
|
setattr(
|
59
59
|
pkg,
|
60
60
|
meta_field,
|
@@ -13,7 +13,7 @@ class PackageInfo:
|
|
13
13
|
path: Source
|
14
14
|
def __init__(self) -> None:
|
15
15
|
pass
|
16
|
-
|
16
|
+
|
17
17
|
@classmethod
|
18
18
|
def report_error(cls, name, value, condition=None):
|
19
19
|
py2docfx_logger = get_logger(__name__)
|
@@ -53,7 +53,6 @@ class PackageInfo:
|
|
53
53
|
|
54
54
|
package_info.version = package_info_dict.get("version", None)
|
55
55
|
package_info.extra_index_url = package_info_dict.get("extra_index_url", None)
|
56
|
-
package_info.extras = package_info_dict.get("extras", [])
|
57
56
|
|
58
57
|
if package_info.install_type == cls.InstallType.SOURCE_CODE:
|
59
58
|
package_info.url = package_info_dict.get("url", None)
|
@@ -94,65 +93,56 @@ class PackageInfo:
|
|
94
93
|
return package_info
|
95
94
|
|
96
95
|
def get_combined_name_version(self):
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
)
|
102
|
-
|
103
|
-
version = getattr(self, "version", None)
|
104
|
-
if not version:
|
105
|
-
return base_name
|
106
|
-
elif re.match("^(<|>|<=|>=|==).+$", version.strip()):
|
107
|
-
return base_name.strip() + version.strip()
|
96
|
+
if not self.version:
|
97
|
+
return self.name
|
98
|
+
elif re.match("^(<|>|<=|>=|==).+$", self.version.strip()):
|
99
|
+
return self.name.strip() + self.version.strip()
|
108
100
|
else:
|
109
|
-
return f"{
|
101
|
+
return f"{self.name.strip()}=={self.version.strip()}"
|
102
|
+
|
103
|
+
def get_install_command(self) -> (str, []):
|
104
|
+
packageInstallName = ""
|
105
|
+
pipInstallExtraOptions = []
|
110
106
|
|
111
|
-
def get_install_command(self) -> tuple[str, list]:
|
112
107
|
if self.install_type == self.InstallType.DIST_FILE:
|
113
|
-
if
|
108
|
+
if hasattr(self, "location") and self.location:
|
109
|
+
packageInstallName = self.location
|
110
|
+
else:
|
114
111
|
self.__class__.report_error(
|
115
112
|
"location", "None", condition="When install_type is dist_file"
|
116
113
|
)
|
117
|
-
return (
|
118
|
-
f"{self.location}[{','.join(extras)}]"
|
119
|
-
if (extras := getattr(self, "extras", None))
|
120
|
-
else self.location,
|
121
|
-
[],
|
122
|
-
)
|
123
114
|
|
124
|
-
|
115
|
+
elif self.install_type == self.InstallType.PYPI:
|
125
116
|
if not hasattr(self, "name") or not self.name:
|
126
117
|
self.__class__.report_error(
|
127
118
|
"name", "None", condition="When install_type is pypi"
|
128
119
|
)
|
129
|
-
|
130
|
-
|
120
|
+
if hasattr(self, "version") and self.version:
|
121
|
+
packageInstallName = self.get_combined_name_version()
|
122
|
+
else:
|
123
|
+
packageInstallName = self.name
|
131
124
|
pipInstallExtraOptions.append("--upgrade")
|
125
|
+
|
132
126
|
if hasattr(self, "extra_index_url") and self.extra_index_url:
|
133
127
|
pipInstallExtraOptions.extend(
|
134
128
|
["--extra-index-url", self.extra_index_url]
|
135
129
|
)
|
136
|
-
return (self.get_combined_name_version(), pipInstallExtraOptions)
|
137
130
|
|
138
|
-
|
139
|
-
if
|
131
|
+
elif self.install_type == self.InstallType.SOURCE_CODE:
|
132
|
+
if hasattr(self, "path") and self.path.source_folder:
|
133
|
+
packageInstallName = self.path.source_folder
|
134
|
+
else:
|
140
135
|
self.__class__.report_error(
|
141
136
|
"path.source_folder",
|
142
137
|
"None",
|
143
138
|
condition="When install_type is source_code",
|
144
139
|
)
|
145
|
-
|
146
|
-
|
147
|
-
if (extras := getattr(self, "extras", None))
|
148
|
-
else self.path.source_folder,
|
149
|
-
[],
|
150
|
-
)
|
151
|
-
|
152
|
-
self.__class__.report_error("install_type", self.install_type)
|
140
|
+
else:
|
141
|
+
self.__class__.report_error("install_type", self.install_type)
|
153
142
|
|
143
|
+
return (packageInstallName, pipInstallExtraOptions)
|
154
144
|
|
155
|
-
def get_exluded_command(self) ->
|
145
|
+
def get_exluded_command(self) -> []:
|
156
146
|
py2docfx_logger = get_logger(__name__)
|
157
147
|
if hasattr(self, "path"):
|
158
148
|
code_location = self.path.source_folder
|
@@ -1,25 +1,70 @@
|
|
1
|
+
import os
|
1
2
|
import sys
|
3
|
+
from pathlib import Path
|
2
4
|
|
3
5
|
from py2docfx import PACKAGE_ROOT
|
4
6
|
from py2docfx.docfx_yaml.logger import get_logger, run_async_subprocess, run_async_subprocess_without_executable
|
5
7
|
|
8
|
+
# NEW: diagnostics import
|
9
|
+
try:
|
10
|
+
from diagnostics import pip_diag_bundle
|
11
|
+
except Exception:
|
12
|
+
pip_diag_bundle = None # tolerate missing diagnostics in non-CI runs
|
13
|
+
|
6
14
|
PYPI = "pypi"
|
7
15
|
|
16
|
+
# Keep your original common options; build commands as lists (no .split())
|
8
17
|
pip_install_common_options = [
|
9
|
-
# "--no-cache-dir", # to reduce install duration after switching to each venv
|
10
|
-
"--quiet",
|
11
18
|
"--no-compile",
|
12
|
-
"--no-warn-conflicts",
|
13
19
|
"--disable-pip-version-check",
|
14
|
-
"
|
20
|
+
"-vvv",
|
15
21
|
]
|
16
22
|
|
23
|
+
# --- NEW: helpers -------------------------------------------------------------
|
24
|
+
|
25
|
+
def _diag_enabled() -> bool:
|
26
|
+
# Enable by default in CI; allow opt-out with PY2DOCFX_PIP_DIAG=0
|
27
|
+
v = os.environ.get("PY2DOCFX_PIP_DIAG", "1").strip()
|
28
|
+
return v not in ("0", "false", "False", "")
|
29
|
+
|
30
|
+
def _report_dir() -> str:
|
31
|
+
return os.environ.get("PY2DOCFX_PIP_REPORT_DIR", "pip_reports")
|
32
|
+
|
33
|
+
def build_index_options(
|
34
|
+
index_url: str | None = None,
|
35
|
+
extra_index_urls: list[str] | None = None,
|
36
|
+
trusted_hosts: list[str] | None = None,
|
37
|
+
constraints_file: str | None = None,
|
38
|
+
) -> list[str]:
|
39
|
+
"""
|
40
|
+
Build pip CLI options for index and constraints.
|
41
|
+
Use this from call sites to pass consistent resolution settings.
|
42
|
+
"""
|
43
|
+
opts: list[str] = []
|
44
|
+
if index_url:
|
45
|
+
opts += ["--index-url", index_url]
|
46
|
+
if extra_index_urls:
|
47
|
+
for u in extra_index_urls:
|
48
|
+
if u:
|
49
|
+
opts += ["--extra-index-url", u]
|
50
|
+
if trusted_hosts:
|
51
|
+
for h in trusted_hosts:
|
52
|
+
if h:
|
53
|
+
opts += ["--trusted-host", h]
|
54
|
+
if constraints_file:
|
55
|
+
opts += ["-c", constraints_file]
|
56
|
+
return opts
|
57
|
+
|
58
|
+
# --- Existing functions with improvements ------------------------------------
|
59
|
+
|
17
60
|
async def download(package_name, path, extra_index_url=None, prefer_source_distribution=True):
|
18
|
-
|
61
|
+
"""
|
62
|
+
Downloads a package from PyPI (or other index) to the specified path using pip.
|
63
|
+
"""
|
19
64
|
download_param = ["pip", "download", "--dest", path, "--no-deps", package_name]
|
20
65
|
if extra_index_url:
|
21
|
-
|
22
|
-
download_param.
|
66
|
+
# Note: For multiple mirrors use build_index_options and pass through install() signatures instead.
|
67
|
+
download_param.extend(["--extra-index-url", extra_index_url])
|
23
68
|
if prefer_source_distribution:
|
24
69
|
download_param.append("--no-binary=:all:")
|
25
70
|
else:
|
@@ -28,23 +73,115 @@ async def download(package_name, path, extra_index_url=None, prefer_source_distr
|
|
28
73
|
py2docfx_logger = get_logger(__name__)
|
29
74
|
await run_async_subprocess_without_executable(download_param, py2docfx_logger, cwd=PACKAGE_ROOT)
|
30
75
|
|
76
|
+
|
31
77
|
async def install(package_name, options):
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
78
|
+
"""
|
79
|
+
Installs a package using the *current* Python (no explicit exe).
|
80
|
+
Retains the original signature; enable diagnostics via env var.
|
81
|
+
"""
|
36
82
|
py2docfx_logger = get_logger(__name__)
|
37
|
-
|
83
|
+
|
84
|
+
# --- NEW: preflight diagnostics
|
85
|
+
if _diag_enabled() and pip_diag_bundle is not None:
|
86
|
+
try:
|
87
|
+
await pip_diag_bundle(
|
88
|
+
sys.executable,
|
89
|
+
package_name,
|
90
|
+
options,
|
91
|
+
report_dir=_report_dir(),
|
92
|
+
)
|
93
|
+
except Exception as _:
|
94
|
+
# Non-fatal: we still attempt the real install
|
95
|
+
pass
|
96
|
+
|
97
|
+
# Build the actual pip command (as list)
|
98
|
+
install_cmd = ["pip", "install"] + pip_install_common_options + options + [package_name]
|
99
|
+
try:
|
100
|
+
await run_async_subprocess_without_executable(install_cmd, py2docfx_logger, cwd=PACKAGE_ROOT)
|
101
|
+
except Exception:
|
102
|
+
# --- NEW: after-failure diagnostics
|
103
|
+
if _diag_enabled() and pip_diag_bundle is not None:
|
104
|
+
try:
|
105
|
+
await pip_diag_bundle(
|
106
|
+
sys.executable,
|
107
|
+
package_name,
|
108
|
+
options,
|
109
|
+
report_dir=os.path.join(_report_dir(), "after_failure"),
|
110
|
+
)
|
111
|
+
except Exception:
|
112
|
+
pass
|
113
|
+
raise
|
114
|
+
|
38
115
|
|
39
116
|
async def install_in_exe(exe_path, package_name, options):
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
117
|
+
"""
|
118
|
+
Installs a package using the *given* Python executable path.
|
119
|
+
FIX: don't duplicate exe_path in argv; pass "-m pip ..." only.
|
120
|
+
"""
|
44
121
|
py2docfx_logger = get_logger(__name__)
|
45
|
-
|
122
|
+
|
123
|
+
# --- NEW: preflight diagnostics
|
124
|
+
if _diag_enabled() and pip_diag_bundle is not None:
|
125
|
+
try:
|
126
|
+
await pip_diag_bundle(
|
127
|
+
exe_path,
|
128
|
+
package_name,
|
129
|
+
options,
|
130
|
+
report_dir=_report_dir(),
|
131
|
+
)
|
132
|
+
except Exception:
|
133
|
+
pass
|
134
|
+
|
135
|
+
# Correct pip invocation: exe_path runs, args start with -m pip
|
136
|
+
pip_cmd = ["-m", "pip", "install"] + pip_install_common_options + options + [package_name]
|
137
|
+
try:
|
138
|
+
await run_async_subprocess(exe_path, pip_cmd, py2docfx_logger, cwd=PACKAGE_ROOT)
|
139
|
+
except Exception:
|
140
|
+
# --- NEW: after-failure diagnostics
|
141
|
+
if _diag_enabled() and pip_diag_bundle is not None:
|
142
|
+
try:
|
143
|
+
await pip_diag_bundle(
|
144
|
+
exe_path,
|
145
|
+
package_name,
|
146
|
+
options,
|
147
|
+
report_dir=os.path.join(_report_dir(), "after_failure"),
|
148
|
+
)
|
149
|
+
except Exception:
|
150
|
+
pass
|
151
|
+
raise
|
152
|
+
|
46
153
|
|
47
154
|
async def install_in_exe_async(exe_path, package_name, options):
|
48
|
-
|
155
|
+
"""
|
156
|
+
Keeps the original async install; now includes diagnostics.
|
157
|
+
"""
|
49
158
|
py2docfx_logger = get_logger(__name__)
|
50
|
-
|
159
|
+
|
160
|
+
# --- NEW: preflight diagnostics
|
161
|
+
if _diag_enabled() and pip_diag_bundle is not None:
|
162
|
+
try:
|
163
|
+
await pip_diag_bundle(
|
164
|
+
exe_path,
|
165
|
+
package_name,
|
166
|
+
options,
|
167
|
+
report_dir=_report_dir(),
|
168
|
+
)
|
169
|
+
except Exception:
|
170
|
+
pass
|
171
|
+
|
172
|
+
pip_cmd = ["-m", "pip", "install"] + pip_install_common_options + options + [package_name]
|
173
|
+
try:
|
174
|
+
await run_async_subprocess(exe_path, pip_cmd, py2docfx_logger, cwd=PACKAGE_ROOT)
|
175
|
+
except Exception:
|
176
|
+
# --- NEW: after-failure diagnostics
|
177
|
+
if _diag_enabled() and pip_diag_bundle is not None:
|
178
|
+
try:
|
179
|
+
await pip_diag_bundle(
|
180
|
+
exe_path,
|
181
|
+
package_name,
|
182
|
+
options,
|
183
|
+
report_dir=os.path.join(_report_dir(), "after_failure"),
|
184
|
+
)
|
185
|
+
except Exception:
|
186
|
+
pass
|
187
|
+
raise
|
@@ -50,10 +50,8 @@ def test_update_package_info(init_package_info):
|
|
50
50
|
assert package.name == "dummy_package"
|
51
51
|
assert package.version == "3.1.0"
|
52
52
|
|
53
|
-
# case of metadata
|
53
|
+
# case of metadata
|
54
54
|
package = init_package_info
|
55
|
-
del package.name
|
56
|
-
del package.version
|
57
55
|
get_source.update_package_info(sys.executable, package, os.path.join(base_path, "mock-2"))
|
58
56
|
assert package.name == "mock_package"
|
59
57
|
assert package.version == "2.2.0"
|
@@ -80,162 +80,4 @@ def test_get_exclude_command_check_extra_exclude(tmp_path):
|
|
80
80
|
]
|
81
81
|
def form_exclude_path(raletive_path):
|
82
82
|
return os.path.join(source_folder, raletive_path)
|
83
|
-
assert exclude_path == [form_exclude_path(path) for path in expected_exclude_path]
|
84
|
-
|
85
|
-
|
86
|
-
def test_get_combined_name_version_with_extras():
|
87
|
-
"""Test get_combined_name_version with extras"""
|
88
|
-
# Test package with extras but no version
|
89
|
-
test_data = {
|
90
|
-
"package_info": {
|
91
|
-
"install_type": "pypi",
|
92
|
-
"name": "test-package",
|
93
|
-
"extras": ["dev", "test"],
|
94
|
-
},
|
95
|
-
}
|
96
|
-
pkg = PackageInfo.parse_from(test_data)
|
97
|
-
assert pkg.get_combined_name_version() == "test-package[dev,test]"
|
98
|
-
|
99
|
-
# Test package with extras and version
|
100
|
-
test_data_with_version = {
|
101
|
-
"package_info": {
|
102
|
-
"install_type": "pypi",
|
103
|
-
"name": "test-package",
|
104
|
-
"version": "1.0.0",
|
105
|
-
"extras": ["dev", "test"],
|
106
|
-
},
|
107
|
-
}
|
108
|
-
pkg_with_version = PackageInfo.parse_from(test_data_with_version)
|
109
|
-
assert (
|
110
|
-
pkg_with_version.get_combined_name_version() == "test-package[dev,test]==1.0.0"
|
111
|
-
)
|
112
|
-
|
113
|
-
# Test package with extras and version operator
|
114
|
-
test_data_with_operator = {
|
115
|
-
"package_info": {
|
116
|
-
"install_type": "pypi",
|
117
|
-
"name": "test-package",
|
118
|
-
"version": ">=1.0.0",
|
119
|
-
"extras": ["dev"],
|
120
|
-
},
|
121
|
-
}
|
122
|
-
pkg_with_operator = PackageInfo.parse_from(test_data_with_operator)
|
123
|
-
assert pkg_with_operator.get_combined_name_version() == "test-package[dev]>=1.0.0"
|
124
|
-
|
125
|
-
|
126
|
-
def test_install_command_pypi_with_extras():
|
127
|
-
"""Test get_install_command for PYPI packages with extras"""
|
128
|
-
# Test PYPI package with extras and version
|
129
|
-
test_data = {
|
130
|
-
"package_info": {
|
131
|
-
"install_type": "pypi",
|
132
|
-
"name": "test-package",
|
133
|
-
"version": "1.0.0",
|
134
|
-
"extras": ["dev", "test"],
|
135
|
-
},
|
136
|
-
}
|
137
|
-
pkg = PackageInfo.parse_from(test_data)
|
138
|
-
install_command = pkg.get_install_command()
|
139
|
-
assert install_command[0] == "test-package[dev,test]==1.0.0"
|
140
|
-
assert install_command[1] == []
|
141
|
-
|
142
|
-
# Test PYPI package with extras but no version (should get --upgrade)
|
143
|
-
test_data_no_version = {
|
144
|
-
"package_info": {
|
145
|
-
"install_type": "pypi",
|
146
|
-
"name": "test-package",
|
147
|
-
"extras": ["dev"],
|
148
|
-
},
|
149
|
-
}
|
150
|
-
pkg_no_version = PackageInfo.parse_from(test_data_no_version)
|
151
|
-
install_command = pkg_no_version.get_install_command()
|
152
|
-
assert install_command[0] == "test-package[dev]"
|
153
|
-
assert install_command[1] == ["--upgrade"]
|
154
|
-
|
155
|
-
|
156
|
-
def test_install_command_source_code_with_extras(tmp_path):
|
157
|
-
"""Test get_install_command for SOURCE_CODE packages with extras"""
|
158
|
-
source_folder = os.path.join(tmp_path, "source_folder")
|
159
|
-
yaml_output_folder = os.path.join(tmp_path, "yaml_output_folder")
|
160
|
-
|
161
|
-
test_data = {
|
162
|
-
"package_info": {
|
163
|
-
"install_type": "source_code",
|
164
|
-
"name": "test-package",
|
165
|
-
"url": "https://github.com/test/test-package.git",
|
166
|
-
"extras": ["dev", "test"],
|
167
|
-
},
|
168
|
-
}
|
169
|
-
pkg = PackageInfo.parse_from(test_data)
|
170
|
-
pkg.path = Source(
|
171
|
-
source_folder=source_folder,
|
172
|
-
yaml_output_folder=yaml_output_folder,
|
173
|
-
package_name="test-package",
|
174
|
-
)
|
175
|
-
|
176
|
-
install_command = pkg.get_install_command()
|
177
|
-
assert install_command[0] == f"{source_folder}[dev,test]"
|
178
|
-
assert install_command[1] == []
|
179
|
-
|
180
|
-
|
181
|
-
def test_install_command_dist_file_with_extras():
|
182
|
-
"""Test get_install_command for DIST_FILE packages with extras"""
|
183
|
-
test_data = {
|
184
|
-
"package_info": {
|
185
|
-
"install_type": "dist_file",
|
186
|
-
"location": "/path/to/package.whl",
|
187
|
-
"extras": ["dev"],
|
188
|
-
},
|
189
|
-
}
|
190
|
-
pkg = PackageInfo.parse_from(test_data)
|
191
|
-
install_command = pkg.get_install_command()
|
192
|
-
assert install_command[0] == "/path/to/package.whl[dev]"
|
193
|
-
assert install_command[1] == []
|
194
|
-
|
195
|
-
|
196
|
-
def test_install_command_without_extras():
|
197
|
-
"""Test that packages without extras work as before"""
|
198
|
-
# Test PYPI package without extras
|
199
|
-
test_data = {
|
200
|
-
"package_info": {
|
201
|
-
"install_type": "pypi",
|
202
|
-
"name": "test-package",
|
203
|
-
"version": "1.0.0",
|
204
|
-
}
|
205
|
-
}
|
206
|
-
pkg = PackageInfo.parse_from(test_data)
|
207
|
-
install_command = pkg.get_install_command()
|
208
|
-
assert install_command[0] == "test-package==1.0.0"
|
209
|
-
assert install_command[1] == []
|
210
|
-
|
211
|
-
|
212
|
-
def test_install_command_empty_extras():
|
213
|
-
"""Test that packages with empty extras list work correctly"""
|
214
|
-
test_data = {
|
215
|
-
"package_info": {
|
216
|
-
"install_type": "pypi",
|
217
|
-
"name": "test-package",
|
218
|
-
"version": "1.0.0",
|
219
|
-
"extras": [],
|
220
|
-
},
|
221
|
-
}
|
222
|
-
pkg = PackageInfo.parse_from(test_data)
|
223
|
-
install_command = pkg.get_install_command()
|
224
|
-
assert install_command[0] == "test-package==1.0.0"
|
225
|
-
assert install_command[1] == []
|
226
|
-
|
227
|
-
|
228
|
-
def test_install_command_single_extra():
|
229
|
-
"""Test package with single extra"""
|
230
|
-
test_data = {
|
231
|
-
"package_info": {
|
232
|
-
"install_type": "pypi",
|
233
|
-
"name": "test-package",
|
234
|
-
"version": "1.0.0",
|
235
|
-
"extras": ["dev"],
|
236
|
-
},
|
237
|
-
}
|
238
|
-
pkg = PackageInfo.parse_from(test_data)
|
239
|
-
install_command = pkg.get_install_command()
|
240
|
-
assert install_command[0] == "test-package[dev]==1.0.0"
|
241
|
-
assert install_command[1] == []
|
83
|
+
assert exclude_path == [form_exclude_path(path) for path in expected_exclude_path]
|
@@ -277,7 +277,7 @@ def build_finished(app, exception):
|
|
277
277
|
obj['kind'] = 'import'
|
278
278
|
package_obj = obj
|
279
279
|
|
280
|
-
if (obj['type'] == 'class' and 'inheritance'
|
280
|
+
if (obj['type'] == 'class' and obj['inheritance']):
|
281
281
|
convert_class_to_enum_if_needed(obj)
|
282
282
|
|
283
283
|
is_root = insert_node_to_toc_tree_return_is_root_package(toc_yaml, uid, project_name, toc_node_map)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: py2docfx
|
3
|
-
Version: 0.1.20.
|
3
|
+
Version: 0.1.20.dev2246430
|
4
4
|
Summary: A package built based on Sphinx which download source code package and generate yaml files supported by docfx.
|
5
5
|
Author: Microsoft Corporation
|
6
6
|
License: MIT License
|
@@ -3,18 +3,19 @@ py2docfx/__main__.py,sha256=NDKRx5RhLJP6Z6zFEdGZJje69jxPaGeHLU_2e5GYUO4,5958
|
|
3
3
|
py2docfx/convert_prepare/__init__.py,sha256=XxtxrP0kmW3ZBHIAoxsPDEHzcgeC0WSnole8Lk6CjKs,11
|
4
4
|
py2docfx/convert_prepare/arg_parser.py,sha256=7goU287AjAyKGd9d5QKcphMCQOrlPnKpQ_YtdwLSNT8,7618
|
5
5
|
py2docfx/convert_prepare/constants.py,sha256=RC5DqNkqWvx4hb91FrajZ1R9dBFLxcPyoEJ43jdm36E,102
|
6
|
+
py2docfx/convert_prepare/diagnostics.py,sha256=UYrpzriS9qNRJianh5xxucsUOR2Jd_8_n4e6lOTuDrY,4334
|
6
7
|
py2docfx/convert_prepare/environment.py,sha256=CF8g2hnpwFXsTfvp1O8lwYpR848iCK8bDM2UAWqibEQ,7286
|
7
8
|
py2docfx/convert_prepare/generate_conf.py,sha256=wqs6iyElzJarH-20_qEL9zvZvt5xfBMsGXSXPSZy6wg,2295
|
8
9
|
py2docfx/convert_prepare/generate_document.py,sha256=iTOCMBwkfvZEj5dlEGUq4qynUodaYxJuIrG9R5eGk38,2949
|
9
|
-
py2docfx/convert_prepare/get_source.py,sha256=
|
10
|
+
py2docfx/convert_prepare/get_source.py,sha256=I_-QXXFFraMruDf13xlkwGAs5hDuv-wAjW3w-ylOw2Q,6930
|
10
11
|
py2docfx/convert_prepare/git.py,sha256=Cq76ooxejKlVJiJWWbBhbLZ_JvxqN2ka12L8jkl80b4,6492
|
11
12
|
py2docfx/convert_prepare/install_package.py,sha256=aJxQBwLRPTIKpdtLVl-SaXPaF_OX_H1ZtWmcKD8Zzuk,274
|
12
13
|
py2docfx/convert_prepare/pack.py,sha256=Jjj9ps8ESoKUFmSk6VgNmxOwMhuwirnQ-rhqigH-4VY,1578
|
13
|
-
py2docfx/convert_prepare/package_info.py,sha256
|
14
|
+
py2docfx/convert_prepare/package_info.py,sha256=-zrMNeAkHxxzLRjBl1kRehUJy_ugc16yns-xdcAHQIQ,7711
|
14
15
|
py2docfx/convert_prepare/package_info_extra_settings.py,sha256=u5B5e8hc0m9PA_-0kJzq1LtKn-xzZlucwXHTFy49mDg,1475
|
15
16
|
py2docfx/convert_prepare/params.py,sha256=PXMB8pLtb4XbfI322avA47q0AO-TyBE6kZf7FU8I6v4,1771
|
16
17
|
py2docfx/convert_prepare/paths.py,sha256=964RX81Qf__rzXgEATfqBNFCKTYVjLt9J7WCz2TnNdc,485
|
17
|
-
py2docfx/convert_prepare/pip_utils.py,sha256=
|
18
|
+
py2docfx/convert_prepare/pip_utils.py,sha256=6zK3f7k5bAK_kV07I5IfDEMApPjy5_e8wPHLwWwow88,6470
|
18
19
|
py2docfx/convert_prepare/repo_info.py,sha256=6ASJlhBwf6vZTSENgrWCVlJjlJVhuBxzdQyWEdWAC4c,117
|
19
20
|
py2docfx/convert_prepare/source.py,sha256=6-A7oof3-WAQcQZZVpT9pKiFLH4CCIZeYqq0MN0O3gw,1710
|
20
21
|
py2docfx/convert_prepare/sphinx_caller.py,sha256=iyalaxdhcMpiUsPEziEgH7v7cd5Zpx8KeD11iCULGbc,4696
|
@@ -28,9 +29,9 @@ py2docfx/convert_prepare/subpackage_merge/merge_toc.py,sha256=nkVqe8R0m8D6cyTYV7
|
|
28
29
|
py2docfx/convert_prepare/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
30
|
py2docfx/convert_prepare/tests/test_environment.py,sha256=oJ_IuVQ-zwWNQZRXR74RDWVaWQ76aUl_HjtOx3QuU6E,3709
|
30
31
|
py2docfx/convert_prepare/tests/test_generate_document.py,sha256=mY8DRT-WRGIBFdDRdFwa7ZSUQwR-fTQtyKwzrzFZLU8,2621
|
31
|
-
py2docfx/convert_prepare/tests/test_get_source.py,sha256=
|
32
|
+
py2docfx/convert_prepare/tests/test_get_source.py,sha256=IGBLAemm5SWUnNJJh6GJE5gBtAAdlC_cxS1xSeugzBI,7949
|
32
33
|
py2docfx/convert_prepare/tests/test_pack.py,sha256=Gw-LkIcbQuQHpoSbvkybYt4_fVw-LL12dceWw5AUKdE,4242
|
33
|
-
py2docfx/convert_prepare/tests/test_package_info.py,sha256=
|
34
|
+
py2docfx/convert_prepare/tests/test_package_info.py,sha256=3B-IzmUjETVO-5s3g3Lmh2E6JgopwnRauv8mB-SDZEM,3361
|
34
35
|
py2docfx/convert_prepare/tests/test_params.py,sha256=itwmVdBMtU1qIXAGaIoaDfvTOYyAL2B_WLsaBV9KUZY,2232
|
35
36
|
py2docfx/convert_prepare/tests/test_post_process_merge_toc.py,sha256=YKOcn4_lf4syGsAvJ9BqpdUUc3SLfK4TiOX1lpXJT_Y,885
|
36
37
|
py2docfx/convert_prepare/tests/test_source.py,sha256=LNFZtvjz6QhVLOxatjWokYCCcoSm0bhTikMF9KoTPIE,2025
|
@@ -57,7 +58,7 @@ py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure
|
|
57
58
|
py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
58
59
|
py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
59
60
|
py2docfx/docfx_yaml/__init__.py,sha256=KCEizAXv-SXtrYhvFfLHdBWDhz51AA9uagaeTL-Itpo,100
|
60
|
-
py2docfx/docfx_yaml/build_finished.py,sha256=
|
61
|
+
py2docfx/docfx_yaml/build_finished.py,sha256=H4ZtUHMgBEHIFh2QqI1kae8ixlintAryadnz4nQhurs,14078
|
61
62
|
py2docfx/docfx_yaml/build_init.py,sha256=lAw-fnBVQbySfZ7Sut_NpFQUjnqLOmnGQrTBBH2RXcg,1860
|
62
63
|
py2docfx/docfx_yaml/common.py,sha256=UN1MUmjUoN1QSFDR1Cm_bfRuHr6FQiOe5VQV6s8xzjc,6841
|
63
64
|
py2docfx/docfx_yaml/convert_class.py,sha256=YaPjxqNy0p6AXi3H3T0l1MZeYRZ3dWkqusO4E0KT9QU,2161
|
@@ -3915,7 +3916,7 @@ py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/convert.py,sha256=0wSJMU0m
|
|
3915
3916
|
py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/pack.py,sha256=o3iwjfRHl7N9ul-M2kHbewLJZnqBLAWf0tzUCwoiTMw,3078
|
3916
3917
|
py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/tags.py,sha256=Rv2ySVb8-qX3osKp3uJgxcIMXkjt43XUD0-zvC6KvnY,4775
|
3917
3918
|
py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/unpack.py,sha256=Y_J7ynxPSoFFTT7H0fMgbBlVErwyDGcObgme5MBuz58,1021
|
3918
|
-
py2docfx-0.1.20.
|
3919
|
-
py2docfx-0.1.20.
|
3920
|
-
py2docfx-0.1.20.
|
3921
|
-
py2docfx-0.1.20.
|
3919
|
+
py2docfx-0.1.20.dev2246430.dist-info/METADATA,sha256=Kky-dbJ4q8dEb_tU_5BQC0iR-d8IpCYo7oxbAVbRZM4,548
|
3920
|
+
py2docfx-0.1.20.dev2246430.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
3921
|
+
py2docfx-0.1.20.dev2246430.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
|
3922
|
+
py2docfx-0.1.20.dev2246430.dist-info/RECORD,,
|
File without changes
|
File without changes
|