openepd 6.3.0__py3-none-any.whl → 6.4.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.3.0"
16
+ VERSION = "6.4.0"
@@ -84,7 +84,7 @@ class BaseDeclaration(RootDocument, abc.ABC):
84
84
  description="Language this document is captured in, as an ISO 639-1 code",
85
85
  example="en",
86
86
  )
87
- private: bool = pyd.Field(
87
+ private: bool | None = pyd.Field(
88
88
  default=False,
89
89
  description="This document's author does not wish the contents published. "
90
90
  "Useful for draft, partial, or confidential declarations. "
openepd/model/epd.py CHANGED
@@ -23,6 +23,7 @@ from openepd.model.declaration import (
23
23
  THIRD_PARTY_VERIFIER_DESCRIPTION,
24
24
  BaseDeclaration,
25
25
  OriginalDataFormat,
26
+ RefBase,
26
27
  WithEpdDeveloperMixin,
27
28
  WithProgramOperatorMixin,
28
29
  WithVerifierMixin,
@@ -120,6 +121,12 @@ class Ec3EpdExtension(BaseOpenEpdSchema):
120
121
  original_data_format: OriginalDataFormat | None = pyd.Field(default=None)
121
122
 
122
123
 
124
+ class EpdRef(RefBase, title="EPD (Ref)"):
125
+ """Reference (short) version of EPD object."""
126
+
127
+ pass
128
+
129
+
123
130
  class EpdPreviewV0(
124
131
  WithAttachmentsMixin,
125
132
  WithProgramOperatorMixin,
openepd/model/org.py CHANGED
@@ -15,6 +15,8 @@
15
15
  #
16
16
  from typing import Annotated, Optional
17
17
 
18
+ from openlocationcode import openlocationcode
19
+
18
20
  from openepd.compat.pydantic import pyd
19
21
  from openepd.model.base import BaseOpenEpdSchema
20
22
  from openepd.model.common import Location, WithAltIdsMixin, WithAttachmentsMixin
@@ -77,6 +79,12 @@ class Plant(WithAttachmentsMixin, WithAltIdsMixin, BaseOpenEpdSchema):
77
79
  deprecated="Pluscode field is deprecated. If users need a pluscode they can obtain it from "
78
80
  "`id` like this: `id.spit('.', maxsplit=1)[0]`",
79
81
  )
82
+ latitude: float | None = pyd.Field(
83
+ default=None, description="(deprecated) Latitude of the plant location. Use 'location' fields instead."
84
+ )
85
+ longitude: float | None = pyd.Field(
86
+ default=None, description="(deprecated) Longitude of the plant location. Use 'location' fields instead."
87
+ )
80
88
  owner: Org | None = pyd.Field(description="Organization that owns the plant", default=None)
81
89
  name: str | None = pyd.Field(
82
90
  max_length=200,
@@ -87,17 +95,32 @@ class Plant(WithAttachmentsMixin, WithAltIdsMixin, BaseOpenEpdSchema):
87
95
  address: str | None = pyd.Field(
88
96
  max_length=200,
89
97
  default=None,
90
- description="Text address, preferably geocoded",
98
+ description="(deprecated) Text address, preferably geocoded. Use 'location' fields instead",
91
99
  example="1503 Orchard Hill Rd, LaGrange, GA 30240, United States",
92
100
  )
93
101
  contact_email: pyd.EmailStr | None = pyd.Field(
94
102
  description="Email contact", example="info@interface.com", default=None
95
103
  )
104
+ location: Location | None = pyd.Field(description="Location of the plant", default=None)
96
105
 
97
106
  @classmethod
98
107
  def get_asset_type(cls) -> str | None:
99
108
  """Return the asset type of this class (see BaseOpenEpdSchema.get_asset_type for details)."""
100
109
  return "org"
101
110
 
111
+ @pyd.validator("id")
112
+ def _validate_id(cls, v: str) -> str:
113
+ try:
114
+ pluscode, web_domain = v.split(".", maxsplit=1)
115
+ except ValueError as e:
116
+ raise ValueError("Incorrectly formed id: should be pluscode.owner_web_domain") from e
117
+
118
+ if not openlocationcode.isValid(pluscode):
119
+ raise ValueError("Incorrect pluscode for plant")
120
+
121
+ if not web_domain:
122
+ raise ValueError("Incorrect web_domain for plant")
123
+ return v
124
+
102
125
  class Config(BaseOpenEpdSchema.Config):
103
126
  allow_population_by_field_name = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openepd
3
- Version: 6.3.0
3
+ Version: 6.4.0
4
4
  Summary: Python library to work with OpenEPD format
5
5
  Home-page: https://github.com/cchangelabs/openepd
6
6
  License: Apache-2.0
@@ -20,6 +20,7 @@ Provides-Extra: api-client
20
20
  Requires-Dist: email-validator (>=1.3.1)
21
21
  Requires-Dist: idna (>=3.7)
22
22
  Requires-Dist: open-xpd-uuid (>=0.2.1,<0.3.0)
23
+ Requires-Dist: openlocationcode (>=1.0.1)
23
24
  Requires-Dist: pydantic (>=1.10,<3.0)
24
25
  Requires-Dist: requests (>=2.0) ; extra == "api-client"
25
26
  Project-URL: Repository, https://github.com/cchangelabs/openepd
@@ -1,5 +1,5 @@
1
1
  openepd/__init__.py,sha256=Shkfh0Kun0YRhmRDw7LkUj2eQL3X-HnP55u2THOEALw,794
2
- openepd/__version__.py,sha256=1wIJ73gVOCx0Lw2kVyUX8Dyd4XE4Dsx6YsSMF3LC8F4,638
2
+ openepd/__version__.py,sha256=O6qOKVfb9pn636JTuJTFAz0fRVsGULoVFAA8im6tjMQ,638
3
3
  openepd/api/__init__.py,sha256=UGmZGEyMnASrYwEBPHuXmVzHiuCUskUsJEPoHTIo-lg,620
4
4
  openepd/api/average_dataset/__init__.py,sha256=UGmZGEyMnASrYwEBPHuXmVzHiuCUskUsJEPoHTIo-lg,620
5
5
  openepd/api/average_dataset/generic_estimate_sync_api.py,sha256=mxWwDokEGMe87Px8C_aHvIdVKZVHrEAuVtaSA1zJchU,7953
@@ -36,14 +36,14 @@ openepd/model/__init__.py,sha256=UGmZGEyMnASrYwEBPHuXmVzHiuCUskUsJEPoHTIo-lg,620
36
36
  openepd/model/base.py,sha256=OEYNFUTL4BivBNAt_LGowTlDuUjvKMHgf5U5ZBncZwQ,9805
37
37
  openepd/model/category.py,sha256=IQXNGQFQmFZ_H9PRONloX_UOSf1sTMDq1rM1yz8JR0Y,1639
38
38
  openepd/model/common.py,sha256=yx3m9Tqb7WgqW3SaHB3WftQaShD80dxTys2r63rswy8,9700
39
- openepd/model/declaration.py,sha256=3VFEUHlJTjd-Qzeg5ptue2D6lIeMUYqR5Mcwid3HkqE,13825
40
- openepd/model/epd.py,sha256=py-mvA-1C2rJCkQRY5O48v3HuMqNHrepulSMgSwQZNI,11952
39
+ openepd/model/declaration.py,sha256=oBJ_v_ESoQhybQIH5S5tmYVkgkoX3gwe3nvFyPqb4uk,13832
40
+ openepd/model/epd.py,sha256=AAksfqbpxBiipwsphPil5MvQouCBDMVcAzvIYkeq5OQ,12070
41
41
  openepd/model/factory.py,sha256=XP7eeQNW5tqwX_4hfuEb3lK6BFQDb4KB0fSN0r8-lCU,2656
42
42
  openepd/model/generic_estimate.py,sha256=bbU0cR4izSqjZcfxUHNbdO4pllqqd8OaUFikrEgCFoA,3992
43
43
  openepd/model/geography.py,sha256=G3Oz3QBw5n-RiSCAv-vAGxrOZBhwIT5rASnPlo9dkcs,42095
44
44
  openepd/model/industry_epd.py,sha256=rgXhCUDAgzZ9eGio7ExqE3ymP3zTXnrrwcIDvg5YP1A,3285
45
45
  openepd/model/lcia.py,sha256=EChQO_zcc9ZV0cYHCsjjO24pn5oi8d3WMeUxB1Cj3Ww,24390
46
- openepd/model/org.py,sha256=sgiIt2R9fQd9K1F8PC4a3W0tnRv8rjV1aSZk0g-8jcE,4049
46
+ openepd/model/org.py,sha256=gLzbFt4LNFYLhkAMQUrrAgSu-zC6x5NZ0UiNSQqQ0sc,5043
47
47
  openepd/model/pcr.py,sha256=QknLtTn6Y14JORWKQ1qBqGgKnZpbKgqNiYF3Axl4U4c,5494
48
48
  openepd/model/specs/README.md,sha256=UGhSiFJ9hOxT1mZl-5ZrhkOrPKf1W_gcu5CI9hzV7LU,2430
49
49
  openepd/model/specs/__init__.py,sha256=IAevXqqYrCWlTH4z4Fy9o77vaOLinX56G05iIJJfm0M,3094
@@ -133,7 +133,7 @@ openepd/model/validation/quantity.py,sha256=UP6x2nUj1nP7G8e2rpi-HigHx9rwKeCuIDh_
133
133
  openepd/model/versioning.py,sha256=R_zm6rCrgF3vlJQYbpyWhirdS_Oek16cv_mvZmpuE8I,4473
134
134
  openepd/patch_pydantic.py,sha256=xrkzblatmU9HBzukWkp1cPq9ZSuohoz1p0pQqVKSlKs,4122
135
135
  openepd/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
- openepd-6.3.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
137
- openepd-6.3.0.dist-info/METADATA,sha256=9SoVuWAn5ydSG53jxU6jwKRq0Y-8d5t2VjCSt9O8MK0,8996
138
- openepd-6.3.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
139
- openepd-6.3.0.dist-info/RECORD,,
136
+ openepd-6.4.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
137
+ openepd-6.4.0.dist-info/METADATA,sha256=KZPeu2OsyQ-aYGRDN6-NpqSvTfPgeCoG-hAezksY5wc,9038
138
+ openepd-6.4.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
139
+ openepd-6.4.0.dist-info/RECORD,,