py2docfx 0.1.20.dev2245492__py3-none-any.whl → 0.1.20.dev2246325__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.
@@ -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 and not hasattr(pkg, meta_field):
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
- base_name = (
98
- f"{self.name}[{','.join(extras)}]"
99
- if (extras := getattr(self, "extras", []))
100
- else self.name
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"{base_name.strip()}=={version.strip()}"
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 not hasattr(self, "location") or not self.location:
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
- if self.install_type == self.InstallType.PYPI:
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
- pipInstallExtraOptions = []
130
- if not hasattr(self, "version") or self.version is None:
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
- if self.install_type == self.InstallType.SOURCE_CODE:
139
- if not hasattr(self, "path") or not self.path.source_folder:
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
- return (
146
- f"{self.path.source_folder}[{','.join(extras)}]"
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) -> list:
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
@@ -7,11 +7,9 @@ PYPI = "pypi"
7
7
 
8
8
  pip_install_common_options = [
9
9
  # "--no-cache-dir", # to reduce install duration after switching to each venv
10
- "--quiet",
11
10
  "--no-compile",
12
- "--no-warn-conflicts",
13
11
  "--disable-pip-version-check",
14
- "--verbose"
12
+ "-vvv"
15
13
  ]
16
14
 
17
15
  async def download(package_name, path, extra_index_url=None, prefer_source_distribution=True):
@@ -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, unly use metadata file as a fallback
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' in obj):
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.dev2245492
3
+ Version: 0.1.20.dev2246325
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
@@ -6,15 +6,15 @@ py2docfx/convert_prepare/constants.py,sha256=RC5DqNkqWvx4hb91FrajZ1R9dBFLxcPyoEJ
6
6
  py2docfx/convert_prepare/environment.py,sha256=CF8g2hnpwFXsTfvp1O8lwYpR848iCK8bDM2UAWqibEQ,7286
7
7
  py2docfx/convert_prepare/generate_conf.py,sha256=wqs6iyElzJarH-20_qEL9zvZvt5xfBMsGXSXPSZy6wg,2295
8
8
  py2docfx/convert_prepare/generate_document.py,sha256=iTOCMBwkfvZEj5dlEGUq4qynUodaYxJuIrG9R5eGk38,2949
9
- py2docfx/convert_prepare/get_source.py,sha256=eSRnMppk1U9N6wmvmOmQb6tClpDLwXcyrhkwbid5lE0,6963
9
+ py2docfx/convert_prepare/get_source.py,sha256=I_-QXXFFraMruDf13xlkwGAs5hDuv-wAjW3w-ylOw2Q,6930
10
10
  py2docfx/convert_prepare/git.py,sha256=Cq76ooxejKlVJiJWWbBhbLZ_JvxqN2ka12L8jkl80b4,6492
11
11
  py2docfx/convert_prepare/install_package.py,sha256=aJxQBwLRPTIKpdtLVl-SaXPaF_OX_H1ZtWmcKD8Zzuk,274
12
12
  py2docfx/convert_prepare/pack.py,sha256=Jjj9ps8ESoKUFmSk6VgNmxOwMhuwirnQ-rhqigH-4VY,1578
13
- py2docfx/convert_prepare/package_info.py,sha256=K9bkS--64XEfyZTYS3ms1xGEgy3tdAWav94wj-7BBnw,8126
13
+ py2docfx/convert_prepare/package_info.py,sha256=-zrMNeAkHxxzLRjBl1kRehUJy_ugc16yns-xdcAHQIQ,7711
14
14
  py2docfx/convert_prepare/package_info_extra_settings.py,sha256=u5B5e8hc0m9PA_-0kJzq1LtKn-xzZlucwXHTFy49mDg,1475
15
15
  py2docfx/convert_prepare/params.py,sha256=PXMB8pLtb4XbfI322avA47q0AO-TyBE6kZf7FU8I6v4,1771
16
16
  py2docfx/convert_prepare/paths.py,sha256=964RX81Qf__rzXgEATfqBNFCKTYVjLt9J7WCz2TnNdc,485
17
- py2docfx/convert_prepare/pip_utils.py,sha256=Y_xmIE0Ld-gXgR8rkXSfj-AMh1bcUJvscMgSdNZyPQU,2138
17
+ py2docfx/convert_prepare/pip_utils.py,sha256=K433XE1aSczgdD2AUtOQOp4RtVaSMk3EUqAJ7qpj8t0,2089
18
18
  py2docfx/convert_prepare/repo_info.py,sha256=6ASJlhBwf6vZTSENgrWCVlJjlJVhuBxzdQyWEdWAC4c,117
19
19
  py2docfx/convert_prepare/source.py,sha256=6-A7oof3-WAQcQZZVpT9pKiFLH4CCIZeYqq0MN0O3gw,1710
20
20
  py2docfx/convert_prepare/sphinx_caller.py,sha256=iyalaxdhcMpiUsPEziEgH7v7cd5Zpx8KeD11iCULGbc,4696
@@ -28,9 +28,9 @@ py2docfx/convert_prepare/subpackage_merge/merge_toc.py,sha256=nkVqe8R0m8D6cyTYV7
28
28
  py2docfx/convert_prepare/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  py2docfx/convert_prepare/tests/test_environment.py,sha256=oJ_IuVQ-zwWNQZRXR74RDWVaWQ76aUl_HjtOx3QuU6E,3709
30
30
  py2docfx/convert_prepare/tests/test_generate_document.py,sha256=mY8DRT-WRGIBFdDRdFwa7ZSUQwR-fTQtyKwzrzFZLU8,2621
31
- py2docfx/convert_prepare/tests/test_get_source.py,sha256=A5laL7j8gPyjSOKqssFoRv7YtkELGyDpn5q3vod7gAk,8034
31
+ py2docfx/convert_prepare/tests/test_get_source.py,sha256=IGBLAemm5SWUnNJJh6GJE5gBtAAdlC_cxS1xSeugzBI,7949
32
32
  py2docfx/convert_prepare/tests/test_pack.py,sha256=Gw-LkIcbQuQHpoSbvkybYt4_fVw-LL12dceWw5AUKdE,4242
33
- py2docfx/convert_prepare/tests/test_package_info.py,sha256=iUJIfTEPVuGnA8aypL7TLJhfY3F3gdzJUpig5pSYYPk,8635
33
+ py2docfx/convert_prepare/tests/test_package_info.py,sha256=3B-IzmUjETVO-5s3g3Lmh2E6JgopwnRauv8mB-SDZEM,3361
34
34
  py2docfx/convert_prepare/tests/test_params.py,sha256=itwmVdBMtU1qIXAGaIoaDfvTOYyAL2B_WLsaBV9KUZY,2232
35
35
  py2docfx/convert_prepare/tests/test_post_process_merge_toc.py,sha256=YKOcn4_lf4syGsAvJ9BqpdUUc3SLfK4TiOX1lpXJT_Y,885
36
36
  py2docfx/convert_prepare/tests/test_source.py,sha256=LNFZtvjz6QhVLOxatjWokYCCcoSm0bhTikMF9KoTPIE,2025
@@ -57,7 +57,7 @@ py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure
57
57
  py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  py2docfx/convert_prepare/tests/data/subpackage/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  py2docfx/docfx_yaml/__init__.py,sha256=KCEizAXv-SXtrYhvFfLHdBWDhz51AA9uagaeTL-Itpo,100
60
- py2docfx/docfx_yaml/build_finished.py,sha256=OQeaLDwkfahv0XhhwLrm21DcP8qVlskWDuy5LdwqjhI,14080
60
+ py2docfx/docfx_yaml/build_finished.py,sha256=H4ZtUHMgBEHIFh2QqI1kae8ixlintAryadnz4nQhurs,14078
61
61
  py2docfx/docfx_yaml/build_init.py,sha256=lAw-fnBVQbySfZ7Sut_NpFQUjnqLOmnGQrTBBH2RXcg,1860
62
62
  py2docfx/docfx_yaml/common.py,sha256=UN1MUmjUoN1QSFDR1Cm_bfRuHr6FQiOe5VQV6s8xzjc,6841
63
63
  py2docfx/docfx_yaml/convert_class.py,sha256=YaPjxqNy0p6AXi3H3T0l1MZeYRZ3dWkqusO4E0KT9QU,2161
@@ -3915,7 +3915,7 @@ py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/convert.py,sha256=0wSJMU0m
3915
3915
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/pack.py,sha256=o3iwjfRHl7N9ul-M2kHbewLJZnqBLAWf0tzUCwoiTMw,3078
3916
3916
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/tags.py,sha256=Rv2ySVb8-qX3osKp3uJgxcIMXkjt43XUD0-zvC6KvnY,4775
3917
3917
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/unpack.py,sha256=Y_J7ynxPSoFFTT7H0fMgbBlVErwyDGcObgme5MBuz58,1021
3918
- py2docfx-0.1.20.dev2245492.dist-info/METADATA,sha256=2no_0nVzXU20LW0b6DmSEjiAXuGgRonWJd3Kx2VvfcE,548
3919
- py2docfx-0.1.20.dev2245492.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
3920
- py2docfx-0.1.20.dev2245492.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
3921
- py2docfx-0.1.20.dev2245492.dist-info/RECORD,,
3918
+ py2docfx-0.1.20.dev2246325.dist-info/METADATA,sha256=XNwfzjjkCWTCo72oKKPWNHmJTl0-4NjUy-rE_9ymMTQ,548
3919
+ py2docfx-0.1.20.dev2246325.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
3920
+ py2docfx-0.1.20.dev2246325.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
3921
+ py2docfx-0.1.20.dev2246325.dist-info/RECORD,,