openepd 6.19.0__py3-none-any.whl → 6.20.0__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.
openepd/__version__.py CHANGED
@@ -13,4 +13,4 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- VERSION = "6.19.0"
16
+ VERSION = "6.20.0"
@@ -0,0 +1,15 @@
1
+ #
2
+ # Copyright 2025 by C Change Labs Inc. www.c-change-labs.com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
@@ -0,0 +1,79 @@
1
+ #
2
+ # Copyright 2025 by C Change Labs Inc. www.c-change-labs.com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from typing import Literal, overload
17
+
18
+ from requests import Response
19
+
20
+ from openepd.api.base_sync_client import BaseApiMethodGroup
21
+ from openepd.api.utils import encode_path_param
22
+ from openepd.model.org import Org, OrgRef
23
+
24
+
25
+ class OrgApi(BaseApiMethodGroup):
26
+ """API methods for Orgs."""
27
+
28
+ @overload
29
+ def create(self, to_create: Org, with_response: Literal[True]) -> tuple[OrgRef, Response]: ...
30
+
31
+ @overload
32
+ def create(self, to_create: Org, with_response: Literal[False] = False) -> OrgRef: ...
33
+
34
+ def create(self, to_create: Org, with_response: bool = False) -> OrgRef | tuple[OrgRef, Response]:
35
+ """
36
+ Create a new organization.
37
+
38
+ :param to_create: Organization to create
39
+ :param with_response: if True, return a tuple of (OrgRef, Response), otherwise return only OrgRef
40
+ :return: Organization reference or Organization reference with HTTP Response object depending on parameter
41
+ :raise ValidationError: if given object Org is invalid
42
+ """
43
+ response = self._client.do_request("post", "/orgs", json=to_create.to_serializable())
44
+ content = response.json()
45
+ ref = OrgRef.parse_obj(content)
46
+ if with_response:
47
+ return ref, response
48
+ return ref
49
+
50
+ @overload
51
+ def edit(self, to_edit: Org, with_response: Literal[True]) -> tuple[OrgRef, Response]: ...
52
+
53
+ @overload
54
+ def edit(self, to_edit: Org, with_response: Literal[False] = False) -> OrgRef: ...
55
+
56
+ def edit(self, to_edit: Org, with_response: bool = False) -> OrgRef | tuple[OrgRef, Response]:
57
+ """
58
+ Edit an organization.
59
+
60
+ :param to_edit: Organization to edit
61
+ :param with_response: if True, return a tuple of (OrgRef, Response), otherwise return only Org
62
+ :return: Organization reference or Organization reference with HTTP Response object depending on parameter
63
+ :raise ValueError: if the organization web_domain is not set
64
+ """
65
+ entity_id = to_edit.web_domain
66
+ if not entity_id:
67
+ msg = "The organization web_domain must be set to edit an organization."
68
+ raise ValueError(msg)
69
+ response = self._client.do_request(
70
+ "put",
71
+ f"/orgs/{encode_path_param(entity_id)}",
72
+ json=to_edit.to_serializable(exclude_unset=True, exclude_defaults=True, by_alias=True),
73
+ )
74
+ response.raise_for_status()
75
+ content = response.json()
76
+ ref = OrgRef.parse_obj(content)
77
+ if with_response:
78
+ return ref, response
79
+ return ref
@@ -13,7 +13,12 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
+ from typing import Literal, overload
17
+
18
+ from requests import Response
19
+
16
20
  from openepd.api.base_sync_client import BaseApiMethodGroup
21
+ from openepd.api.utils import encode_path_param
17
22
  from openepd.model.pcr import Pcr, PcrRef
18
23
 
19
24
 
@@ -42,3 +47,33 @@ class PcrApi(BaseApiMethodGroup):
42
47
  """
43
48
  pcr_ref_obj = self._client.do_request("post", "/pcrs", json=pcr.to_serializable()).json()
44
49
  return PcrRef.parse_obj(pcr_ref_obj)
50
+
51
+ @overload
52
+ def edit(self, to_edit: Pcr, with_response: Literal[True]) -> tuple[PcrRef, Response]: ...
53
+
54
+ @overload
55
+ def edit(self, to_edit: Pcr, with_response: Literal[False] = False) -> PcrRef: ...
56
+
57
+ def edit(self, to_edit: Pcr, with_response: bool = False) -> PcrRef | tuple[PcrRef, Response]:
58
+ """
59
+ Edit a pcr.
60
+
61
+ :param to_edit: Pcr to edit
62
+ :param with_response: if True, return a tuple of (PcrRef, Response), otherwise return only PcrRef
63
+ :return: Pcr reference or Pcr reference with HTTP Response object depending on parameter
64
+ :raise ValueError: if the pcr ID is not set
65
+ """
66
+ entity_id = to_edit.id
67
+ if not entity_id:
68
+ msg = "The pcr ID must be set to edit a pcr."
69
+ raise ValueError(msg)
70
+ response = self._client.do_request(
71
+ "put",
72
+ f"/pcrs/{encode_path_param(entity_id)}",
73
+ json=to_edit.to_serializable(exclude_unset=True, exclude_defaults=True, by_alias=True),
74
+ )
75
+ content = response.json()
76
+ ref = PcrRef.parse_obj(content)
77
+ if with_response:
78
+ return ref, response
79
+ return ref
@@ -0,0 +1,15 @@
1
+ #
2
+ # Copyright 2025 by C Change Labs Inc. www.c-change-labs.com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
@@ -0,0 +1,79 @@
1
+ #
2
+ # Copyright 2025 by C Change Labs Inc. www.c-change-labs.com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from typing import Literal, overload
17
+
18
+ from requests import Response
19
+
20
+ from openepd.api.base_sync_client import BaseApiMethodGroup
21
+ from openepd.api.utils import encode_path_param
22
+ from openepd.model.org import Plant, PlantRef
23
+
24
+
25
+ class PlantApi(BaseApiMethodGroup):
26
+ """API methods for Plants."""
27
+
28
+ @overload
29
+ def create(self, to_create: Plant, with_response: Literal[True]) -> tuple[PlantRef, Response]: ...
30
+
31
+ @overload
32
+ def create(self, to_create: Plant, with_response: Literal[False] = False) -> PlantRef: ...
33
+
34
+ def create(self, to_create: Plant, with_response: bool = False) -> PlantRef | tuple[PlantRef, Response]:
35
+ """
36
+ Create a new plant.
37
+
38
+ :param to_create: Plant to create
39
+ :param with_response: if True, return a tuple of (PlantRef, Response), otherwise return only PlantRef
40
+ :return: Plant reference or Plant reference with HTTP Response object depending on parameter
41
+ :raise ValidationError: if given object Plant is invalid
42
+ """
43
+ response = self._client.do_request("post", "/plants", json=to_create.to_serializable())
44
+ content = response.json()
45
+ ref = PlantRef.parse_obj(content)
46
+ if with_response:
47
+ return ref, response
48
+ return ref
49
+
50
+ @overload
51
+ def edit(self, to_edit: Plant, with_response: Literal[True]) -> tuple[PlantRef, Response]: ...
52
+
53
+ @overload
54
+ def edit(self, to_edit: Plant, with_response: Literal[False] = False) -> PlantRef: ...
55
+
56
+ def edit(self, to_edit: Plant, with_response: bool = False) -> PlantRef | tuple[PlantRef, Response]:
57
+ """
58
+ Edit a plant.
59
+
60
+ :param to_edit: Plant to edit
61
+ :param with_response: if True, return a tuple of (PlantRef, Response), otherwise return only PlantRef
62
+ :return: Plant reference or Plant reference with HTTP Response object depending on parameter
63
+ :raise ValueError: if the plant ID is not set
64
+ """
65
+ entity_id = to_edit.id
66
+ if not entity_id:
67
+ msg = "The plant ID must be set to edit a plant."
68
+ raise ValueError(msg)
69
+ response = self._client.do_request(
70
+ "put",
71
+ f"/plants/{encode_path_param(entity_id)}",
72
+ json=to_edit.to_serializable(exclude_unset=True, exclude_defaults=True, by_alias=True),
73
+ )
74
+ response.raise_for_status()
75
+ content = response.json()
76
+ ref = PlantRef.parse_obj(content)
77
+ if with_response:
78
+ return ref, response
79
+ return ref
@@ -0,0 +1,15 @@
1
+ #
2
+ # Copyright 2025 by C Change Labs Inc. www.c-change-labs.com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
@@ -0,0 +1,79 @@
1
+ #
2
+ # Copyright 2025 by C Change Labs Inc. www.c-change-labs.com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from typing import Literal, overload
17
+
18
+ from requests import Response
19
+
20
+ from openepd.api.base_sync_client import BaseApiMethodGroup
21
+ from openepd.api.utils import encode_path_param
22
+ from openepd.model.standard import Standard, StandardRef
23
+
24
+
25
+ class StandardApi(BaseApiMethodGroup):
26
+ """API methods for Standards."""
27
+
28
+ @overload
29
+ def create(self, to_create: Standard, with_response: Literal[True]) -> tuple[StandardRef, Response]: ...
30
+
31
+ @overload
32
+ def create(self, to_create: Standard, with_response: Literal[False] = False) -> StandardRef: ...
33
+
34
+ def create(self, to_create: Standard, with_response: bool = False) -> StandardRef | tuple[StandardRef, Response]:
35
+ """
36
+ Create a new standard.
37
+
38
+ :param to_create: Standard to create
39
+ :param with_response: if True, return a tuple of (StandardRef, Response), otherwise return only StandardRef
40
+ :return: Standard reference or Standard reference with HTTP Response object depending on parameter
41
+ :raise ValidationError: if given object Standard is invalid
42
+ """
43
+ response = self._client.do_request("post", "/standards", json=to_create.to_serializable())
44
+ content = response.json()
45
+ ref = StandardRef.parse_obj(content)
46
+ if with_response:
47
+ return ref, response
48
+ return ref
49
+
50
+ @overload
51
+ def edit(self, to_edit: Standard, with_response: Literal[True]) -> tuple[StandardRef, Response]: ...
52
+
53
+ @overload
54
+ def edit(self, to_edit: Standard, with_response: Literal[False] = False) -> StandardRef: ...
55
+
56
+ def edit(self, to_edit: Standard, with_response: bool = False) -> StandardRef | tuple[StandardRef, Response]:
57
+ """
58
+ Edit a standard.
59
+
60
+ :param to_edit: Standard to edit
61
+ :param with_response: if True, return a tuple of (StandardRef, Response), otherwise return only StandardRef
62
+ :return: Standard reference or Standard reference with HTTP Response object depending on parameter
63
+ :raise ValueError: if the standard short_name is not set
64
+ """
65
+ entity_id = to_edit.short_name
66
+ if not entity_id:
67
+ msg = "The standard short_name must be set to edit a standard."
68
+ raise ValueError(msg)
69
+ response = self._client.do_request(
70
+ "put",
71
+ f"/standards/{encode_path_param(entity_id)}",
72
+ json=to_edit.to_serializable(exclude_unset=True, exclude_defaults=True, by_alias=True),
73
+ )
74
+ response.raise_for_status()
75
+ content = response.json()
76
+ ref = StandardRef.parse_obj(content)
77
+ if with_response:
78
+ return ref, response
79
+ return ref
@@ -22,7 +22,10 @@ from openepd.api.average_dataset.industry_epd_sync_api import IndustryEpdApi
22
22
  from openepd.api.base_sync_client import SyncHttpClient, TokenAuth
23
23
  from openepd.api.category.sync_api import CategoryApi
24
24
  from openepd.api.epd.sync_api import EpdApi
25
+ from openepd.api.org.sync_api import OrgApi
25
26
  from openepd.api.pcr.sync_api import PcrApi
27
+ from openepd.api.plant.sync_api import PlantApi
28
+ from openepd.api.standard.sync_api import StandardApi
26
29
 
27
30
 
28
31
  class OpenEpdApiClientSync:
@@ -41,6 +44,9 @@ class OpenEpdApiClientSync:
41
44
  self._http_client = SyncHttpClient(base_url, auth=auth, **kwargs)
42
45
  self.__epd_api: EpdApi | None = None
43
46
  self.__pcr_api: PcrApi | None = None
47
+ self.__org_api: OrgApi | None = None
48
+ self.__plant_api: PlantApi | None = None
49
+ self.__standard_api: StandardApi | None = None
44
50
  self.__category_api: CategoryApi | None = None
45
51
  self.__generic_estimate_api: GenericEstimateApi | None = None
46
52
  self.__industry_epd_api: IndustryEpdApi | None = None
@@ -59,6 +65,27 @@ class OpenEpdApiClientSync:
59
65
  self.__pcr_api = PcrApi(self._http_client)
60
66
  return self.__pcr_api
61
67
 
68
+ @property
69
+ def orgs(self) -> OrgApi:
70
+ """Get the Org API."""
71
+ if self.__org_api is None:
72
+ self.__org_api = OrgApi(self._http_client)
73
+ return self.__org_api
74
+
75
+ @property
76
+ def plants(self) -> PlantApi:
77
+ """Get the Plant API."""
78
+ if self.__plant_api is None:
79
+ self.__plant_api = PlantApi(self._http_client)
80
+ return self.__plant_api
81
+
82
+ @property
83
+ def standards(self) -> StandardApi:
84
+ """Get the Standard API."""
85
+ if self.__standard_api is None:
86
+ self.__standard_api = StandardApi(self._http_client)
87
+ return self.__standard_api
88
+
62
89
  @property
63
90
  def categories(self) -> CategoryApi:
64
91
  """Get the Category API."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openepd
