bw-processing 0.9__tar.gz → 0.9.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.
- {bw-processing-0.9/bw_processing.egg-info → bw_processing-0.9.2}/PKG-INFO +4 -4
- {bw-processing-0.9 → bw_processing-0.9.2}/README.md +3 -3
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/__init__.py +1 -1
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/array_creation.py +2 -1
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/datapackage.py +35 -27
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/errors.py +2 -1
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/filesystem.py +2 -1
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/io_helpers.py +2 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/merging.py +2 -2
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/proxies.py +2 -1
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/unique_fields.py +3 -2
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/utils.py +9 -0
- {bw-processing-0.9 → bw_processing-0.9.2/bw_processing.egg-info}/PKG-INFO +4 -4
- bw_processing-0.9.2/docs/conf.py +109 -0
- bw-processing-0.9/docs/conf.py +0 -48
- {bw-processing-0.9 → bw_processing-0.9.2}/LICENSE +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/MANIFEST.in +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/constants.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/examples/__init__.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/examples/interfaces.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/examples/parquet_files.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/examples/simple.zip +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/indexing.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/io_parquet_helpers.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing/io_pyarrow_helpers.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing.egg-info/SOURCES.txt +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing.egg-info/dependency_links.txt +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing.egg-info/not-zip-safe +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing.egg-info/requires.txt +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/bw_processing.egg-info/top_level.txt +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/dev/calculation_package.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/dev/loading.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/dev/processed_package.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/dev/resources.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/dev/speed_tests.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/pyproject.toml +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/setup.cfg +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/tests/fixtures/basic_arrays.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/tests/helpers/__init__.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/tests/helpers/basic_array_helpers.py +0 -0
- {bw-processing-0.9 → bw_processing-0.9.2}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bw-processing
|
|
3
|
-
Version: 0.9
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: Tools to create structured arrays in a common format
|
|
5
5
|
Home-page: https://github.com/brightway-lca/bw_processing
|
|
6
6
|
Author: Chris Mutel
|
|
@@ -46,10 +46,10 @@ Library for storing numeric data for use in matrix-based calculations. Designed
|
|
|
46
46
|
[][pypi status]
|
|
47
47
|
[][pypi status]
|
|
48
48
|
[][pypi status]
|
|
49
|
-
[][license]
|
|
50
50
|
|
|
51
51
|
[][read the docs]
|
|
52
|
-
[][tests]
|
|
53
53
|
[][codecov]
|
|
54
54
|
|
|
55
55
|
[][pre-commit]
|
|
@@ -57,7 +57,7 @@ Library for storing numeric data for use in matrix-based calculations. Designed
|
|
|
57
57
|
|
|
58
58
|
[pypi status]: https://pypi.org/project/bw-processing/
|
|
59
59
|
[read the docs]: https://bw-processing.readthedocs.io/
|
|
60
|
-
[tests]: https://github.com/brightway-lca/
|
|
60
|
+
[tests]: https://github.com/brightway-lca/bw_processing/actions/workflows/python-test.yml
|
|
61
61
|
[codecov]: https://app.codecov.io/gh/brightway-lca/bw-processing
|
|
62
62
|
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
63
63
|
[black]: https://github.com/psf/black
|
|
@@ -5,10 +5,10 @@ Library for storing numeric data for use in matrix-based calculations. Designed
|
|
|
5
5
|
[][pypi status]
|
|
6
6
|
[][pypi status]
|
|
7
7
|
[][pypi status]
|
|
8
|
-
[][license]
|
|
9
9
|
|
|
10
10
|
[][read the docs]
|
|
11
|
-
[][tests]
|
|
12
12
|
[][codecov]
|
|
13
13
|
|
|
14
14
|
[][pre-commit]
|
|
@@ -16,7 +16,7 @@ Library for storing numeric data for use in matrix-based calculations. Designed
|
|
|
16
16
|
|
|
17
17
|
[pypi status]: https://pypi.org/project/bw-processing/
|
|
18
18
|
[read the docs]: https://bw-processing.readthedocs.io/
|
|
19
|
-
[tests]: https://github.com/brightway-lca/
|
|
19
|
+
[tests]: https://github.com/brightway-lca/bw_processing/actions/workflows/python-test.yml
|
|
20
20
|
[codecov]: https://app.codecov.io/gh/brightway-lca/bw-processing
|
|
21
21
|
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
22
22
|
[black]: https://github.com/psf/black
|
|
@@ -68,7 +68,8 @@ def create_structured_array(iterable, dtype, nrows=None, sort=False, sort_fields
|
|
|
68
68
|
|
|
69
69
|
``iterable`` can be data already in memory, or a generator.
|
|
70
70
|
|
|
71
|
-
``nrows`` can be supplied, if known. If ``iterable`` has a length, it will be determined automatically. If ``nrows`` is not known, this function generates chunked arrays until ``iterable`` is exhausted, and concatenates them.
|
|
71
|
+
``nrows`` can be supplied, if known. If ``iterable`` has a length, it will be determined automatically. If ``nrows`` is not known, this function generates chunked arrays until ``iterable`` is exhausted, and concatenates them.
|
|
72
|
+
"""
|
|
72
73
|
if nrows or hasattr(iterable, "__len__"):
|
|
73
74
|
if not nrows:
|
|
74
75
|
nrows = len(iterable)
|
|
@@ -31,7 +31,7 @@ from .errors import (
|
|
|
31
31
|
from .filesystem import clean_datapackage_name
|
|
32
32
|
from .io_helpers import file_reader, file_writer
|
|
33
33
|
from .proxies import Proxy, UndefinedInterface
|
|
34
|
-
from .utils import check_name, check_suffix, load_bytes, resolve_dict_iterator
|
|
34
|
+
from .utils import check_name, check_suffix, load_bytes, resolve_dict_iterator, utc_now
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
class DatapackageBase(ABC):
|
|
@@ -127,7 +127,8 @@ class DatapackageBase(ABC):
|
|
|
127
127
|
def del_resource_group(self, name: str) -> None:
|
|
128
128
|
"""Remove a resource group, and delete its data files, if any.
|
|
129
129
|
|
|
130
|
-
Use ``exclude_resource_group`` if you want to keep the underlying resource in the filesystem.
|
|
130
|
+
Use ``exclude_resource_group`` if you want to keep the underlying resource in the filesystem.
|
|
131
|
+
"""
|
|
131
132
|
if self._modified:
|
|
132
133
|
raise PotentialInconsistency(
|
|
133
134
|
"Datapackage is modified; save modifications or reload"
|
|
@@ -181,7 +182,8 @@ class DatapackageBase(ABC):
|
|
|
181
182
|
|
|
182
183
|
All included objects are the same as in the original data package, i.e. no copies are made. No checks are made to ensure consistency with modifications to the original datapackage after the creation of this filtered datapackage.
|
|
183
184
|
|
|
184
|
-
This method was introduced to allow for the efficient construction of matrices; each datapackage can have data for multiple matrices, and we can then create filtered datapackages which exclusively have data for the matrix of interest. As such, they should be considered read-only, though this is not enforced.
|
|
185
|
+
This method was introduced to allow for the efficient construction of matrices; each datapackage can have data for multiple matrices, and we can then create filtered datapackages which exclusively have data for the matrix of interest. As such, they should be considered read-only, though this is not enforced.
|
|
186
|
+
"""
|
|
185
187
|
fdp = FilteredDatapackage()
|
|
186
188
|
fdp.fs = self.fs
|
|
187
189
|
fdp.metadata = {k: v for k, v in self.metadata.items() if k != "resources"}
|
|
@@ -369,7 +371,7 @@ class Datapackage(DatapackageBase):
|
|
|
369
371
|
"id": id_ or uuid.uuid4().hex,
|
|
370
372
|
"licenses": (metadata or {}).get("licenses", DEFAULT_LICENSES),
|
|
371
373
|
"resources": [],
|
|
372
|
-
"created":
|
|
374
|
+
"created": utc_now().isoformat("T") + "Z",
|
|
373
375
|
"combinatorial": combinatorial,
|
|
374
376
|
"sequential": sequential,
|
|
375
377
|
"seed": seed,
|
|
@@ -1053,17 +1055,16 @@ def create_datapackage(
|
|
|
1053
1055
|
Licenses are specified as a list in ``metadata``. The default license is the `Open Data Commons Public Domain Dedication and License v1.0 <http://opendatacommons.org/licenses/pddl/>`__.
|
|
1054
1056
|
|
|
1055
1057
|
Args:
|
|
1056
|
-
|
|
1057
|
-
*
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
* matrix_serialize_format_type. `MatrixSerializeFormat`, default `MatrixSerializeFormat.NUMPY`. Matrix serialization format type.
|
|
1058
|
+
* fs: A ``Filesystem``, optional. A new ``MemoryFS`` is used if not provided.
|
|
1059
|
+
* name: ``str``, optional. A new uuid is used if not provided.
|
|
1060
|
+
* `id_`: ``str``, optional. A new uuid is used if not provided.
|
|
1061
|
+
* metadata: ``dict``, optional. Metadata dictionary following datapackage specification; see above.
|
|
1062
|
+
* combinatorial: ``bool``, default ``False`` .: Policy on how to sample columns across multiple data arrays; see readme.
|
|
1063
|
+
* sequential: ``bool``, default ``False`` .: Policy on how to sample columns in data arrays; see readme.
|
|
1064
|
+
* seed: ``int``, optional. Seed to use in random number generator.
|
|
1065
|
+
* sum_intra_duplicates: ``bool``, default ``True``. Should duplicate elements in a single data resource be summed together, or should the last value replace previous values.
|
|
1066
|
+
* sum_inter_duplicates: ``bool``, default ``False``. Should duplicate elements in across data resources be summed together, or should the last value replace previous values. Order of data resources is given by the order they are added to the data package.
|
|
1067
|
+
* matrix_serialize_format_type: ``MatrixSerializeFormat``, default ``MatrixSerializeFormat.NUMPY``. Matrix serialization format type.
|
|
1067
1068
|
|
|
1068
1069
|
Returns:
|
|
1069
1070
|
|
|
@@ -1099,9 +1100,9 @@ def load_datapackage(
|
|
|
1099
1100
|
|
|
1100
1101
|
Args:
|
|
1101
1102
|
|
|
1102
|
-
* fs_or_obj
|
|
1103
|
-
* mmap_mode
|
|
1104
|
-
* proxy
|
|
1103
|
+
* fs_or_obj: A `Filesystem` or an instance of `DatapackageBase`.
|
|
1104
|
+
* mmap_mode: `str`, optional. Define memory mapping mode to use when loading Numpy arrays.
|
|
1105
|
+
* proxy: bool, default `False`. Load proxies instead of complete Numpy arrays; see above.
|
|
1105
1106
|
|
|
1106
1107
|
Returns:
|
|
1107
1108
|
|
|
@@ -1116,22 +1117,29 @@ def load_datapackage(
|
|
|
1116
1117
|
return obj
|
|
1117
1118
|
|
|
1118
1119
|
|
|
1119
|
-
def simple_graph(data: dict, fs: Optional[FS] = None, **metadata):
|
|
1120
|
+
def simple_graph(data: dict, fs: Optional[FS] = None, **metadata) -> Datapackage:
|
|
1120
1121
|
"""Easy creation of simple datapackages with only persistent vectors.
|
|
1121
1122
|
|
|
1122
|
-
|
|
1123
|
+
Args:
|
|
1124
|
+
* data: is a dictionary.
|
|
1125
|
+
The data dictionary has the form::
|
|
1126
|
+
|
|
1127
|
+
{
|
|
1128
|
+
matrix_name: [
|
|
1129
|
+
(row_id, col_id, value, flip)
|
|
1130
|
+
]
|
|
1131
|
+
}
|
|
1123
1132
|
|
|
1124
|
-
..code-block:: python
|
|
1125
1133
|
|
|
1126
|
-
|
|
1127
|
-
(row id (int), col id (int), value (float), flip (bool, default False))
|
|
1128
|
-
]
|
|
1134
|
+
Where `row_id` and `col_id are an `int` s, value is a `float` and flip is a `bool` (False by default).
|
|
1129
1135
|
|
|
1130
|
-
|
|
1136
|
+
* fs: is a filesystem.
|
|
1137
|
+
* metadata: are passed as kwargs to ``create_datapackage()``.
|
|
1131
1138
|
|
|
1132
|
-
|
|
1139
|
+
Returns:
|
|
1140
|
+
the datapackage.
|
|
1133
1141
|
|
|
1134
|
-
|
|
1142
|
+
"""
|
|
1135
1143
|
dp = create_datapackage(fs=fs, **metadata)
|
|
1136
1144
|
for key, value in data.items():
|
|
1137
1145
|
indices_array = np.array([row[:2] for row in value], dtype=INDICES_DTYPE)
|
|
@@ -29,7 +29,8 @@ class ShapeMismatch(BrightwayProcessingError):
|
|
|
29
29
|
class InvalidName(BrightwayProcessingError):
|
|
30
30
|
"""Name fails datapackage requirements:
|
|
31
31
|
|
|
32
|
-
A short url-usable (and preferably human-readable) name of the package. This MUST be lower-case and contain only alphanumeric characters along with ".", "_" or "-" characters.
|
|
32
|
+
A short url-usable (and preferably human-readable) name of the package. This MUST be lower-case and contain only alphanumeric characters along with ".", "_" or "-" characters.
|
|
33
|
+
"""
|
|
33
34
|
|
|
34
35
|
pass
|
|
35
36
|
|
|
@@ -23,7 +23,8 @@ def safe_filename(
|
|
|
23
23
|
|
|
24
24
|
if `add_hash`, appends hash of `string` to avoid name collisions.
|
|
25
25
|
|
|
26
|
-
From http://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename-in-python
|
|
26
|
+
From http://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename-in-python
|
|
27
|
+
"""
|
|
27
28
|
safe = re.sub(
|
|
28
29
|
r"[-\s]+",
|
|
29
30
|
"-",
|
|
@@ -12,8 +12,10 @@ from fs.zipfs import ZipFS
|
|
|
12
12
|
from .constants import MatrixSerializeFormat
|
|
13
13
|
from .errors import InvalidMimetype
|
|
14
14
|
from .proxies import Proxy
|
|
15
|
+
|
|
15
16
|
try:
|
|
16
17
|
from .io_parquet_helpers import load_ndarray_from_parquet, save_arr_to_parquet
|
|
18
|
+
|
|
17
19
|
PARQUET = True
|
|
18
20
|
except ImportError:
|
|
19
21
|
load_ndarray_from_parquet = None
|
|
@@ -30,7 +30,7 @@ def update_nrows(resource: dict, data: Any) -> dict:
|
|
|
30
30
|
def add_resource_suffix(metadata: dict, suffix: str) -> dict:
|
|
31
31
|
"""Update the ``name``, ``path``, and ``group`` values to include ``suffix``. The suffix comes after the basename but after the data type suffix (e.g. indices, data).
|
|
32
32
|
|
|
33
|
-
Given the suffix _foo
|
|
33
|
+
Given the suffix ``_foo`` and the metadata::
|
|
34
34
|
|
|
35
35
|
{
|
|
36
36
|
"name": "sa-data-vector-from-dict.indices",
|
|
@@ -38,7 +38,7 @@ def add_resource_suffix(metadata: dict, suffix: str) -> dict:
|
|
|
38
38
|
"group": "sa-data-vector-from-dict",
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
It will return::
|
|
42
42
|
|
|
43
43
|
{
|
|
44
44
|
"name": "sa-data-vector-from-dict_foo.indices",
|
|
@@ -13,6 +13,7 @@ class Proxy:
|
|
|
13
13
|
def __call__(self):
|
|
14
14
|
"""Retrieve the data.
|
|
15
15
|
|
|
16
|
-
Rewinds the file or buffer to 0, see https://github.com/brightway-lca/bw_processing/issues/9.
|
|
16
|
+
Rewinds the file or buffer to 0, see https://github.com/brightway-lca/bw_processing/issues/9.
|
|
17
|
+
"""
|
|
17
18
|
self.kwargs[self.label].seek(0)
|
|
18
19
|
return self.func(**self.kwargs)
|
|
@@ -8,7 +8,7 @@ def greedy_set_cover(data, exclude=None, raise_error=True):
|
|
|
8
8
|
|
|
9
9
|
Feature selection is a well known problem, and is analogous to the `set cover problem <https://en.wikipedia.org/wiki/Set_cover_problem>`__, for which there is a `well known heuristic <https://en.wikipedia.org/wiki/Set_cover_problem#Greedy_algorithm>`__.
|
|
10
10
|
|
|
11
|
-
Example
|
|
11
|
+
Example::
|
|
12
12
|
|
|
13
13
|
data = [
|
|
14
14
|
{'a': 1, 'b': 2, 'c': 3},
|
|
@@ -73,7 +73,7 @@ def as_unique_attributes(data, exclude=None, include=None, raise_error=False):
|
|
|
73
73
|
|
|
74
74
|
Each element in ``data`` must have the attribute ``id``, and it must be unique. However, the field "id" is not used in selecting the unique set of attributes.
|
|
75
75
|
|
|
76
|
-
If no set of attributes is found that uniquely identifies all features is found, all fields are used. To have this case raise an error, pass ``raise_error=True
|
|
76
|
+
If no set of attributes is found that uniquely identifies all features is found, all fields are used. To have this case raise an error, pass ``raise_error=True``.::
|
|
77
77
|
|
|
78
78
|
data = [
|
|
79
79
|
{},
|
|
@@ -89,6 +89,7 @@ def as_unique_attributes(data, exclude=None, include=None, raise_error=False):
|
|
|
89
89
|
|
|
90
90
|
Raises:
|
|
91
91
|
InconsistentFields: Not all features provides all fields.
|
|
92
|
+
|
|
92
93
|
"""
|
|
93
94
|
include = set(include or [])
|
|
94
95
|
fields = greedy_set_cover(data, exclude=exclude, raise_error=raise_error)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from datetime import datetime
|
|
1
2
|
from io import BytesIO
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
from typing import Any, Union
|
|
@@ -98,3 +99,11 @@ def resolve_dict_iterator(iterator: Any, nrows: int = None) -> tuple:
|
|
|
98
99
|
),
|
|
99
100
|
array["flip"],
|
|
100
101
|
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def utc_now() -> datetime:
|
|
105
|
+
"""Get current datetime compatible with Py 3.8 to 3.12"""
|
|
106
|
+
if hasattr(datetime, "UTC"):
|
|
107
|
+
return datetime.now(datetime.UTC)
|
|
108
|
+
else:
|
|
109
|
+
return datetime.utcnow()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bw-processing
|
|
3
|
-
Version: 0.9
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: Tools to create structured arrays in a common format
|
|
5
5
|
Home-page: https://github.com/brightway-lca/bw_processing
|
|
6
6
|
Author: Chris Mutel
|
|
@@ -46,10 +46,10 @@ Library for storing numeric data for use in matrix-based calculations. Designed
|
|
|
46
46
|
[][pypi status]
|
|
47
47
|
[][pypi status]
|
|
48
48
|
[][pypi status]
|
|
49
|
-
[][license]
|
|
50
50
|
|
|
51
51
|
[][read the docs]
|
|
52
|
-
[][tests]
|
|
53
53
|
[][codecov]
|
|
54
54
|
|
|
55
55
|
[][pre-commit]
|
|
@@ -57,7 +57,7 @@ Library for storing numeric data for use in matrix-based calculations. Designed
|
|
|
57
57
|
|
|
58
58
|
[pypi status]: https://pypi.org/project/bw-processing/
|
|
59
59
|
[read the docs]: https://bw-processing.readthedocs.io/
|
|
60
|
-
[tests]: https://github.com/brightway-lca/
|
|
60
|
+
[tests]: https://github.com/brightway-lca/bw_processing/actions/workflows/python-test.yml
|
|
61
61
|
[codecov]: https://app.codecov.io/gh/brightway-lca/bw-processing
|
|
62
62
|
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
63
63
|
[black]: https://github.com/psf/black
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
### import setup ##################################################################################
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
|
|
5
|
+
### project information ###########################################################################
|
|
6
|
+
|
|
7
|
+
project = "Brightway Processing"
|
|
8
|
+
author = "Brightway Developers"
|
|
9
|
+
copyright = datetime.date.today().strftime("%Y") + ' Brightway Developers'
|
|
10
|
+
|
|
11
|
+
### project configuration #########################################################################
|
|
12
|
+
|
|
13
|
+
extensions = [
|
|
14
|
+
# native extensions
|
|
15
|
+
'sphinx.ext.autodoc',
|
|
16
|
+
'sphinx.ext.autosummary',
|
|
17
|
+
'sphinx.ext.mathjax',
|
|
18
|
+
'sphinx.ext.viewcode',
|
|
19
|
+
'sphinx.ext.intersphinx',
|
|
20
|
+
'sphinx.ext.extlinks',
|
|
21
|
+
'sphinx.ext.napoleon',
|
|
22
|
+
# theme
|
|
23
|
+
'sphinx_rtd_theme',
|
|
24
|
+
# Markdown support
|
|
25
|
+
'myst_parser',
|
|
26
|
+
# API documentation support
|
|
27
|
+
'autoapi',
|
|
28
|
+
# responsive web component support
|
|
29
|
+
'sphinx_design',
|
|
30
|
+
# copy button on code blocks
|
|
31
|
+
"sphinx_copybutton",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
exclude_patterns = ['_build']
|
|
35
|
+
|
|
36
|
+
# The master toctree document.
|
|
37
|
+
master_doc = 'index'
|
|
38
|
+
|
|
39
|
+
### theme configuration ############################################################################
|
|
40
|
+
|
|
41
|
+
html_theme = "sphinx_rtd_theme"
|
|
42
|
+
html_title = "Brightway Processing"
|
|
43
|
+
html_show_sphinx = False
|
|
44
|
+
|
|
45
|
+
html_theme_options = {
|
|
46
|
+
'logo_only': False,
|
|
47
|
+
'display_version': True,
|
|
48
|
+
'prev_next_buttons_location': 'bottom',
|
|
49
|
+
# Toc options
|
|
50
|
+
'collapse_navigation': True,
|
|
51
|
+
'sticky_navigation': True,
|
|
52
|
+
'navigation_depth': 4,
|
|
53
|
+
'includehidden': True,
|
|
54
|
+
'titles_only': True
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
html_logo = 'https://raw.githubusercontent.com/brightway-lca/brightway-documentation/main/source/_static/logo/BW_all_white_transparent_landscape_wide.svg'
|
|
58
|
+
html_favicon = 'https://github.com/brightway-lca/brightway-documentation/blob/main/source/_static/logo/BW_favicon_500x500.png'
|
|
59
|
+
|
|
60
|
+
### extension configuration ########################################################################
|
|
61
|
+
|
|
62
|
+
## myst_parser configuration ############################################
|
|
63
|
+
## https://myst-parser.readthedocs.io/en/latest/configuration.html
|
|
64
|
+
|
|
65
|
+
source_suffix = {
|
|
66
|
+
'.rst': 'restructuredtext',
|
|
67
|
+
'.md': 'markdown',
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
myst_enable_extensions = [
|
|
71
|
+
"amsmath",
|
|
72
|
+
"colon_fence",
|
|
73
|
+
"deflist",
|
|
74
|
+
"dollarmath",
|
|
75
|
+
"html_image",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
## autoapi configuration ################################################
|
|
79
|
+
## https://sphinx-autoapi.readthedocs.io/en/latest/reference/config.html#customisation-options
|
|
80
|
+
|
|
81
|
+
autoapi_options = [
|
|
82
|
+
'members',
|
|
83
|
+
'undoc-members',
|
|
84
|
+
'private-members',
|
|
85
|
+
'show-inheritance',
|
|
86
|
+
'show-module-summary',
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
autoapi_python_class_content = 'both'
|
|
90
|
+
autoapi_member_order = 'groupwise'
|
|
91
|
+
autoapi_root = 'content/api'
|
|
92
|
+
autoapi_keep_files = False
|
|
93
|
+
|
|
94
|
+
autoapi_dirs = [
|
|
95
|
+
'../bw_processing',
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
autoapi_ignore = [
|
|
99
|
+
'*/data/*',
|
|
100
|
+
'*tests/*',
|
|
101
|
+
'*tests.py',
|
|
102
|
+
'*validation.py',
|
|
103
|
+
'*version.py',
|
|
104
|
+
'*.rst',
|
|
105
|
+
'*.yml',
|
|
106
|
+
'*.md',
|
|
107
|
+
'*.json',
|
|
108
|
+
'*.data'
|
|
109
|
+
]
|
bw-processing-0.9/docs/conf.py
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"""Sphinx configuration."""
|
|
2
|
-
import importlib.metadata
|
|
3
|
-
import os
|
|
4
|
-
import shutil
|
|
5
|
-
|
|
6
|
-
from sphinx.ext import apidoc
|
|
7
|
-
|
|
8
|
-
# Run sphinx-apidoc
|
|
9
|
-
# This hack is necessary since RTD does not issue `sphinx-apidoc` before running
|
|
10
|
-
# `sphinx-build -b html . _build/html`. See Issue:
|
|
11
|
-
# https://github.com/readthedocs/readthedocs.org/issues/1139
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__location__ = os.path.dirname(__file__)
|
|
15
|
-
|
|
16
|
-
output_dir = os.path.join(__location__, "api")
|
|
17
|
-
module_dir = os.path.join(__location__, "../bw_processing")
|
|
18
|
-
try:
|
|
19
|
-
shutil.rmtree(output_dir)
|
|
20
|
-
except FileNotFoundError:
|
|
21
|
-
pass
|
|
22
|
-
|
|
23
|
-
try:
|
|
24
|
-
args = f"--implicit-namespaces -f -o {output_dir} {module_dir}".split(" ")
|
|
25
|
-
apidoc.main(args)
|
|
26
|
-
except Exception as e:
|
|
27
|
-
print("Running `sphinx-apidoc` failed!\n{}".format(e))
|
|
28
|
-
|
|
29
|
-
# General Configuration
|
|
30
|
-
|
|
31
|
-
project = "bw-processing"
|
|
32
|
-
author = "Chris Mutel"
|
|
33
|
-
copyright = "2023, Chris Mutel"
|
|
34
|
-
extensions = [
|
|
35
|
-
"sphinx.ext.autodoc",
|
|
36
|
-
"sphinx.ext.napoleon",
|
|
37
|
-
"myst_parser",
|
|
38
|
-
]
|
|
39
|
-
source_suffix = {
|
|
40
|
-
".rst": "restructuredtext",
|
|
41
|
-
".md": "markdown",
|
|
42
|
-
}
|
|
43
|
-
autodoc_typehints = "description"
|
|
44
|
-
html_theme = "furo"
|
|
45
|
-
|
|
46
|
-
needs_sphinx = "5.0"
|
|
47
|
-
|
|
48
|
-
version = importlib.metadata.version("bw_processing")
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|