biocypher 0.9.2__py3-none-any.whl → 0.12.3__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.
biocypher/_metadata.py CHANGED
@@ -8,9 +8,12 @@ import importlib.metadata
8
8
  import os
9
9
  import pathlib
10
10
 
11
- import toml
11
+ try:
12
+ import toml
13
+ except ImportError:
14
+ toml = None
12
15
 
13
- _VERSION = "0.9.2"
16
+ _VERSION = "0.12.3"
14
17
 
15
18
 
16
19
  def get_metadata():
@@ -28,16 +31,33 @@ def get_metadata():
28
31
  for project_dir in (here, here.parent):
29
32
  toml_path = str(project_dir.joinpath(pyproj_toml).absolute())
30
33
 
31
- if os.path.exists(toml_path):
32
- pyproject = toml.load(toml_path)
33
-
34
- meta = {
35
- "name": pyproject["tool"]["poetry"]["name"],
36
- "version": pyproject["tool"]["poetry"]["version"],
37
- "author": pyproject["tool"]["poetry"]["authors"],
38
- "license": pyproject["tool"]["poetry"]["license"],
39
- "full_metadata": pyproject,
40
- }
34
+ if os.path.exists(toml_path) and toml is not None:
35
+ try:
36
+ pyproject = toml.load(toml_path)
37
+ except Exception:
38
+ # If toml parsing fails, skip and use fallback
39
+ continue
40
+
41
+ # Use modern PEP 621 format (uv/hatchling)
42
+ if "project" in pyproject:
43
+ project = pyproject["project"]
44
+ meta = {
45
+ "name": project.get("name"),
46
+ "version": project.get("version"),
47
+ "author": project.get("authors", []),
48
+ "license": project.get("license", {}).get("text"),
49
+ "full_metadata": pyproject,
50
+ }
51
+ elif "tool" in pyproject and "poetry" in pyproject["tool"]:
52
+ # Legacy Poetry format fallback (for backward compatibility)
53
+ poetry = pyproject["tool"]["poetry"]
54
+ meta = {
55
+ "name": poetry.get("name"),
56
+ "version": poetry.get("version"),
57
+ "author": poetry.get("authors", []),
58
+ "license": poetry.get("license"),
59
+ "full_metadata": pyproject,
60
+ }
41
61
 
42
62
  break
43
63
 
biocypher/_translate.py CHANGED
@@ -37,15 +37,12 @@ class Translator:
37
37
 
38
38
  Args:
39
39
  ----
40
- leaves:
41
- Dictionary detailing the leaves of the hierarchy
42
- tree representing the structure of the graph; the leaves are
43
- the entities that will be direct components of the graph,
44
- while the intermediary nodes are additional labels for
45
- filtering purposes.
40
+ ontology (Ontology): An Ontology object providing schema and mapping details.
46
41
  strict_mode:
47
- If True, the translator will raise an error if input data do not
48
- carry source, licence, and version information.
42
+ strict_mode (bool, optional): If True, enforces that every node and edge carries
43
+ the required 'source', 'licence', and 'version' properties. Raises ValueError
44
+ if these are missing. Defaults to False.
45
+
49
46
 
50
47
  """
51
48
  self.ontology = ontology