3
- Version: 6.19.0
3
+ Version: 6.20.0
4
4
  Summary: Python library to work with OpenEPD format
5
5
  License: Apache-2.0
6
6
  Author: C-Change Labs
@@ -1,5 +1,5 @@
1
1
  openepd/__init__.py,sha256=fhxfEyEurLvSfvQci-vb3njzl_lvhcLXiZrecCOaMU8,794
2
- openepd/__version__.py,sha256=3bpnsguYhHUBbEqDHO2zgvwFAf_zr5yjuOpqcce4MLo,639
2
+ openepd/__version__.py,sha256=qqFv4TdG_QezASXat2Iyq25c6fS3PUY0MuIdqETulzQ,639
3
3
  openepd/api/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
4
4
  openepd/api/average_dataset/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
5
5
  openepd/api/average_dataset/generic_estimate_sync_api.py,sha256=_eZt_jGVL1a3p9cr-EF39Ve9Vl5sB8zwzTc_slnRL50,7975
@@ -19,9 +19,15 @@ openepd/api/epd/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,6
19
19
  openepd/api/epd/dto.py,sha256=MqhHjaNdtOc-KT2zNI88EB9-1d2a6CS2zzSus8HefBo,4874
20
20
  openepd/api/epd/sync_api.py,sha256=kBsx43q0cBm51hl3HVvzMIDrMMRi8NMyudPmHYd0qqU,7342
