openenviro 0.1.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 (34) hide show
  1. openenviro-0.1.0/LICENSE +21 -0
  2. openenviro-0.1.0/MANIFEST.in +4 -0
  3. openenviro-0.1.0/PKG-INFO +277 -0
  4. openenviro-0.1.0/README.md +253 -0
  5. openenviro-0.1.0/pyproject.toml +45 -0
  6. openenviro-0.1.0/setup.cfg +4 -0
  7. openenviro-0.1.0/src/openenviro/__init__.py +101 -0
  8. openenviro-0.1.0/src/openenviro/__main__.py +21 -0
  9. openenviro-0.1.0/src/openenviro/_validation.py +78 -0
  10. openenviro-0.1.0/src/openenviro/_version.py +3 -0
  11. openenviro-0.1.0/src/openenviro/annual_waste.py +191 -0
  12. openenviro-0.1.0/src/openenviro/city_scenario.py +372 -0
  13. openenviro-0.1.0/src/openenviro/climate.py +90 -0
  14. openenviro-0.1.0/src/openenviro/compost.py +303 -0
  15. openenviro-0.1.0/src/openenviro/compost_facility.py +176 -0
  16. openenviro-0.1.0/src/openenviro/errors.py +9 -0
  17. openenviro-0.1.0/src/openenviro/fleet.py +254 -0
  18. openenviro-0.1.0/src/openenviro/gas_scenario.py +52 -0
  19. openenviro-0.1.0/src/openenviro/landfill.py +216 -0
  20. openenviro-0.1.0/src/openenviro/landfill_gas.py +74 -0
  21. openenviro-0.1.0/src/openenviro/landfill_phases.py +110 -0
  22. openenviro-0.1.0/src/openenviro/methane.py +119 -0
  23. openenviro-0.1.0/src/openenviro/population.py +51 -0
  24. openenviro-0.1.0/src/openenviro/py.typed +0 -0
  25. openenviro-0.1.0/src/openenviro/waste.py +51 -0
  26. openenviro-0.1.0/src/openenviro.egg-info/PKG-INFO +277 -0
  27. openenviro-0.1.0/src/openenviro.egg-info/SOURCES.txt +32 -0
  28. openenviro-0.1.0/src/openenviro.egg-info/dependency_links.txt +1 -0
  29. openenviro-0.1.0/src/openenviro.egg-info/top_level.txt +1 -0
  30. openenviro-0.1.0/tests/test_city_scenario.py +161 -0
  31. openenviro-0.1.0/tests/test_fleet_compost.py +188 -0
  32. openenviro-0.1.0/tests/test_foundation.py +135 -0
  33. openenviro-0.1.0/tests/test_landfill_gas.py +185 -0
  34. openenviro-0.1.0/tests/test_population_waste.py +283 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hikmet Emre Kurtbay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include README.md LICENSE
2
+ recursive-include tests *.py
3
+ prune tests/__pycache__
4
+ global-exclude *.py[cod]
@@ -0,0 +1,277 @@
1
+ Metadata-Version: 2.4
2
+ Name: openenviro
3
+ Version: 0.1.0
4
+ Summary: Environmental engineering simulation SDK for transparent, reproducible planning and education
5
+ License-Expression: MIT
6
+ Project-URL: Repository, https://github.com/SimplePuddin/openenviro
7
+ Project-URL: Documentation, https://github.com/SimplePuddin/openenviro/tree/main/docs
8
+ Project-URL: Issues, https://github.com/SimplePuddin/openenviro/issues
9
+ Project-URL: Homepage, https://simplepuddin.github.io/openenviro/
10
+ Keywords: environmental engineering,solid waste,landfill,compost,simulation
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+
25
+ # OpenEnviro Python SDK
26
+
27
+ Independent Python SDK for the OpenEnviro environmental engineering project.
28
+ **Development status:** 0.1.0 alpha release candidate (M14.08). The integrated city API joins the population, waste, fleet, compost, landfill, gas, energy and climate engines. Web CityScenario v1 JSON interchange is supported.
29
+
30
+ ## Local installation (Windows CMD, repository root)
31
+
32
+ Python 3.11 or newer is required. Use a dedicated virtual environment:
33
+
34
+ ```cmd
35
+ py -3 --version
36
+ py -3 -m venv packages\python\.venv
37
+ packages\python\.venv\Scripts\python.exe -m pip install -e packages/python
38
+ packages\python\.venv\Scripts\python.exe -m openenviro --version
39
+ packages\python\.venv\Scripts\python.exe -m unittest discover -s packages/python/tests -v
40
+ ```
41
+
42
+ If the `py` launcher is unavailable but `python` is Python 3.11 or later, use `python` instead of `py -3` in the first two commands. The SDK has no third-party runtime dependencies. pip may need to obtain setuptools in the build environment during initial installation. Do not install an unrelated public package named `openenviro`; install this local source directory.
43
+
44
+ ## Linux / macOS
45
+
46
+ ```sh
47
+ python3 -m venv packages/python/.venv
48
+ packages/python/.venv/bin/python -m pip install -e packages/python
49
+ packages/python/.venv/bin/python -m openenviro --version
50
+ packages/python/.venv/bin/python -m unittest discover -s packages/python/tests -v
51
+ ```
52
+
53
+ ## Implemented API
54
+
55
+ ```python
56
+ import openenviro
57
+ from openenviro import OpenEnviroError, ValidationError
58
+
59
+ print(openenviro.__version__) # 0.1.0
60
+ ```
61
+
62
+ The public numerical API now includes:
63
+
64
+ ```python
65
+ from openenviro import project_population, daily_waste, allocate_waste
66
+ from openenviro import project_landfill_schedule
67
+
68
+ p = project_population(2008, 851292, 2025, 1123693, 2060)
69
+ print(p.arithmetic, p.geometric)
70
+
71
+ waste = daily_waste(1990578, 1.1)
72
+ allocation = allocate_waste(waste, 0.30, 0.50)
73
+ print(waste, allocation.landfill)
74
+
75
+ schedule = project_landfill_schedule(
76
+ base_year=2025, base_population=1123693,
77
+ annual_population_growth=0.016471447950239335,
78
+ start_year=2031, end_year=2060, base_waste_rate=1.1,
79
+ recycling_fraction=0.30, compost_fraction_of_residual=0.50,
80
+ )
81
+ print(schedule.total_landfill_mass) # approximately 6688167.574 t
82
+ ```
83
+
84
+ The two-observation geometric fit uses a compound rate; the annual Sakarya
85
+ reference uses the arithmetic mean of historical year-over-year rates as an
86
+ explicit growth input. They are different models and must not be conflated.
87
+ M14.02 and M14.03 results are frozen dataclasses. `dataclasses.asdict` converts them to dictionaries. M14.04 uses frozen input dataclasses and fresh nested snake_case result dictionaries to support tabular analysis and JSON serialization.
88
+ `_validation` remains internal. Python and web release versions are independent.
89
+
90
+ ## Cross-language check (optional, from repository root)
91
+
92
+ ```cmd
93
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1402_parity.py
94
+ ```
95
+
96
+ Requires the repository's existing Node installation with native TypeScript
97
+ stripping support. Compares valid cases against the actual local TypeScript
98
+ files, with relative tolerance 1e-12 and absolute tolerance 1e-7. Not a substitute
99
+ for the full cross-language validation planned in M14.07. See
100
+ `docs/M14_02_POPULATION_WASTE.md` for scope, provenance and limitations.
101
+
102
+ ## Numerical conventions
103
+
104
+ The existing TypeScript engine is the reference for future model ports. Use binary64 floating point, persons, metric tonnes, kg/person/day, cubic metres, MWh and explicit fractions in [0, 1] where those are the original model units. Preserve full precision until presentation. Reject non-finite numbers and invalid parameters. Preserve distinctions such as a zero result versus an undefined result (`None`). Compare floating-point values using documented model-specific tolerances, not premature rounding.
105
+
106
+ ## Next milestones
107
+
108
+ - M14.02: population and waste models (implemented).
109
+ - M14.03: collection fleet and compost models (implemented; see scope below).
110
+ - M14.04: landfill and gas models (implemented; see below).
111
+ - M14.05: integrated City Scenario API (implemented).
112
+ - M14.06: reproducible notebook examples.
113
+ - M14.07: cross-language numerical equivalence tests.
114
+ - M14.08: release metadata, package validation, and distribution preparation.
115
+
116
+ ## Distribution status
117
+
118
+ Local development only. No public PyPI publication is implied. Verify the repository's LICENSE, include the applicable license and notices in distribution metadata, and check package-name availability before publishing. This foundation does not change the existing repository license.
119
+
120
+ ## Fleet and compost (M14.03)
121
+
122
+ ```python
123
+ from openenviro import (
124
+ HCSInput, calculate_hcs, CompostAmendment, sakarya_compost_feed,
125
+ solve_moisture_target, CompostFacilityInput, calculate_compost_facility,
126
+ )
127
+
128
+ fleet = calculate_hcs(HCSInput(
129
+ daily_waste=766.37253, nominal_payload=4, utilization=.9,
130
+ pickup_minutes=5, unloading_minutes=5, site_minutes=25,
131
+ local_distance_km=1, local_a=.060, local_b=.042,
132
+ haul_one_way_km=20, haul_a=.0022, haul_b=.014,
133
+ shift_hours=8, off_route_fraction=.15,
134
+ ))
135
+ print(fleet.required_vehicles)
136
+
137
+ feed = sakarya_compost_feed(766.37253)
138
+ conditioned = solve_moisture_target(feed, CompostAmendment('Wood chips', .2, .495, .002), .55)
139
+ if conditioned.feasible and conditioned.mix is not None:
140
+ facility = calculate_compost_facility(CompostFacilityInput(conditioned.mix.total_wet_mass))
141
+ print(conditioned.amendment_mass, facility.total_area_ha)
142
+ ```
143
+
144
+ Run the independent cross-language check from the repository root:
145
+
146
+ ```cmd
147
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1403_parity.py
148
+ ```
149
+
150
+ See `docs/M14_03_FLEET_COMPOST.md` for assumptions and boundaries. Multi-zone HCS/SCS comparison, fleet economics, and the UI-specific compost scenario/feed-selection wrappers are not ported in M14.03. The numerical solvers and individual-route / transfer-network models are independent of the web interface.
151
+
152
+
153
+ ## Landfill and gas (M14.04)
154
+
155
+ ```python
156
+ from openenviro import (
157
+ project_landfill_schedule, LandfillCapacityYear, LandfillGeometryInput,
158
+ calculate_landfill_geometry, calculate_landfill_capacity_schedule,
159
+ calculate_landfill_phases, LandfillGasWasteYear, GasScenarioInput,
160
+ calculate_gas_scenario,
161
+ )
162
+
163
+ schedule = project_landfill_schedule(
164
+ base_year=2025, base_population=1123693,
165
+ annual_population_growth=0.016471447950239335,
166
+ start_year=2031, end_year=2060, base_waste_rate=1.1,
167
+ recycling_fraction=.30, compost_fraction_of_residual=.50,
168
+ )
169
+ geometry = LandfillGeometryInput()
170
+ g = calculate_landfill_geometry(geometry)
171
+ capacity = calculate_landfill_capacity_schedule(
172
+ [LandfillCapacityYear(annual_landfill=r.annual_landfill,
173
+ compacted_density=.8,
174
+ cover_fraction_of_waste_volume=.2,
175
+ year=r.year) for r in schedule.rows],
176
+ reserve_fraction=.2, available_airspace=g['gross_volume'],
177
+ )
178
+ phases = calculate_landfill_phases(geometry, capacity['rows'], [2040, 2050, 2060], .2)
179
+ result = calculate_gas_scenario(GasScenarioInput(
180
+ waste=tuple(LandfillGasWasteYear(r.year, r.annual_landfill) for r in schedule.rows),
181
+ ))
182
+ print(capacity['occupied_volume']) # approximately 10032251.36 m3
183
+ print(result['gas']['peak']['year']) # 2061
184
+ print(result['energy']['totals']['net_electricity_mwh']) # approximately 931241.99 MWh
185
+ print(result['climate']['totals']['net_climate_benefit_tco2e']) # approximately 6658873.55 tCO2e
186
+ ```
187
+
188
+ The M14.04 API exposes independent capacity, geometry, inverse sizing, lifts,
189
+ phase/stress tests, Buswell, first-order decay, methane management, energy and
190
+ climate functions plus their integrated gas scenario. Result dictionaries are
191
+ not immutable; treat them as calculation snapshots. Units and assumptions are
192
+ described in `docs/M14_04_LANDFILL_GAS.md`. This is a planning-level model, not a
193
+ permit, geotechnical stability check, plant sizing certification or verified
194
+ carbon inventory. The gas schedule uses planned accepted waste and does not
195
+ truncate intake at the available capacity. The whole-city API is described below.
196
+
197
+ ```cmd
198
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1404_parity.py
199
+ ```
200
+
201
+ This command compares results with the actual local TS source. It checks the
202
+ full nested result objects (including strings, booleans and nulls) plus selected
203
+ invalid input rejections. The older M14.02 and M14.03 checks remain available.
204
+
205
+
206
+ ## Integrated City Scenario (M14.05)
207
+
208
+ ```python
209
+ from dataclasses import replace
210
+ from openenviro import CityScenario, CityEngineeringSettings
211
+
212
+ reference = CityScenario.sakarya_reference()
213
+ results = reference.simulate()
214
+ print(results.population, results.daily_waste)
215
+ print(results.fleet.hcs.required_vehicles) # alternative HCS design
216
+ print(results.compost.facility.total_area_ha)
217
+ print(results.landfill.total_mass)
218
+ if results.gas is not None:
219
+ print(results.gas['peak'])
220
+ print(results.energy['totals']['net_electricity_mwh'])
221
+ print(results.climate['totals']['net_climate_benefit_tco2e'])
222
+ print(results.warnings)
223
+
224
+ circular = replace(reference, id='sakarya-circular', name='Sakarya Circular',
225
+ origin='user-defined', note='Alternative planning scenario',
226
+ projection=replace(reference.projection,
227
+ recycling_fraction=.60,
228
+ compost_fraction_of_residual=.70))
229
+ print(circular.simulate().metrics)
230
+ ```
231
+
232
+ Export a saved city scenario from the web Scenario Manager (not the Results
233
+ JSON from Data Export), then load it using `CityScenario.from_file(path)`.
234
+ Full library backups can be read with `CityScenario.from_library_file(path,
235
+ record_id)` using the **saved record ID**, not the scenario's inner ID. Use
236
+ `Path('scenario.json').write_text(scenario.to_json(), encoding='utf-8')` to
237
+ create an editable scenario compatible with the web importer. `results.to_dict()`
238
+ is a calculated snapshot, not an editable scenario file.
239
+
240
+ Default settings are fixed reference screening assumptions. HCS and SCS are
241
+ alternative estimates for collecting all generated waste; do not add their
242
+ vehicle counts. Transfer uses final landfill feed as a hypothetical haul load.
243
+ Compost uses the reference waste recipe and wood-chip conditioning. Gas assumes
244
+ planned annual accepted waste, not an enforced site-capacity intake cap. Live
245
+ web lab-specific settings are not saved in CityScenario v1. Python settings may
246
+ be changed separately using `dataclasses.replace(CityEngineeringSettings(), ...)`;
247
+ these settings are not included in editable scenario JSON. See
248
+ `docs/M14_05_CITY_SCENARIO.md` for units, failure semantics and examples.
249
+
250
+ ```cmd
251
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1405_parity.py
252
+ ```
253
+
254
+ This check compares actual TypeScript city comparison outputs and independent
255
+ reference engine outputs to the Python integrated scenario. Prior parity checks
256
+ remain available and are required for a fuller model regression.
257
+
258
+ ## Distribution and release checks (M14.08)
259
+
260
+ Version 0.1.0 is a local release candidate; publication to a package index is
261
+ not implied. From the repository root on Windows, copy the unchanged root MIT
262
+ license into the package, install development-only release tools, then build
263
+ and verify the archives:
264
+
265
+ ```cmd
266
+ copy /Y LICENSE packages\python\LICENSE
267
+ packages\python\.venv\Scripts\python.exe -m pip install build twine
268
+ packages\python\.venv\Scripts\python.exe -m build --outdir packages/python/dist/m1408 packages/python
269
+ packages\python\.venv\Scripts\python.exe -m twine check --strict packages/python/dist/m1408/openenviro-0.1.0-py3-none-any.whl packages/python/dist/m1408/openenviro-0.1.0.tar.gz
270
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1408_release.py
271
+ ```
272
+
273
+ Use a fresh output directory for each build; archive checks require exactly one
274
+ wheel and one source distribution. See `docs/M14_08_PYTHON_RELEASE.md` in the
275
+ repository for the full release procedure. The wheel has no third-party runtime
276
+ dependencies. Notebooks and cross-language tools remain in the source
277
+ repository; they are not part of the wheel.
@@ -0,0 +1,253 @@
1
+ # OpenEnviro Python SDK
2
+
3
+ Independent Python SDK for the OpenEnviro environmental engineering project.
4
+ **Development status:** 0.1.0 alpha release candidate (M14.08). The integrated city API joins the population, waste, fleet, compost, landfill, gas, energy and climate engines. Web CityScenario v1 JSON interchange is supported.
5
+
6
+ ## Local installation (Windows CMD, repository root)
7
+
8
+ Python 3.11 or newer is required. Use a dedicated virtual environment:
9
+
10
+ ```cmd
11
+ py -3 --version
12
+ py -3 -m venv packages\python\.venv
13
+ packages\python\.venv\Scripts\python.exe -m pip install -e packages/python
14
+ packages\python\.venv\Scripts\python.exe -m openenviro --version
15
+ packages\python\.venv\Scripts\python.exe -m unittest discover -s packages/python/tests -v
16
+ ```
17
+
18
+ If the `py` launcher is unavailable but `python` is Python 3.11 or later, use `python` instead of `py -3` in the first two commands. The SDK has no third-party runtime dependencies. pip may need to obtain setuptools in the build environment during initial installation. Do not install an unrelated public package named `openenviro`; install this local source directory.
19
+
20
+ ## Linux / macOS
21
+
22
+ ```sh
23
+ python3 -m venv packages/python/.venv
24
+ packages/python/.venv/bin/python -m pip install -e packages/python
25
+ packages/python/.venv/bin/python -m openenviro --version
26
+ packages/python/.venv/bin/python -m unittest discover -s packages/python/tests -v
27
+ ```
28
+
29
+ ## Implemented API
30
+
31
+ ```python
32
+ import openenviro
33
+ from openenviro import OpenEnviroError, ValidationError
34
+
35
+ print(openenviro.__version__) # 0.1.0
36
+ ```
37
+
38
+ The public numerical API now includes:
39
+
40
+ ```python
41
+ from openenviro import project_population, daily_waste, allocate_waste
42
+ from openenviro import project_landfill_schedule
43
+
44
+ p = project_population(2008, 851292, 2025, 1123693, 2060)
45
+ print(p.arithmetic, p.geometric)
46
+
47
+ waste = daily_waste(1990578, 1.1)
48
+ allocation = allocate_waste(waste, 0.30, 0.50)
49
+ print(waste, allocation.landfill)
50
+
51
+ schedule = project_landfill_schedule(
52
+ base_year=2025, base_population=1123693,
53
+ annual_population_growth=0.016471447950239335,
54
+ start_year=2031, end_year=2060, base_waste_rate=1.1,
55
+ recycling_fraction=0.30, compost_fraction_of_residual=0.50,
56
+ )
57
+ print(schedule.total_landfill_mass) # approximately 6688167.574 t
58
+ ```
59
+
60
+ The two-observation geometric fit uses a compound rate; the annual Sakarya
61
+ reference uses the arithmetic mean of historical year-over-year rates as an
62
+ explicit growth input. They are different models and must not be conflated.
63
+ M14.02 and M14.03 results are frozen dataclasses. `dataclasses.asdict` converts them to dictionaries. M14.04 uses frozen input dataclasses and fresh nested snake_case result dictionaries to support tabular analysis and JSON serialization.
64
+ `_validation` remains internal. Python and web release versions are independent.
65
+
66
+ ## Cross-language check (optional, from repository root)
67
+
68
+ ```cmd
69
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1402_parity.py
70
+ ```
71
+
72
+ Requires the repository's existing Node installation with native TypeScript
73
+ stripping support. Compares valid cases against the actual local TypeScript
74
+ files, with relative tolerance 1e-12 and absolute tolerance 1e-7. Not a substitute
75
+ for the full cross-language validation planned in M14.07. See
76
+ `docs/M14_02_POPULATION_WASTE.md` for scope, provenance and limitations.
77
+
78
+ ## Numerical conventions
79
+
80
+ The existing TypeScript engine is the reference for future model ports. Use binary64 floating point, persons, metric tonnes, kg/person/day, cubic metres, MWh and explicit fractions in [0, 1] where those are the original model units. Preserve full precision until presentation. Reject non-finite numbers and invalid parameters. Preserve distinctions such as a zero result versus an undefined result (`None`). Compare floating-point values using documented model-specific tolerances, not premature rounding.
81
+
82
+ ## Next milestones
83
+
84
+ - M14.02: population and waste models (implemented).
85
+ - M14.03: collection fleet and compost models (implemented; see scope below).
86
+ - M14.04: landfill and gas models (implemented; see below).
87
+ - M14.05: integrated City Scenario API (implemented).
88
+ - M14.06: reproducible notebook examples.
89
+ - M14.07: cross-language numerical equivalence tests.
90
+ - M14.08: release metadata, package validation, and distribution preparation.
91
+
92
+ ## Distribution status
93
+
94
+ Local development only. No public PyPI publication is implied. Verify the repository's LICENSE, include the applicable license and notices in distribution metadata, and check package-name availability before publishing. This foundation does not change the existing repository license.
95
+
96
+ ## Fleet and compost (M14.03)
97
+
98
+ ```python
99
+ from openenviro import (
100
+ HCSInput, calculate_hcs, CompostAmendment, sakarya_compost_feed,
101
+ solve_moisture_target, CompostFacilityInput, calculate_compost_facility,
102
+ )
103
+
104
+ fleet = calculate_hcs(HCSInput(
105
+ daily_waste=766.37253, nominal_payload=4, utilization=.9,
106
+ pickup_minutes=5, unloading_minutes=5, site_minutes=25,
107
+ local_distance_km=1, local_a=.060, local_b=.042,
108
+ haul_one_way_km=20, haul_a=.0022, haul_b=.014,
109
+ shift_hours=8, off_route_fraction=.15,
110
+ ))
111
+ print(fleet.required_vehicles)
112
+
113
+ feed = sakarya_compost_feed(766.37253)
114
+ conditioned = solve_moisture_target(feed, CompostAmendment('Wood chips', .2, .495, .002), .55)
115
+ if conditioned.feasible and conditioned.mix is not None:
116
+ facility = calculate_compost_facility(CompostFacilityInput(conditioned.mix.total_wet_mass))
117
+ print(conditioned.amendment_mass, facility.total_area_ha)
118
+ ```
119
+
120
+ Run the independent cross-language check from the repository root:
121
+
122
+ ```cmd
123
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1403_parity.py
124
+ ```
125
+
126
+ See `docs/M14_03_FLEET_COMPOST.md` for assumptions and boundaries. Multi-zone HCS/SCS comparison, fleet economics, and the UI-specific compost scenario/feed-selection wrappers are not ported in M14.03. The numerical solvers and individual-route / transfer-network models are independent of the web interface.
127
+
128
+
129
+ ## Landfill and gas (M14.04)
130
+
131
+ ```python
132
+ from openenviro import (
133
+ project_landfill_schedule, LandfillCapacityYear, LandfillGeometryInput,
134
+ calculate_landfill_geometry, calculate_landfill_capacity_schedule,
135
+ calculate_landfill_phases, LandfillGasWasteYear, GasScenarioInput,
136
+ calculate_gas_scenario,
137
+ )
138
+
139
+ schedule = project_landfill_schedule(
140
+ base_year=2025, base_population=1123693,
141
+ annual_population_growth=0.016471447950239335,
142
+ start_year=2031, end_year=2060, base_waste_rate=1.1,
143
+ recycling_fraction=.30, compost_fraction_of_residual=.50,
144
+ )
145
+ geometry = LandfillGeometryInput()
146
+ g = calculate_landfill_geometry(geometry)
147
+ capacity = calculate_landfill_capacity_schedule(
148
+ [LandfillCapacityYear(annual_landfill=r.annual_landfill,
149
+ compacted_density=.8,
150
+ cover_fraction_of_waste_volume=.2,
151
+ year=r.year) for r in schedule.rows],
152
+ reserve_fraction=.2, available_airspace=g['gross_volume'],
153
+ )
154
+ phases = calculate_landfill_phases(geometry, capacity['rows'], [2040, 2050, 2060], .2)
155
+ result = calculate_gas_scenario(GasScenarioInput(
156
+ waste=tuple(LandfillGasWasteYear(r.year, r.annual_landfill) for r in schedule.rows),
157
+ ))
158
+ print(capacity['occupied_volume']) # approximately 10032251.36 m3
159
+ print(result['gas']['peak']['year']) # 2061
160
+ print(result['energy']['totals']['net_electricity_mwh']) # approximately 931241.99 MWh
161
+ print(result['climate']['totals']['net_climate_benefit_tco2e']) # approximately 6658873.55 tCO2e
162
+ ```
163
+
164
+ The M14.04 API exposes independent capacity, geometry, inverse sizing, lifts,
165
+ phase/stress tests, Buswell, first-order decay, methane management, energy and
166
+ climate functions plus their integrated gas scenario. Result dictionaries are
167
+ not immutable; treat them as calculation snapshots. Units and assumptions are
168
+ described in `docs/M14_04_LANDFILL_GAS.md`. This is a planning-level model, not a
169
+ permit, geotechnical stability check, plant sizing certification or verified
170
+ carbon inventory. The gas schedule uses planned accepted waste and does not
171
+ truncate intake at the available capacity. The whole-city API is described below.
172
+
173
+ ```cmd
174
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1404_parity.py
175
+ ```
176
+
177
+ This command compares results with the actual local TS source. It checks the
178
+ full nested result objects (including strings, booleans and nulls) plus selected
179
+ invalid input rejections. The older M14.02 and M14.03 checks remain available.
180
+
181
+
182
+ ## Integrated City Scenario (M14.05)
183
+
184
+ ```python
185
+ from dataclasses import replace
186
+ from openenviro import CityScenario, CityEngineeringSettings
187
+
188
+ reference = CityScenario.sakarya_reference()
189
+ results = reference.simulate()
190
+ print(results.population, results.daily_waste)
191
+ print(results.fleet.hcs.required_vehicles) # alternative HCS design
192
+ print(results.compost.facility.total_area_ha)
193
+ print(results.landfill.total_mass)
194
+ if results.gas is not None:
195
+ print(results.gas['peak'])
196
+ print(results.energy['totals']['net_electricity_mwh'])
197
+ print(results.climate['totals']['net_climate_benefit_tco2e'])
198
+ print(results.warnings)
199
+
200
+ circular = replace(reference, id='sakarya-circular', name='Sakarya Circular',
201
+ origin='user-defined', note='Alternative planning scenario',
202
+ projection=replace(reference.projection,
203
+ recycling_fraction=.60,
204
+ compost_fraction_of_residual=.70))
205
+ print(circular.simulate().metrics)
206
+ ```
207
+
208
+ Export a saved city scenario from the web Scenario Manager (not the Results
209
+ JSON from Data Export), then load it using `CityScenario.from_file(path)`.
210
+ Full library backups can be read with `CityScenario.from_library_file(path,
211
+ record_id)` using the **saved record ID**, not the scenario's inner ID. Use
212
+ `Path('scenario.json').write_text(scenario.to_json(), encoding='utf-8')` to
213
+ create an editable scenario compatible with the web importer. `results.to_dict()`
214
+ is a calculated snapshot, not an editable scenario file.
215
+
216
+ Default settings are fixed reference screening assumptions. HCS and SCS are
217
+ alternative estimates for collecting all generated waste; do not add their
218
+ vehicle counts. Transfer uses final landfill feed as a hypothetical haul load.
219
+ Compost uses the reference waste recipe and wood-chip conditioning. Gas assumes
220
+ planned annual accepted waste, not an enforced site-capacity intake cap. Live
221
+ web lab-specific settings are not saved in CityScenario v1. Python settings may
222
+ be changed separately using `dataclasses.replace(CityEngineeringSettings(), ...)`;
223
+ these settings are not included in editable scenario JSON. See
224
+ `docs/M14_05_CITY_SCENARIO.md` for units, failure semantics and examples.
225
+
226
+ ```cmd
227
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1405_parity.py
228
+ ```
229
+
230
+ This check compares actual TypeScript city comparison outputs and independent
231
+ reference engine outputs to the Python integrated scenario. Prior parity checks
232
+ remain available and are required for a fuller model regression.
233
+
234
+ ## Distribution and release checks (M14.08)
235
+
236
+ Version 0.1.0 is a local release candidate; publication to a package index is
237
+ not implied. From the repository root on Windows, copy the unchanged root MIT
238
+ license into the package, install development-only release tools, then build
239
+ and verify the archives:
240
+
241
+ ```cmd
242
+ copy /Y LICENSE packages\python\LICENSE
243
+ packages\python\.venv\Scripts\python.exe -m pip install build twine
244
+ packages\python\.venv\Scripts\python.exe -m build --outdir packages/python/dist/m1408 packages/python
245
+ packages\python\.venv\Scripts\python.exe -m twine check --strict packages/python/dist/m1408/openenviro-0.1.0-py3-none-any.whl packages/python/dist/m1408/openenviro-0.1.0.tar.gz
246
+ packages\python\.venv\Scripts\python.exe packages/python/tools/verify_m1408_release.py
247
+ ```
248
+
249
+ Use a fresh output directory for each build; archive checks require exactly one
250
+ wheel and one source distribution. See `docs/M14_08_PYTHON_RELEASE.md` in the
251
+ repository for the full release procedure. The wheel has no third-party runtime
252
+ dependencies. Notebooks and cross-language tools remain in the source
253
+ repository; they are not part of the wheel.
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "openenviro"
7
+ dynamic = ["version"]
8
+ description = "Environmental engineering simulation SDK for transparent, reproducible planning and education"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = []
12
+ license = "MIT"
13
+ license-files = ["LICENSE"]
14
+ keywords = ["environmental engineering", "solid waste", "landfill", "compost", "simulation"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Operating System :: OS Independent",
23
+ "Topic :: Scientific/Engineering",
24
+ "Typing :: Typed",
25
+ ]
26
+
27
+ [project.urls]
28
+ Repository = "https://github.com/SimplePuddin/openenviro"
29
+ Documentation = "https://github.com/SimplePuddin/openenviro/tree/main/docs"
30
+ Issues = "https://github.com/SimplePuddin/openenviro/issues"
31
+ Homepage = "https://simplepuddin.github.io/openenviro/"
32
+
33
+ [tool.setuptools]
34
+ package-dir = {"" = "src"}
35
+
36
+ [tool.setuptools.packages.find]
37
+ where = ["src"]
38
+ include = ["openenviro*"]
39
+ namespaces = false
40
+
41
+ [tool.setuptools.dynamic]
42
+ version = {attr = "openenviro._version.__version__"}
43
+
44
+ [tool.setuptools.package-data]
45
+ openenviro = ["py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+