Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with python 3.8 and 3.9 #245

Merged

Conversation

raphaeljolivet
Copy link

This is a fix for #244

It's basically changing : type | type2 to Union[type, type2]

Please consider using Tox to ensure broad compatibility with several version of Python.

@cmutel
Copy link
Member

cmutel commented Feb 20, 2024

@raphaeljolivet Thanks!

Can you give us an indication of why 3.8 compatibility is needed? It is EOL in 2024, and even if we add compatibility, it would limit us to dependencies which are also 3.8 compatible.

I don't remember the details but some of the CI workflows also broke for 3.8 (though maybe this was for another component library). Normally we don't need tox (and everything that comes with it) if the CI tests multiple versions and OSes, right?

@raphaeljolivet
Copy link
Author

The compatilibity to Python 3.8 could be optional indeed.
I guess the support for 3.9 should be mandatory.
I have not looked in detail your CI scripts, but it seem they did not catch this error on 3.9 at least.

I am in the process of releasing a new version of lca_algebraic.

I have updated to Brightway 2.45 (maybe later to brightway25) : And I have setup sone tests on tox.
I ran from 3.8 to 3.11 : It failed for 3.8 and 3.9.

It installed without error on python3.8 and python3.9 but failed at runtime.

To me a library should not install if it fails at runtime :
It needs to declare the minimal version of Python it requires (mines doesn't do it either yet, I am still learning those things and trying to get it clean).

For 3.8, while looking at it, I found that it only required a couple of change to install and run smoothly, and I thought it was a pitty to not support it : But indeed I don't have the full picture. If maintaining 3.8 is a burden for the dependencies, you could drop its support and advertise the min python version in the manifest of the library.

@raphaeljolivet
Copy link
Author

And thanks for your work btw :)

@cmutel
Copy link
Member

cmutel commented Feb 21, 2024

@raphaeljolivet right back at you :)


import bw2data as bd
import ecoinvent_interface as ei
from charset_normalizer.md import List
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

@@ -62,11 +63,11 @@ def pick_a_unit_label_already(obj: dict) -> str:
def import_ecoinvent_release(
version: str,
system_model: str,
username: str | None = None,
password: str | None = None,
username: Union[str, None] = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this, and future instances of this pattern, to use Optional instead.

@cmutel
Copy link
Member

cmutel commented Feb 21, 2024

While you're at it, can you update setup.py to require Python 3.8 and higher?

@cmutel cmutel merged commit f4666ef into brightway-lca:bw2legacy Feb 22, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants