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

Upgrade Python to v3.9 and Poetry to 1.8 #1986

Merged
merged 16 commits into from
Oct 14, 2024
Merged

Upgrade Python to v3.9 and Poetry to 1.8 #1986

merged 16 commits into from
Oct 14, 2024

Conversation

jonahkagan
Copy link
Contributor

@jonahkagan jonahkagan commented Oct 14, 2024

Closes #1962
Closes #1872

Upgrades Python from 3.8 to 3.9, dealing with various impacts along the way. I also upgraded Poetry to the latest version, since there were build issues involving Poetry that were blocking deploys.

The latest version I could get using apt in my Ubuntu 20 VM was 3.9.5. Heroku and CircleCI needed the latest 3.9 version, which is 3.9.20. This shouldn't cause problems, but you may see that version discrepancy in the diff.

Tested by ensuring that:

  • Automated type checking, lint, and tests pass in CI
  • Can successfully deploy and access a review app in Heroku

@@ -28,7 +29,7 @@ consistent-sampler = {git = "https://github.com/votingworks/consistent_sampler.g
scipy = "~1.6.0"
Flask-SeaSurf = "^0.3.0"
boto3 = "^1.20.8"
r2b2 = {git = "https://github.com/gwexploratoryaudits/r2b2", rev = "128874b"}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pinning this commit broke for some reason, but there's only one commit after it on main in this repo, it isn't actively worked on, and it's only used for some experimental math that we don't use in real audits, so it seemed like a low risk workaround

@@ -3,7 +3,7 @@
"buildpacks": [
{ "url": "heroku/nodejs" },
{
"url": "https://github.com/moneymeets/python-poetry-buildpack.git#0bbaf48423f0caac527e185b1517abac1610dc46"
"url": "https://github.com/moneymeets/python-poetry-buildpack.git"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #1871

@@ -7,7 +7,7 @@ orbs:
executors:
arlo:
docker:
- image: cimg/python:3.9.5-browsers
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This image had an old version of poetry, which didn't work for us since we upgraded the dev env to use the latest poetry

@@ -32,6 +32,9 @@ boto3 = "^1.20.8"
r2b2 = {git = "https://github.com/gwexploratoryaudits/r2b2.git"}
MarkupSafe = "==2.0.1" # Related to this problem: https://stackoverflow.com/questions/72191560/importerror-cannot-import-name-soft-unicode-from-markupsafe
urllib3 = ">=1.26,<2" # https://github.com/python-poetry/poetry-plugin-export/issues/239
jinja2 = "3.0.3" # Flask breaks with later versions of Jinja2
itsdangerous = "2.0.1" # Flask breaks with later versions of itsdangerous
werkzeug = "2.0.3" # Flask breaks with later versions of Werkzeug
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should probably update Flask, but that felt like a bigger change

@@ -60,85 +60,14 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A bunch of these rules got deprecated from pylint. I think they had to do with the Python 2 -> 3 transition

They weren't working due to some logging output. I couldn't get to the
bottom of it. These are in experimental code that we don't use in real
audits, so I'm not worried about it.
Cypress is using Node 20, which breaks an smtp dependency of the old maildev package
Somehow the cache got stuck, need to clear it
@jonahkagan jonahkagan merged commit a8065f3 into main Oct 14, 2024
5 checks passed
@jonahkagan jonahkagan deleted the upgrade-python-3.9 branch October 14, 2024 23:30
umbernhard added a commit to umbernhard/arlo that referenced this pull request Oct 22, 2024
* Upgrade Python to v3.9 and Poetry to 1.8 (votingworks#1986)

* Fix build by adding branch reference for consistent_sampler (votingworks#1987)

The poetry export command was failing. I did some debugging of the
poetry code and this seemed to fix it - seems like a bug on their end.

* Improve Batch Comparison Audit Report  (votingworks#1988)

* add ballots in batch to batch audit report results

* update snapshots

* add more data points to rounds rows in batch audit report

* update snapshots from rounds csv changes

* update header titles

* update snapshots

* address other pr comments

* Add extra lines to tally sheey (votingworks#1989)

* Add blank lines to tally sheets

* Commit snapshots

* chore: re-sync `.node-version` file (votingworks#1991)

It says it wants NodeJS v12, but we install NodeJS v16. This sets the version to the latest v16.

* Update batch comparison audit reports to better handle extra batches (votingworks#1992)

* update rounds data in audit report to ignore extra batches

* update tests

* add totals row to end of batch section in audit report

* update snapshots

* fix typo

* Ensure git hooks are setup (votingworks#1996)

You have to run `husky install` for the git pre-commit hook to work.
Following their docs, I added a `prepare` script to package.json. To
make sure that script runs when setting up a new dev env, I also added
it to the Makefile.

* Run poetry lock (votingworks#1997)

* Improve tally sheet page break for tables (votingworks#1994)

* Improve page break behavior for tables on batch tally sheets

* Improve logic for determining cell size + improve comments

* Update outdated snapshots (votingworks#1999)

* Bump cache version (votingworks#2002)

* Bump cache version

* Bump the right cache

* Bump cache (votingworks#2003)

---------

Co-authored-by: Jonah Kagan <[email protected]>
Co-authored-by: carolinemodic <[email protected]>
Co-authored-by: Nikhil Bhatia <[email protected]>
Co-authored-by: Brian Donovan <[email protected]>
Co-authored-by: Nikhil Bhatia <[email protected]>
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.

Upgrade Python Upgrade Poetry and remove buildpack stopgap
2 participants