metatensor-learn 0.3.0__tar.gz → 0.3.2__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.
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/AUTHORS +4 -3
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/MANIFEST.in +1 -1
- {metatensor_learn-0.3.0/metatensor_learn.egg-info → metatensor_learn-0.3.2}/PKG-INFO +7 -5
- metatensor_learn-0.3.2/git_version_info +2 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/_backend.py +19 -21
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/data/_namedtuple.py +1 -3
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/data/dataset.py +6 -7
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/layer_norm.py +1 -1
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/linear.py +1 -1
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/module_map.py +0 -2
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/relu.py +1 -1
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/sequential.py +2 -2
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/silu.py +1 -1
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/tanh.py +1 -1
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2/metatensor_learn.egg-info}/PKG-INFO +7 -5
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor_learn.egg-info/SOURCES.txt +1 -1
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/pyproject.toml +2 -3
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/setup.py +43 -39
- metatensor_learn-0.3.0/n_commits_since_last_tag +0 -1
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/LICENSE +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/README.rst +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/__init__.py +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/_dispatch.py +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/data/__init__.py +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/data/collate.py +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/data/dataloader.py +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/__init__.py +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/_utils.py +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/equivariant_transformation.py +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor_learn.egg-info/dependency_links.txt +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor_learn.egg-info/requires.txt +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor_learn.egg-info/top_level.txt +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor_learn.egg-info/zip-safe +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/setup.cfg +0 -0
- {metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/tests/test_dummmy.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: metatensor-learn
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Building blocks for the atomistic machine learning models based on PyTorch and NumPy
|
|
5
|
-
Author: Guillaume Fraux,
|
|
6
|
-
License: BSD-3-Clause
|
|
5
|
+
Author: Guillaume Fraux, Philip Loche, Filippo Bigi, Joseph W. Abbott, Davide Tisi, Alexander Goscinski, Michele Ceriotti
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
7
|
Project-URL: homepage, https://docs.metatensor.org/latest/
|
|
8
8
|
Project-URL: documentation, https://docs.metatensor.org/latest/
|
|
9
9
|
Project-URL: repository, https://github.com/metatensor/metatensor
|
|
@@ -11,7 +11,6 @@ Project-URL: changelog, https://docs.metatensor.org/latest/learn/CHANGELOG.html
|
|
|
11
11
|
Keywords: machine learning,molecular modeling
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Intended Audience :: Science/Research
|
|
14
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
15
14
|
Classifier: Operating System :: POSIX
|
|
16
15
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
16
|
Classifier: Operating System :: Microsoft :: Windows
|
|
@@ -28,6 +27,9 @@ Description-Content-Type: text/x-rst
|
|
|
28
27
|
License-File: LICENSE
|
|
29
28
|
License-File: AUTHORS
|
|
30
29
|
Requires-Dist: metatensor-operations<0.4.0,>=0.3.0
|
|
30
|
+
Dynamic: author
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
Dynamic: requires-dist
|
|
31
33
|
|
|
32
34
|
metatensor-learn
|
|
33
35
|
=====================
|
|
@@ -43,26 +43,24 @@ def _version_at_least(version, expected):
|
|
|
43
43
|
return version >= expected
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
def
|
|
47
|
-
assert
|
|
48
|
-
|
|
49
|
-
if isinstance(value,
|
|
50
|
-
|
|
46
|
+
def isinstance_metatensor(value, typename):
|
|
47
|
+
assert typename in ("Labels", "TensorBlock", "TensorMap")
|
|
48
|
+
|
|
49
|
+
if _HAS_TORCH and isinstance(value, torch.ScriptObject):
|
|
50
|
+
is_metatensor_torch_class = "metatensor" in str(value._type())
|
|
51
|
+
if is_metatensor_torch_class:
|
|
52
|
+
warnings.warn(
|
|
53
|
+
"Trying to use code from ``metatensor.learn`` with objects from "
|
|
54
|
+
"metatensor-torch, you should use the code from "
|
|
55
|
+
"`metatensor.torch.learn` instead",
|
|
56
|
+
stacklevel=2,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if typename == "Labels":
|
|
60
|
+
return isinstance(value, Labels)
|
|
61
|
+
elif typename == "TensorBlock":
|
|
62
|
+
return isinstance(value, TensorBlock)
|
|
63
|
+
elif typename == "TensorMap":
|
|
64
|
+
return isinstance(value, TensorMap)
|
|
51
65
|
else:
|
|
52
|
-
if _HAS_TORCH and isinstance(value, torch.ScriptObject):
|
|
53
|
-
if _version_at_least(torch.__version__, "2.1.0"):
|
|
54
|
-
# _type() is only working for torch >= 2.1
|
|
55
|
-
is_metatensor_torch_class = "metatensor" in str(value._type())
|
|
56
|
-
else:
|
|
57
|
-
# we don't know, it's fine
|
|
58
|
-
is_metatensor_torch_class = False
|
|
59
|
-
|
|
60
|
-
if is_metatensor_torch_class:
|
|
61
|
-
warnings.warn(
|
|
62
|
-
"Trying to use code from ``metatensor.learn`` with objects from "
|
|
63
|
-
"metatensor-torch, you should use the code from "
|
|
64
|
-
"`metatensor.torch.learn` instead",
|
|
65
|
-
stacklevel=2,
|
|
66
|
-
)
|
|
67
|
-
|
|
68
66
|
return False
|
|
@@ -65,9 +65,7 @@ def namedtuple(typename, field_names):
|
|
|
65
65
|
raise TypeError(f"Expected {num_fields} arguments, got {len(result)}")
|
|
66
66
|
return result
|
|
67
67
|
|
|
68
|
-
_make.__func__.__doc__ =
|
|
69
|
-
f"Make a new {typename} object from a sequence " "or iterable"
|
|
70
|
-
)
|
|
68
|
+
_make.__func__.__doc__ = f"Make a new {typename} object from a sequence or iterable"
|
|
71
69
|
|
|
72
70
|
def _replace(self, /, **kwds):
|
|
73
71
|
result = self._make(_map(kwds.pop, field_names, self))
|
|
@@ -62,8 +62,6 @@ class _BaseDataset(torch.utils.data.Dataset):
|
|
|
62
62
|
f"'{size_arg_name}' ({size}) and data fields: ({field_sizes})"
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
-
# Define an internal numeric index list as a range from 0 to size
|
|
66
|
-
self._indices = list(range(size))
|
|
67
65
|
self._field_names = field_names
|
|
68
66
|
self._data = data
|
|
69
67
|
self._size = size
|
|
@@ -80,7 +78,7 @@ class _BaseDataset(torch.utils.data.Dataset):
|
|
|
80
78
|
"""
|
|
81
79
|
Returns an iterator over the dataset.
|
|
82
80
|
"""
|
|
83
|
-
for idx in self
|
|
81
|
+
for idx in range(len(self)):
|
|
84
82
|
yield self[idx]
|
|
85
83
|
|
|
86
84
|
|
|
@@ -130,13 +128,11 @@ class Dataset(_BaseDataset):
|
|
|
130
128
|
>>> # iterating over a dataset
|
|
131
129
|
>>> for num, called in dataset:
|
|
132
130
|
... print(num, " -- ", called)
|
|
133
|
-
...
|
|
134
131
|
1 -- compute something with sample 0
|
|
135
132
|
2 -- compute something with sample 1
|
|
136
133
|
3 -- compute something with sample 2
|
|
137
134
|
>>> for sample in dataset:
|
|
138
135
|
... print(sample.num, " -- ", sample.call_me)
|
|
139
|
-
...
|
|
140
136
|
1 -- compute something with sample 0
|
|
141
137
|
2 -- compute something with sample 1
|
|
142
138
|
3 -- compute something with sample 2
|
|
@@ -214,8 +210,10 @@ class Dataset(_BaseDataset):
|
|
|
214
210
|
fields corresponding to those passed (in order) to the constructor upon class
|
|
215
211
|
initialization.
|
|
216
212
|
"""
|
|
217
|
-
|
|
213
|
+
idx = int(idx)
|
|
214
|
+
if idx >= len(self) or idx < 0:
|
|
218
215
|
raise ValueError(f"Index {idx} not in dataset")
|
|
216
|
+
|
|
219
217
|
sample_data = []
|
|
220
218
|
for name in self._field_names:
|
|
221
219
|
if callable(self._data[name]): # lazy load
|
|
@@ -367,7 +365,8 @@ class IndexedDataset(_BaseDataset):
|
|
|
367
365
|
first field is the sample ID, and the remaining fields correspond those passed
|
|
368
366
|
(in order) to the constructor upon class initialization.
|
|
369
367
|
"""
|
|
370
|
-
|
|
368
|
+
idx = int(idx)
|
|
369
|
+
if idx >= len(self) or idx < 0:
|
|
371
370
|
raise ValueError(f"Index {idx} not in dataset")
|
|
372
371
|
|
|
373
372
|
sample_id = self._sample_id[idx]
|
|
@@ -169,7 +169,7 @@ class InvariantLayerNorm(Module):
|
|
|
169
169
|
if invariant_keys is None:
|
|
170
170
|
invariant_keys = Labels(
|
|
171
171
|
names=["o3_lambda", "o3_sigma"],
|
|
172
|
-
values=int_array_like([0, 1], like=in_keys.values).reshape(-1,
|
|
172
|
+
values=int_array_like([0, 1], like=in_keys.values).reshape(-1, 2),
|
|
173
173
|
)
|
|
174
174
|
invariant_key_idxs = in_keys.select(invariant_keys)
|
|
175
175
|
|
|
@@ -140,7 +140,7 @@ class EquivariantLinear(Module):
|
|
|
140
140
|
if invariant_keys is None:
|
|
141
141
|
invariant_keys = Labels(
|
|
142
142
|
names=["o3_lambda", "o3_sigma"],
|
|
143
|
-
values=int_array_like([0, 1], like=in_keys.values).reshape(-1,
|
|
143
|
+
values=int_array_like([0, 1], like=in_keys.values).reshape(-1, 2),
|
|
144
144
|
)
|
|
145
145
|
invariant_key_idxs = in_keys.select(invariant_keys)
|
|
146
146
|
|
|
@@ -105,7 +105,6 @@ class ModuleMap(ModuleList):
|
|
|
105
105
|
>>> linear = torch.nn.Linear(3, 1, bias=False)
|
|
106
106
|
>>> with torch.no_grad():
|
|
107
107
|
... _ = linear.weight.copy_(torch.tensor([1.0, 1.0, 1.0]))
|
|
108
|
-
...
|
|
109
108
|
>>> modules = [linear, deepcopy(linear)]
|
|
110
109
|
>>> # you could also extend the module by some nonlinear activation function
|
|
111
110
|
|
|
@@ -229,7 +228,6 @@ class ModuleMap(ModuleList):
|
|
|
229
228
|
>>> linear = torch.nn.Linear(3, 1, bias=False)
|
|
230
229
|
>>> with torch.no_grad():
|
|
231
230
|
... _ = linear.weight.copy_(torch.tensor([1.0, 1.0, 1.0]))
|
|
232
|
-
...
|
|
233
231
|
>>> # you could also extend the module by some nonlinear activation function
|
|
234
232
|
>>> from metatensor.learn.nn import ModuleMap
|
|
235
233
|
>>> module_map = ModuleMap.from_module(tensor.keys, linear)
|
|
@@ -93,7 +93,7 @@ class InvariantReLU(torch.nn.Module):
|
|
|
93
93
|
if invariant_keys is None:
|
|
94
94
|
invariant_keys = Labels(
|
|
95
95
|
names=["o3_lambda", "o3_sigma"],
|
|
96
|
-
values=int_array_like([0, 1], like=in_keys.values).reshape(-1,
|
|
96
|
+
values=int_array_like([0, 1], like=in_keys.values).reshape(-1, 2),
|
|
97
97
|
)
|
|
98
98
|
invariant_key_idxs = in_keys.select(invariant_keys)
|
|
99
99
|
modules: List[Module] = []
|
|
@@ -3,7 +3,7 @@ from typing import List
|
|
|
3
3
|
import torch
|
|
4
4
|
from torch.nn import Module
|
|
5
5
|
|
|
6
|
-
from .._backend import Labels, TensorMap,
|
|
6
|
+
from .._backend import Labels, TensorMap, isinstance_metatensor
|
|
7
7
|
from .module_map import ModuleMap
|
|
8
8
|
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ class Sequential(Module):
|
|
|
21
21
|
|
|
22
22
|
def __init__(self, in_keys: Labels, *args: List[ModuleMap]):
|
|
23
23
|
super().__init__()
|
|
24
|
-
if not
|
|
24
|
+
if not isinstance_metatensor(in_keys, "Labels"):
|
|
25
25
|
raise TypeError("`in_keys` must be a `Labels` object.")
|
|
26
26
|
|
|
27
27
|
modules: List[Module] = []
|
|
@@ -93,7 +93,7 @@ class InvariantSiLU(torch.nn.Module):
|
|
|
93
93
|
if invariant_keys is None:
|
|
94
94
|
invariant_keys = Labels(
|
|
95
95
|
names=["o3_lambda", "o3_sigma"],
|
|
96
|
-
values=int_array_like([0, 1], like=in_keys.values).reshape(-1,
|
|
96
|
+
values=int_array_like([0, 1], like=in_keys.values).reshape(-1, 2),
|
|
97
97
|
)
|
|
98
98
|
invariant_key_idxs = in_keys.select(invariant_keys)
|
|
99
99
|
modules: List[Module] = []
|
|
@@ -87,7 +87,7 @@ class InvariantTanh(torch.nn.Module):
|
|
|
87
87
|
if invariant_keys is None:
|
|
88
88
|
invariant_keys = Labels(
|
|
89
89
|
names=["o3_lambda", "o3_sigma"],
|
|
90
|
-
values=int_array_like([0, 1], like=in_keys.values).reshape(-1,
|
|
90
|
+
values=int_array_like([0, 1], like=in_keys.values).reshape(-1, 2),
|
|
91
91
|
)
|
|
92
92
|
invariant_key_idxs = in_keys.select(invariant_keys)
|
|
93
93
|
modules: List[Module] = []
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: metatensor-learn
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Building blocks for the atomistic machine learning models based on PyTorch and NumPy
|
|
5
|
-
Author: Guillaume Fraux,
|
|
6
|
-
License: BSD-3-Clause
|
|
5
|
+
Author: Guillaume Fraux, Philip Loche, Filippo Bigi, Joseph W. Abbott, Davide Tisi, Alexander Goscinski, Michele Ceriotti
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
7
|
Project-URL: homepage, https://docs.metatensor.org/latest/
|
|
8
8
|
Project-URL: documentation, https://docs.metatensor.org/latest/
|
|
9
9
|
Project-URL: repository, https://github.com/metatensor/metatensor
|
|
@@ -11,7 +11,6 @@ Project-URL: changelog, https://docs.metatensor.org/latest/learn/CHANGELOG.html
|
|
|
11
11
|
Keywords: machine learning,molecular modeling
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Intended Audience :: Science/Research
|
|
14
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
15
14
|
Classifier: Operating System :: POSIX
|
|
16
15
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
16
|
Classifier: Operating System :: Microsoft :: Windows
|
|
@@ -28,6 +27,9 @@ Description-Content-Type: text/x-rst
|
|
|
28
27
|
License-File: LICENSE
|
|
29
28
|
License-File: AUTHORS
|
|
30
29
|
Requires-Dist: metatensor-operations<0.4.0,>=0.3.0
|
|
30
|
+
Dynamic: author
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
Dynamic: requires-dist
|
|
31
33
|
|
|
32
34
|
metatensor-learn
|
|
33
35
|
=====================
|
|
@@ -4,14 +4,13 @@ dynamic = ["version", "authors", "dependencies"]
|
|
|
4
4
|
requires-python = ">=3.9"
|
|
5
5
|
|
|
6
6
|
readme = "README.rst"
|
|
7
|
-
license =
|
|
7
|
+
license = "BSD-3-Clause"
|
|
8
8
|
description = "Building blocks for the atomistic machine learning models based on PyTorch and NumPy"
|
|
9
9
|
|
|
10
10
|
keywords = ["machine learning", "molecular modeling"]
|
|
11
11
|
classifiers = [
|
|
12
12
|
"Development Status :: 4 - Beta",
|
|
13
13
|
"Intended Audience :: Science/Research",
|
|
14
|
-
"License :: OSI Approved :: BSD License",
|
|
15
14
|
"Operating System :: POSIX",
|
|
16
15
|
"Operating System :: MacOS :: MacOS X",
|
|
17
16
|
"Operating System :: Microsoft :: Windows",
|
|
@@ -34,7 +33,7 @@ changelog = "https://docs.metatensor.org/latest/learn/CHANGELOG.html"
|
|
|
34
33
|
### ======================================================================== ###
|
|
35
34
|
[build-system]
|
|
36
35
|
requires = [
|
|
37
|
-
"setuptools >=
|
|
36
|
+
"setuptools >=77",
|
|
38
37
|
"packaging >=23",
|
|
39
38
|
]
|
|
40
39
|
build-backend = "setuptools.build_meta"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import subprocess
|
|
3
3
|
import sys
|
|
4
|
-
import uuid
|
|
5
4
|
|
|
6
5
|
import packaging.version
|
|
7
6
|
from setuptools import setup
|
|
@@ -11,10 +10,10 @@ from setuptools.command.sdist import sdist
|
|
|
11
10
|
|
|
12
11
|
ROOT = os.path.realpath(os.path.dirname(__file__))
|
|
13
12
|
METATENSOR_OPERATIONS = os.path.realpath(
|
|
14
|
-
os.path.join(ROOT, "..", "
|
|
13
|
+
os.path.join(ROOT, "..", "metatensor_operations")
|
|
15
14
|
)
|
|
16
15
|
|
|
17
|
-
METATENSOR_LEARN_VERSION = "0.3.
|
|
16
|
+
METATENSOR_LEARN_VERSION = "0.3.2"
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
class bdist_egg_disabled(bdist_egg):
|
|
@@ -39,54 +38,62 @@ class sdist_git_version(sdist):
|
|
|
39
38
|
"""
|
|
40
39
|
|
|
41
40
|
def run(self):
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
n_commits, git_hash = git_version_info()
|
|
42
|
+
with open("git_version_info", "w") as fd:
|
|
43
|
+
fd.write(f"{n_commits}\n{git_hash}\n")
|
|
44
44
|
|
|
45
45
|
# run original sdist
|
|
46
46
|
super().run()
|
|
47
47
|
|
|
48
|
-
os.unlink("
|
|
48
|
+
os.unlink("git_version_info")
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
def
|
|
51
|
+
def git_version_info():
|
|
52
52
|
"""
|
|
53
53
|
If git is available and we are building from a checkout, get the number of commits
|
|
54
|
-
since the last tag. Otherwise, this always returns 0.
|
|
54
|
+
since the last tag & full hash of the code. Otherwise, this always returns (0, "").
|
|
55
55
|
"""
|
|
56
|
-
script = os.path.join(ROOT, "..", "..", "scripts", "n-commits-since-last-tag.py")
|
|
57
|
-
assert os.path.exists(script)
|
|
58
|
-
|
|
59
56
|
TAG_PREFIX = "metatensor-learn-v"
|
|
60
|
-
output = subprocess.run(
|
|
61
|
-
[sys.executable, script, TAG_PREFIX],
|
|
62
|
-
stderr=subprocess.PIPE,
|
|
63
|
-
stdout=subprocess.PIPE,
|
|
64
|
-
encoding="utf8",
|
|
65
|
-
)
|
|
66
57
|
|
|
67
|
-
if
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
elif output.stderr:
|
|
74
|
-
print(output.stderr, file=sys.stderr)
|
|
75
|
-
return 0
|
|
58
|
+
if os.path.exists("git_version_info"):
|
|
59
|
+
# we are building from a sdist, without git available, but the git
|
|
60
|
+
# version was recorded in the `git_version_info` file
|
|
61
|
+
with open("git_version_info") as fd:
|
|
62
|
+
n_commits = int(fd.readline().strip())
|
|
63
|
+
git_hash = fd.readline().strip()
|
|
76
64
|
else:
|
|
77
|
-
|
|
65
|
+
script = os.path.join(ROOT, "..", "..", "scripts", "git-version-info.py")
|
|
66
|
+
assert os.path.exists(script)
|
|
67
|
+
|
|
68
|
+
output = subprocess.run(
|
|
69
|
+
[sys.executable, script, TAG_PREFIX],
|
|
70
|
+
stderr=subprocess.PIPE,
|
|
71
|
+
stdout=subprocess.PIPE,
|
|
72
|
+
encoding="utf8",
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
if output.returncode != 0:
|
|
76
|
+
raise Exception(
|
|
77
|
+
"failed to get git version info.\n"
|
|
78
|
+
f"stdout: {output.stdout}\n"
|
|
79
|
+
f"stderr: {output.stderr}\n"
|
|
80
|
+
)
|
|
81
|
+
elif output.stderr:
|
|
82
|
+
print(output.stderr, file=sys.stderr)
|
|
83
|
+
n_commits = 0
|
|
84
|
+
git_hash = ""
|
|
85
|
+
else:
|
|
86
|
+
lines = output.stdout.splitlines()
|
|
87
|
+
n_commits = int(lines[0].strip())
|
|
88
|
+
git_hash = lines[1].strip()
|
|
89
|
+
|
|
90
|
+
return n_commits, git_hash
|
|
78
91
|
|
|
79
92
|
|
|
80
93
|
def create_version_number(version):
|
|
81
94
|
version = packaging.version.parse(version)
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
# we are building from a sdist, without git available, but the git
|
|
85
|
-
# version was recorded in the `n_commits_since_last_tag` file
|
|
86
|
-
with open("n_commits_since_last_tag") as fd:
|
|
87
|
-
n_commits = int(fd.read().strip())
|
|
88
|
-
else:
|
|
89
|
-
n_commits = n_commits_since_last_tag()
|
|
96
|
+
n_commits, git_hash = git_version_info()
|
|
90
97
|
|
|
91
98
|
if n_commits != 0:
|
|
92
99
|
# if we have commits since the last tag, this mean we are in a pre-release of
|
|
@@ -107,6 +114,7 @@ def create_version_number(version):
|
|
|
107
114
|
version._version = version._version._replace(release=release)
|
|
108
115
|
version._version = version._version._replace(pre=pre)
|
|
109
116
|
version._version = version._version._replace(dev=("dev", n_commits))
|
|
117
|
+
version._version = version._version._replace(local=(git_hash,))
|
|
110
118
|
|
|
111
119
|
return str(version)
|
|
112
120
|
|
|
@@ -127,12 +135,8 @@ if __name__ == "__main__":
|
|
|
127
135
|
|
|
128
136
|
if not METATENSOR_NO_LOCAL_DEPS and os.path.exists(METATENSOR_OPERATIONS):
|
|
129
137
|
# we are building from a git checkout or full repo archive
|
|
130
|
-
|
|
131
|
-
# add a random uuid to the file url to prevent pip from using a cached
|
|
132
|
-
# wheel for metatensor-core, and force it to re-build from scratch
|
|
133
|
-
uuid = uuid.uuid4()
|
|
134
138
|
install_requires.append(
|
|
135
|
-
f"metatensor-operations @ file://{METATENSOR_OPERATIONS}
|
|
139
|
+
f"metatensor-operations @ file://{METATENSOR_OPERATIONS}"
|
|
136
140
|
)
|
|
137
141
|
else:
|
|
138
142
|
# we are building from a sdist/installing from a wheel
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor/learn/nn/equivariant_transformation.py
RENAMED
|
File without changes
|
{metatensor_learn-0.3.0 → metatensor_learn-0.3.2}/metatensor_learn.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|