Doesn't work in python 3.10

Open Beginner friendly
#986 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
api

Research direction

Start with simvue/eco/emissions_monitor.py, at the CO2Monitor definition shown in the traceback, and reproduce the import failure under Python 3.10. Check the project's existing tests or test setup for supported Python versions. Done means the Python API imports and runs correctly on Python 3.10 without breaking newer supported versions.

Written by the indexing model from the issue text.

Description

bug

Description of Bug

Python API crashes on python 3.10, since it uses timezone.UTC, which is an alias that was only introduced in 3.11.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Try running it on 3.10

Expected behavior

Runs correctly

Actual Behaviour

    from simvue.config.user import SimvueConfiguration
../../../Library/Caches/pypoetry/virtualenvs/simvue-moose-SyxDCI6N-py3.10/lib/python3.10/site-packages/simvue/config/user.py:39: in <module>
    from simvue.eco.config import EcoConfig
../../../Library/Caches/pypoetry/virtualenvs/simvue-moose-SyxDCI6N-py3.10/lib/python3.10/site-packages/simvue/eco/__init__.py:11: in <module>
    from .emissions_monitor import CO2Monitor as CO2Monitor
../../../Library/Caches/pypoetry/virtualenvs/simvue-moose-SyxDCI6N-py3.10/lib/python3.10/site-packages/simvue/eco/emissions_monitor.py:41: in <module>
    class CO2Monitor(pydantic.BaseModel):
../../../Library/Caches/pypoetry/virtualenvs/simvue-moose-SyxDCI6N-py3.10/lib/python3.10/site-packages/simvue/eco/emissions_monitor.py:82: in CO2Monitor
    _last_local_write = pydantic.PrivateAttr(datetime.datetime.now(tz=datetime.UTC))
E   AttributeError: module 'datetime' has no attribute 'UTC'
Dominant language
Python
Stars
4
Forks
1
Avg merge
5d 8h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from simvue-io/python-api

All issues in simvue-io/python-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.