openepd 2.0.0__tar.gz → 3.0.0__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.
Files changed (61) hide show
  1. openepd-2.0.0/README.md → openepd-3.0.0/PKG-INFO +57 -2
  2. openepd-2.0.0/PKG-INFO → openepd-3.0.0/README.md +31 -26
  3. {openepd-2.0.0 → openepd-3.0.0}/pyproject.toml +9 -7
  4. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/__init__.py +1 -1
  5. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/__version__.py +2 -2
  6. {openepd-2.0.0/src/openepd/bundle → openepd-3.0.0/src/openepd/api}/__init__.py +1 -1
  7. openepd-3.0.0/src/openepd/api/base_sync_client.py +550 -0
  8. {openepd-2.0.0/src/openepd/model → openepd-3.0.0/src/openepd/api/category}/__init__.py +1 -1
  9. openepd-3.0.0/src/openepd/api/category/dto.py +25 -0
  10. openepd-3.0.0/src/openepd/api/category/sync_api.py +44 -0
  11. openepd-3.0.0/src/openepd/api/common.py +239 -0
  12. openepd-3.0.0/src/openepd/api/dto/__init__.py +19 -0
  13. openepd-3.0.0/src/openepd/api/dto/base.py +41 -0
  14. openepd-3.0.0/src/openepd/api/dto/common.py +115 -0
  15. openepd-3.0.0/src/openepd/api/dto/meta.py +69 -0
  16. openepd-3.0.0/src/openepd/api/dto/mf.py +59 -0
  17. openepd-3.0.0/src/openepd/api/dto/params.py +19 -0
  18. openepd-3.0.0/src/openepd/api/epd/__init__.py +19 -0
  19. openepd-3.0.0/src/openepd/api/epd/dto.py +121 -0
  20. openepd-3.0.0/src/openepd/api/epd/sync_api.py +105 -0
  21. openepd-3.0.0/src/openepd/api/errors.py +86 -0
  22. openepd-3.0.0/src/openepd/api/pcr/__init__.py +19 -0
  23. openepd-3.0.0/src/openepd/api/pcr/dto.py +41 -0
  24. openepd-3.0.0/src/openepd/api/pcr/sync_api.py +49 -0
  25. openepd-3.0.0/src/openepd/api/sync_client.py +67 -0
  26. openepd-3.0.0/src/openepd/api/test/__init__.py +19 -0
  27. openepd-3.0.0/src/openepd/bundle/__init__.py +19 -0
  28. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/bundle/base.py +1 -1
  29. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/bundle/model.py +5 -6
  30. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/bundle/reader.py +5 -5
  31. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/bundle/writer.py +5 -4
  32. openepd-3.0.0/src/openepd/compat/__init__.py +19 -0
  33. openepd-2.0.0/src/openepd/model/specs/__init__.py → openepd-3.0.0/src/openepd/compat/pydantic.py +9 -9
  34. openepd-3.0.0/src/openepd/model/__init__.py +19 -0
  35. openepd-3.0.0/src/openepd/model/base.py +237 -0
  36. openepd-3.0.0/src/openepd/model/category.py +39 -0
  37. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/model/common.py +33 -25
  38. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/model/epd.py +97 -78
  39. openepd-3.0.0/src/openepd/model/factory.py +48 -0
  40. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/model/lcia.py +24 -13
  41. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/model/org.py +28 -18
  42. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/model/pcr.py +42 -14
  43. openepd-3.0.0/src/openepd/model/specs/README.md +19 -0
  44. openepd-3.0.0/src/openepd/model/specs/__init__.py +45 -0
  45. openepd-3.0.0/src/openepd/model/specs/aluminium.py +67 -0
  46. openepd-3.0.0/src/openepd/model/specs/asphalt.py +87 -0
  47. openepd-3.0.0/src/openepd/model/specs/base.py +60 -0
  48. openepd-3.0.0/src/openepd/model/specs/concrete.py +519 -0
  49. openepd-3.0.0/src/openepd/model/specs/glass.py +404 -0
  50. openepd-3.0.0/src/openepd/model/specs/steel.py +193 -0
  51. openepd-3.0.0/src/openepd/model/specs/wood.py +130 -0
  52. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/model/standard.py +2 -3
  53. openepd-3.0.0/src/openepd/model/validation/__init__.py +19 -0
  54. openepd-3.0.0/src/openepd/model/validation/common.py +59 -0
  55. openepd-3.0.0/src/openepd/model/validation/numbers.py +26 -0
  56. openepd-3.0.0/src/openepd/model/validation/quantity.py +131 -0
  57. openepd-3.0.0/src/openepd/model/versioning.py +129 -0
  58. openepd-2.0.0/src/openepd/model/base.py +0 -138
  59. openepd-2.0.0/src/openepd/model/specs/concrete.py +0 -89
  60. {openepd-2.0.0 → openepd-3.0.0}/LICENSE +0 -0
  61. {openepd-2.0.0 → openepd-3.0.0}/src/openepd/py.typed +0 -0
@@ -1,3 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: openepd
3
+ Version: 3.0.0
4
+ Summary: Python library to work with OpenEPD format
5
+ Home-page: https://github.com/cchangelabs/openepd
6
+ License: Apache-2.0
7
+ Author: C-Change Labs
8
+ Author-email: support@c-change-labs.com
9
+ Maintainer: C-Change Labs
10
+ Maintainer-email: open-source@c-change-labs.com
11
+ Requires-Python: >=3.11,<4.0
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Provides-Extra: api-client
20
+ Requires-Dist: email-validator (>=1.3.1)
21
+ Requires-Dist: pydantic (>=1.10,<3.0)
22
+ Requires-Dist: requests (>=2.0) ; extra == "api-client"
23
+ Project-URL: Repository, https://github.com/cchangelabs/openepd
24
+ Description-Content-Type: text/markdown
25
+
1
26
  # Python Library to work with OpenEPD format
2
27
 
3
28
  <p align="center">
@@ -34,18 +59,47 @@ documenting supply-chain specific data.
34
59
 
35
60
  ## Usage
36
61
 
62
+ ## Usage
63
+
37
64
  **❗ ATTENTION**: Pick the right version. The cornerstone of this library models package representing openEPD models.
38
65
  Models are defined with Pydantic library which is a dependency for openepd package. If you use Pydantic in your project
39
66
  carefully pick the version:
40
67
 
41
- * Use version below `1.0.0` if your project uses Pydantic version below `2.0.0`
42
- * Use version `1.0.0` or higher if your project uses Pydantic version `2.0.0` or above
68
+ * Use version **below** `2.0.0` if your project uses Pydantic version below `2.0.0`
69
+ * Use version `2.x.x` or higher if your project uses Pydantic version `2.0.0` or above
43
70
 
44
71
  ### Models
45
72
 
46
73
  The library provides the Pydantic models for all the OpenEPD entities. The models are available in the `openepd.models`
47
74
  module. For mode details on the usage please refer to Pydantic documentation.
48
75
 
76
+ ### API Client
77
+
78
+ The library provides the API client to work with the OpenEPD API. The client is available in the `openepd.client` module.
79
+ Currently, the only available implementation is based on synchronous [requests]() library. Client provides the following
80
+ features:
81
+ * Error handling - depending on HTTP status code the client raises different exceptions allowing to handle errors
82
+ in a more granular way.
83
+ * Throttling - the client is able to throttle the requests to the API to avoid hitting the rate limits.
84
+ * Retry - the client is able to retry the requests in case of the network errors.
85
+
86
+ #### API Client Usage
87
+
88
+ The following example illustrates the usage of the API client:
89
+
90
+ ```python
91
+ from openepd.api.sync_client import OpenEpdApiClientSync
92
+
93
+ # Setup the client
94
+ api_client = OpenEpdApiClientSync(
95
+ "https://openepd.buildingtransparency.org/api",
96
+ "<Your API Token>",
97
+ )
98
+
99
+ # Use API, e.g. get EPD by ID
100
+ epd = api_client.epds.get_by_openxpd_uuid("ec3b9j5t")
101
+ ```
102
+
49
103
  ### Bundle
50
104
 
51
105
  Bundle is a format which allows to bundle multiple openEPD objects together (it might be EPDs, PCRs, Orgs + any
@@ -96,3 +150,4 @@ This library has been written and maintained by [C-Change Labs](https://c-change
96
150
  # License
97
151
 
98
152
  This library is licensed under [Apache 2](/LICENSE). This means you are free to use it in commercial projects.
153
+
@@ -1,26 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: openepd
3
- Version: 2.0.0
4
- Summary: Python library to work with OpenEPD format
5
- Home-page: https://github.com/cchangelabs/openepd
6
- License: Apache-2.0
7
- Author: C-Change Labs
8
- Author-email: support@c-change-labs.com
9
- Maintainer: C-Change Labs
10
- Maintainer-email: open-source@c-change-labs.com
11
- Requires-Python: >=3.11,<4.0
12
- Classifier: Development Status :: 3 - Alpha
13
- Classifier: Intended Audience :: Developers
14
- Classifier: License :: OSI Approved :: Apache Software License
15
- Classifier: Operating System :: OS Independent
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
- Requires-Dist: email-validator (>=1.3.0)
20
- Requires-Dist: pydantic (>=2.0,<3.0)
21
- Project-URL: Repository, https://github.com/cchangelabs/openepd
22
- Description-Content-Type: text/markdown
23
-
24
1
  # Python Library to work with OpenEPD format
25
2
 
26
3
  <p align="center">
@@ -57,18 +34,47 @@ documenting supply-chain specific data.
57
34
 
58
35
  ## Usage
59
36
 
37
+ ## Usage
38
+
60
39
  **❗ ATTENTION**: Pick the right version. The cornerstone of this library models package representing openEPD models.
61
40
  Models are defined with Pydantic library which is a dependency for openepd package. If you use Pydantic in your project
62
41
  carefully pick the version:
63
42
 
64
- * Use version below `1.0.0` if your project uses Pydantic version below `2.0.0`
65
- * Use version `1.0.0` or higher if your project uses Pydantic version `2.0.0` or above
43
+ * Use version **below** `2.0.0` if your project uses Pydantic version below `2.0.0`
44
+ * Use version `2.x.x` or higher if your project uses Pydantic version `2.0.0` or above
66
45
 
67
46
  ### Models
68
47
 
69
48
  The library provides the Pydantic models for all the OpenEPD entities. The models are available in the `openepd.models`
70
49
  module. For mode details on the usage please refer to Pydantic documentation.
71
50
 
51
+ ### API Client
52
+
53
+ The library provides the API client to work with the OpenEPD API. The client is available in the `openepd.client` module.
54
+ Currently, the only available implementation is based on synchronous [requests]() library. Client provides the following
55
+ features:
56
+ * Error handling - depending on HTTP status code the client raises different exceptions allowing to handle errors
57
+ in a more granular way.
58
+ * Throttling - the client is able to throttle the requests to the API to avoid hitting the rate limits.
59
+ * Retry - the client is able to retry the requests in case of the network errors.
60
+
61
+ #### API Client Usage
62
+
63
+ The following example illustrates the usage of the API client:
64
+
65
+ ```python
66
+ from openepd.api.sync_client import OpenEpdApiClientSync
67
+
68
+ # Setup the client
69
+ api_client = OpenEpdApiClientSync(
70
+ "https://openepd.buildingtransparency.org/api",
71
+ "<Your API Token>",
72
+ )
73
+
74
+ # Use API, e.g. get EPD by ID
75
+ epd = api_client.epds.get_by_openxpd_uuid("ec3b9j5t")
76
+ ```
77
+
72
78
  ### Bundle
73
79
 
74
80
  Bundle is a format which allows to bundle multiple openEPD objects together (it might be EPDs, PCRs, Orgs + any
@@ -119,4 +125,3 @@ This library has been written and maintained by [C-Change Labs](https://c-change
119
125
  # License
120
126
 
121
127
  This library is licensed under [Apache 2](/LICENSE). This means you are free to use it in commercial projects.
122
-
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openepd"
3
- version = "2.0.0"
3
+ version = "3.0.0"
4
4
  license = "Apache-2.0"
5
5
  description = "Python library to work with OpenEPD format"
6
6
  authors = ["C-Change Labs <support@c-change-labs.com>"]
@@ -21,8 +21,9 @@ exclude = ["**/test_*.py", "**/tests/**"]
21
21
 
22
22
  [tool.poetry.dependencies]
23
23
  python = "^3.11"
24
- pydantic = ">=2.0,<3.0"
25
- email-validator = ">=1.3.0"
24
+ pydantic = ">=1.10,<3.0"
25
+ email-validator = ">=1.3.1"
26
+ requests = { version = ">=2.0", optional = true }
26
27
 
27
28
  # Optional dependencies
28
29
  # lxml = { version = "~=4.9.2", optional = true }
@@ -45,23 +46,23 @@ flake8-docstrings = "~=1.7.0"
45
46
  isort = "~=5.11"
46
47
  mypy = ">=1.0.1"
47
48
  pre-commit = "~=2.19"
48
- commitizen = "~=2.42.1"
49
+ commitizen = "~=3.16.0"
49
50
 
50
51
  # Type checking
51
52
  types-dateparser = ">=1.1.3"
52
53
  types-deprecated = ">=1.2.9"
54
+ types-requests = ">=2.0"
53
55
 
54
56
  [tool.poetry.extras]
55
- #xml = ["lxml"]
57
+ api_client = ["requests"]
56
58
 
57
59
 
58
60
  [tool.commitizen]
59
- version = "2.0.0"
61
+ version_provider = "poetry"
60
62
  bump_version = "bump: version $current_version → $new_version"
61
63
  update_changelog_on_bump = true
62
64
  pre_bump_hooks = []
63
65
  version_files = [
64
- "pyproject.toml",
65
66
  "src/openepd/__version__.py",
66
67
  ]
67
68
 
@@ -122,6 +123,7 @@ warn_return_any = false
122
123
  disallow_any_generics = false
123
124
  pretty = true
124
125
  mypy_path = "$MYPY_CONFIG_FILE_DIR/stubs"
126
+ plugins = ["pydantic.mypy"]
125
127
  exclude = ["test_.*\\.py$", ]
126
128
 
127
129
  [[tool.mypy.overrides]]
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2023 by C Change Labs Inc. www.c-change-labs.com
2
+ # Copyright 2024 by C Change Labs Inc. www.c-change-labs.com
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2023 by C Change Labs Inc. www.c-change-labs.com
2
+ # Copyright 2024 by C Change Labs Inc. www.c-change-labs.com
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -17,4 +17,4 @@
17
17
  # Charles Pankow Foundation, Microsoft Sustainability Fund, Interface, MKA Foundation, and others.
18
18
  # Find out more at www.BuildingTransparency.org
19
19
  #
20
- VERSION = "2.0.0"
20
+ VERSION = "3.0.0"
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2023 by C Change Labs Inc. www.c-change-labs.com
2
+ # Copyright 2024 by C Change Labs Inc. www.c-change-labs.com
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.