Skip to content

Compile requirements and run tests with Python 3.10 #7886

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

Closed
wants to merge 4 commits into from

Conversation

pdelboca
Copy link
Member

@pdelboca pdelboca commented Nov 1, 2023

Our current requirements were compiled using Python 3.8.

This is causing incompatibility with Python 3.10 since the compile process introduces backports.zoneinfo as a dependency. backports.zoneinfo does not run under Python 3.10 (https://stackoverflow.com/a/72796492)

I'm re-compiling the file and also updating our CD/CI files to run tests under Python 3.10

@pdelboca pdelboca changed the title Compile requirements with Python 3.10 Compile requirements and run tests with Python 3.10 Nov 1, 2023
@wardi
Copy link
Contributor

wardi commented Nov 2, 2023

related to #6613

@amercader
Copy link
Member

Just checked and pip-compile (pip-tools version 7.3.0) will keep the python_version modifier, so we can modify requirements.in to add backports.zoneinfo; python_version < "3.9" and it will be kept in the requirements.txt file:

diff --git a/requirements.in b/requirements.in
index 7cf91a137..eeab11ded 100644
--- a/requirements.in
+++ b/requirements.in
@@ -2,6 +2,7 @@
 # Use pip-compile to create a requirements.txt file from this
 alembic==1.12.0
 Babel==2.12.1
+backports-zoneinfo==0.2.1; python_version < '3.9'
 Beaker==1.12.1
 bleach==6.0.0
 blinker==1.6.2
diff --git a/requirements.txt b/requirements.txt
index d913217cf..b08da3d04 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,8 +10,10 @@ babel==2.12.1
     # via
     #   -r requirements.in
     #   flask-babel
-backports-zoneinfo==0.2.1
-    # via tzlocal
+backports-zoneinfo==0.2.1 ; python_version < "3.9"
+    # via
+    #   -r requirements.in
+    #   tzlocal
 beaker==1.12.1
     # via -r requirements.in
 bleach==6.0.0

@amercader
Copy link
Member

My apologies, I don't know how I tested this but I obviously didn't do a great job, as pip-compile won't pass over environment markers from requirements.in to requirements.txt.

For now I'll add them manually to requirements.txt to reflect the changes needed in #7935 but we need to keep investigating a sustainable way of managing this

@pdelboca
Copy link
Member Author

Closing as implemented a consolidated approach in #7936

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.

3 participants