refscan 0.3.3__tar.gz → 0.4.1__tar.gz

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.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: refscan
3
- Version: 0.3.3
3
+ Version: 0.4.1
4
4
  Summary: Command-line program that scans the NMDC MongoDB database for referential integrity violations
5
5
  Keywords: mongodb,mongo,relationships,reference,database,data,referential integrity,scan
6
6
  Requires-Dist: linkml-runtime>=1.7.5,<2
7
7
  Requires-Dist: pymongo>=4.7.1,<5
8
8
  Requires-Dist: rich>=13.7.1,<14
9
9
  Requires-Dist: typer>=0.15.1,<0.16
10
- Requires-Python: >=3.9, <3.10
10
+ Requires-Python: >=3.9, <4.0
11
11
  Project-URL: Documentation, https://github.com/microbiomedata/refscan
12
12
  Project-URL: Homepage, https://github.com/microbiomedata/refscan
13
13
  Project-URL: Repository, https://github.com/microbiomedata/refscan
@@ -1,12 +1,9 @@
1
1
  [project]
2
2
  name = "refscan"
3
- version = "0.3.3"
3
+ version = "0.4.1"
4
4
  description = "Command-line program that scans the NMDC MongoDB database for referential integrity violations"
5
5
  authors = []
6
- # Note: We constrain the Python version to 3.9.* because we know that `nmdc-schema`, which depends upon this
7
- # package, is also constrained to Python 3.9.* (according to its `pyproject.toml` file).
8
- # Reference: https://github.com/microbiomedata/nmdc-schema/blob/main/pyproject.toml#L34
9
- requires-python = ">= 3.9, < 3.10"
6
+ requires-python = ">= 3.9, < 4.0"
10
7
  readme = "README.md"
11
8
  keywords = [
12
9
  "mongodb",
@@ -0,0 +1,23 @@
1
+ from importlib.metadata import PackageNotFoundError, version
2
+ from typing import Optional
3
+
4
+
5
+ def get_package_version(package_name: str) -> Optional[str]:
6
+ r"""
7
+ Returns the version identifier (e.g., "1.2.3") of the package having the specified name.
8
+
9
+ Args:
10
+ package_name: The name of the package
11
+
12
+ Returns:
13
+ The version identifier of the package, or `None` if package not found
14
+ """
15
+ try:
16
+ return version(package_name)
17
+ except PackageNotFoundError:
18
+ return None
19
+
20
+
21
+ # Make an `import`-able variable whose value is the version identifier of this package.
22
+ app_name = "refscan"
23
+ app_version = get_package_version(app_name)
@@ -16,9 +16,7 @@ from refscan.lib.helpers import (
16
16
  )
17
17
  from refscan.lib.ViolationList import ViolationList
18
18
  from refscan.scanner import scan as refscan_scan
19
- from refscan import get_package_metadata
20
-
21
- app_version = get_package_metadata("Version")
19
+ from refscan import app_version
22
20
 
23
21
 
24
22
  def scan(
@@ -1,9 +1,7 @@
1
1
  import typer
2
2
 
3
3
  from refscan.lib.constants import console
4
- from refscan import get_package_metadata
5
-
6
- app_version = get_package_metadata("Version")
4
+ from refscan import app_version
7
5
 
8
6
 
9
7
  def version() -> None:
@@ -6,7 +6,7 @@ from importlib import resources
6
6
 
7
7
  import linkml_runtime
8
8
 
9
- from refscan import get_package_metadata
9
+ from refscan import app_version
10
10
  from refscan.lib.constants import console
11
11
  from refscan.lib.helpers import (
12
12
  get_collection_name_to_class_names_map,
@@ -161,7 +161,7 @@ def graph(
161
161
  graph_data_json_base64_str = encode_json_value_as_base64_str(elements)
162
162
  graph_metadata_json_base64_str = encode_json_value_as_base64_str(
163
163
  dict(
164
- app_version=get_package_metadata("Version"),
164
+ app_version=app_version,
165
165
  schema_version=schema_view.schema.version,
166
166
  subject_singular="class" if subject == Subject.class_ else "collection",
167
167
  subject_plural="classes" if subject == Subject.class_ else "collections",
@@ -1,18 +0,0 @@
1
- from importlib.metadata import metadata, PackageNotFoundError
2
-
3
-
4
- def get_package_metadata(key: str) -> str:
5
- r"""
6
- Returns metadata about the installed package.
7
-
8
- References:
9
- - https://docs.python.org/3/library/importlib.metadata.html#distribution-metadata
10
- - https://github.com/python-poetry/poetry/issues/273#issuecomment-570999678
11
- """
12
- metadata_value = ""
13
- try:
14
- package_metadata = metadata("refscan")
15
- metadata_value = package_metadata.get(key, "")
16
- except PackageNotFoundError:
17
- pass
18
- return metadata_value
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes