metripy 0.3.3__py3-none-any.whl → 0.3.4__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.

Potentially problematic release.


This version of metripy might be problematic. Click here for more details.

@@ -1,17 +1,42 @@
1
+ from importlib.metadata import version, metadata
1
2
  import toml
2
3
 
3
4
 
4
5
  class Info:
5
6
  def __init__(self):
6
- data = self._get_data()
7
- self.version = data["project"]["version"]
8
- self.url = data["project"]["urls"]["Homepage"]
7
+ self.version = self._get_version()
8
+ self.url = self._get_homepage_url()
9
9
 
10
- def _get_data(self) -> dict:
10
+ def _get_pyproject_data(self) -> dict:
11
11
  with open("pyproject.toml", "r") as file:
12
12
  data = toml.load(file)
13
13
  return data
14
14
 
15
+ def _get_version(self) -> str:
16
+ """Get version from installed package metadata"""
17
+ try:
18
+ return version("metripy")
19
+ except Exception:
20
+ # Fallback for development if not installed
21
+ return self._get_pyproject_data()["project"]["version"]
22
+
23
+ def _get_homepage_url(self) -> str:
24
+ """Get homepage URL from installed package metadata"""
25
+ try:
26
+ meta = metadata("metripy")
27
+ # Try to get Home-Page from metadata
28
+ homepage = meta.get("Home-Page")
29
+ if not homepage:
30
+ # Try Project-URL field
31
+ for line in meta.get_all("Project-URL") or []:
32
+ if line.startswith("Homepage"):
33
+ homepage = line.split(",", 1)[1].strip()
34
+ break
35
+ return homepage or "no homepage found"
36
+ except Exception:
37
+ # Fallback
38
+ return self._get_pyproject_data()["project"]["urls"]["Homepage"]
39
+
15
40
  def get_version(self) -> str:
16
41
  return self.version
17
42
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metripy
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: A Python tool to generate multi project, multi language code metric reports
5
5
  Author-email: Yannick Zimmermann <yannick.zimmermann@proton.me>
6
6
  License: MIT
@@ -2,7 +2,7 @@ metripy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  metripy/metripy.py,sha256=Iiggyf5cMv3xoJyyec6MpqPLb0afYnPyOYY26oiq6ro,266
3
3
  metripy/Application/Analyzer.py,sha256=anomekJMKve_lZEl69yeQEFYas_hTltTqEJmujg5VSo,4953
4
4
  metripy/Application/Application.py,sha256=XaSLgZurNVv29KVsIF8Kqu9eI4LOvvDZ6CHgdkLoRwQ,2332
5
- metripy/Application/Info.py,sha256=LfI8R8LmByK1-kvXRK905QZM_bnGDnE22G6pkNSLalE,868
5
+ metripy/Application/Info.py,sha256=7xdjqwDRwazenFme2sP5soHZogPeE4EEanBSP19bQL0,1882
6
6
  metripy/Application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  metripy/Application/Config/Config.py,sha256=QX_uTUJEcAaL0Oyug0dlpVgRVEKliDtXgS-3J10OZQA,1503
8
8
  metripy/Application/Config/GitConfig.py,sha256=4y676GYv-FH6QyLxh6IQn64gUG9xOQciMgkXH9pJtb4,220
@@ -88,9 +88,9 @@ metripy/templates/html_report/images/logo.svg,sha256=59gZXNLrZdKaefBoZMog8UPyyNj
88
88
  metripy/templates/html_report/js/charts.js,sha256=1L3me_UVWBjLVyNyKQ9v19etd0u31jnCvbpyGaX-0Go,10127
89
89
  metripy/templates/html_report/js/dashboard.js,sha256=RdV2GTFEm5Cc7oqGPxfsYUCt3lTmOzaZ9sUN60Vl1mE,19965
90
90
  metripy/templates/html_report/js/git_analysis.js,sha256=GxtmRyouS55bgKPvdko4-AxywFvx1V7x3HuCjRZczk4,12798
91
- metripy-0.3.3.dist-info/licenses/LICENSE,sha256=7I-LBXpo2Lveofzf06uDAmq0wPN7zbMwInrQZiQCiwc,1063
92
- metripy-0.3.3.dist-info/METADATA,sha256=brtqIencguEzUATGEUA1YXcE5QUnAOXfzXDLu5vWQ1I,4190
93
- metripy-0.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
94
- metripy-0.3.3.dist-info/entry_points.txt,sha256=vZI1vreNyXX9XGDUQlOnE2cSBRWNyXOlXXFnEBsVNIA,49
95
- metripy-0.3.3.dist-info/top_level.txt,sha256=Z-tn-27QGcxzNrsRq7BNPQv2BlXJnMCp8bp2sPdde1Y,8
96
- metripy-0.3.3.dist-info/RECORD,,
91
+ metripy-0.3.4.dist-info/licenses/LICENSE,sha256=7I-LBXpo2Lveofzf06uDAmq0wPN7zbMwInrQZiQCiwc,1063
92
+ metripy-0.3.4.dist-info/METADATA,sha256=YUqcn9n491Y0876W37vK9iwIwNOzaTlWpoMFuFrFKds,4190
93
+ metripy-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
94
+ metripy-0.3.4.dist-info/entry_points.txt,sha256=vZI1vreNyXX9XGDUQlOnE2cSBRWNyXOlXXFnEBsVNIA,49
95
+ metripy-0.3.4.dist-info/top_level.txt,sha256=Z-tn-27QGcxzNrsRq7BNPQv2BlXJnMCp8bp2sPdde1Y,8
96
+ metripy-0.3.4.dist-info/RECORD,,