fjuniorr / flowmapper

Mappings between elementary flows
MIT License
0 stars 1 forks source link

Consider dropping support for python 3.9 to allow use of bw2io #52

Closed fjuniorr closed 6 months ago

fjuniorr commented 6 months ago

For https://github.com/fjuniorr/flowmapper/pull/51 I've used bw2io.units.normalize_units and bw2io.units.DEFAULT_UNITS_CONVERSION instead of bringing the lists to flowmapper to lessen future maintenance costs.

However bw2io uses union types as X | Y which is only Python 3.10+ explaining the failing tests for 3.9 in CI:

ImportError while loading conftest '/home/runner/work/flowmapper/flowmapper/tests/conftest.py'.
tests/conftest.py:5: in <module>
    from flowmapper.flow import Flow
flowmapper/flow.py:5: in <module>
    from .unit import Unit
flowmapper/unit.py:5: in <module>
    from bw2io.units import normalize_units, DEFAULT_UNITS_CONVERSION
/opt/hostedtoolcache/Python/3.9.1[8](https://github.com/fjuniorr/flowmapper/actions/runs/7141508150/job/19448908870#step:6:9)/x64/lib/python3.[9](https://github.com/fjuniorr/flowmapper/actions/runs/7141508150/job/19448908870#step:6:10)/site-packages/bw2io/__init__.py:76: in <module>
    from .importers import (
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/bw2io/importers/__init__.py:2: in <module>
    from .ecoinvent_lcia import EcoinventLCIAImporter
/opt/hostedtoolcache/Python/3.9.[18](https://github.com/fjuniorr/flowmapper/actions/runs/7141508150/job/19448908870#step:6:19)/x64/lib/python3.9/site-packages/bw2io/importers/ecoinvent_lcia.py:[19](https://github.com/fjuniorr/flowmapper/actions/runs/7141508150/job/19448908870#step:6:20): in <module>
    class EcoinventLCIAImporter(LCIAImporter):
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/bw2io/importers/ecoinvent_lcia.py:25: in EcoinventLCIAImporter
    def __init__(self, biosphere_database: str | None = None):
E   TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Error: Process completed with exit code 4.
cmutel commented 6 months ago

Suggest to close in light of #55. bw2io should not be a dependency.