21
21
  openepd/api/errors.py,sha256=BgZeNfMNAKVPfhpuiVapCXNBSsXygAOWql-gy7m9j7E,2868
22
+ openepd/api/org/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
23
+ openepd/api/org/sync_api.py,sha256=VzOrd3eB1xPVLyrKlZl3OwXIQ5nT3808sA6N7MNBu7w,3167
22
24
  openepd/api/pcr/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
23
- openepd/api/pcr/sync_api.py,sha256=MyBOlBqdJt35-fXk-Vr-RpiKUbN_XlilUwwFGvVROdQ,1557
24
- openepd/api/sync_client.py,sha256=reD_OXsaVOvUvnC-cyp5aq8sKSOH2Z8xmImxV2ClQIM,3105
25
+ openepd/api/pcr/sync_api.py,sha256=JWiegxoSnD2JElYORp6QdkbO3jDNhrNKxJR6orsD1TI,2849
26
+ openepd/api/plant/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
27
+ openepd/api/plant/sync_api.py,sha256=cryGfKojyXV78RxIPRTGscWuLnkdgTNJAw9RkxrbZWI,3121
28
+ openepd/api/standard/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
29
+ openepd/api/standard/sync_api.py,sha256=Oj_Os3yBPk7y7hXDvQbzr-AyX-z2b82jzbN7AuiK3Go,3264
30
+ openepd/api/sync_client.py,sha256=DiDSQU0kBd9gU17KrPUvo07pyLv15rGozuWXbkM1JzA,4037
25
31
  openepd/api/test/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
26
32
  openepd/api/utils.py,sha256=xOU8ihC0eghsoaCFhC85PU4WYRwNxVEpfK3gzq4e9ik,2092
27
33
  openepd/bundle/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
@@ -144,7 +150,7 @@ openepd/model/validation/quantity.py,sha256=mP4gIkeOGZuHRhprsf_BX11Cic75NssYxOTk
144
150
  openepd/model/versioning.py,sha256=wBZdOVL3ND9FMIRU9PS3vx9M_7MBiO70xYPQvPez6po,4522
145
151
  openepd/patch_pydantic.py,sha256=bO7U5HqthFol0vfycb0a42UAGL3KOQ8-9MW4yCWOFP0,4150
146
152
  openepd/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
- openepd-6.19.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
148
- openepd-6.19.0.dist-info/METADATA,sha256=odv3HP47b4WVhRfBXhEgRjAEsAwEuLo6OkpjYvWKgoY,9067
149
- openepd-6.19.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
150
- openepd-6.19.0.dist-info/RECORD,,
153
+ openepd-6.20.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
154
+ openepd-6.20.0.dist-info/METADATA,sha256=J0jlBV5Gco4ONtZm_cOAEIAKc06-ChlLrK6TJ_tiAwc,9067
155
+ openepd-6.20.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
156
+ openepd-6.20.0.dist-info/RECORD,,