Migrate morango to uv for package management#296
Migrate morango to uv for package management#296rtibbles merged 3 commits intolearningequality:release-v0.9.xfrom
Conversation
8983157 to
90953b5
Compare
marcellamaki
left a comment
There was a problem hiding this comment.
I have added some questions, which I think reflect more about my non-understanding of morango and python version management than anything about uv in particular 😂 thank you for bearing with be @bjester
| github_token: ${{ github.token }} | ||
| paths: '["morango/migrations/*.py", ".github/workflows/check_migrations_sqlite.yml", "setup.py", "requirements/*.txt"]' | ||
| paths: '["morango/migrations/*.py", ".github/workflows/check_migrations_sqlite.yml", "pyproject.toml"]' | ||
| build: |
There was a problem hiding this comment.
just want to see if i'm understanding this well from the reviewer guidance. so this part is new because it gives us more similarity (and.... therefore increased confidence?) to the build process for morango releases?
There was a problem hiding this comment.
Yeah this is the result of the complexity in that with older versions of python, we can't simply use pip install . for Morango having the more modern pyproject.toml. It needs more modern build tools that don't support older versions of python.
Morango's build and publish always uses python 3.9, so this mimics that to create a wheel file which CAN be installed later (line 88):
pip install $(ls dist/*.whl | head -n 1)[test]
$(ls dist/*.whl | head -n 1)this is just a subshell to use globbing sincepipwants a full file name[test]this tells pip to install thetestextras defined in thepyproject.toml
So the result is that this is indeed more realistic tests by testing the wheel that we'd publish (built on 3.9) instead of building a wheel within each python version being tested.
There was a problem hiding this comment.
Interesting - this might make doing a parallel version in Kolibri slightly more challenging, because there we build the whl file in Python 3.6 to bundle the dependencies (I am sure we'll find a work around, but this is good extra context).
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| - name: Download wheel artifact |
There was a problem hiding this comment.
and here, it uses that whl to help with the python version management that you were describing
There was a problem hiding this comment.
Yeah this copies that wheel file artifact to make it available to this step.
|
|
||
| To start contributing to Morango, first make sure you [have `uv` installed](https://docs.astral.sh/uv/getting-started/installation/). | ||
|
|
||
| Create a virtual environment, with at least python 3.9: |
There was a problem hiding this comment.
Yeah is this confusing? Perhaps it should just use 3.9. This is the minimum for build tools
There was a problem hiding this comment.
I think the "at least 3.9" and then having it use 3.10 is what confused me. if using 3.10 is better, maybe just adding a little bit of extra detail to the comment about why that's preferable (but confirming that 3.9 still works)? that said, i definitely am not someone who has a lot of context here, so this might be much more apparent to you and others (prathamesh, richard) who are working with morango more consistently. it's definitely not a blocker, just a thought
There was a problem hiding this comment.
Yeah I think I should update to say 3.10. Python 3.9 is technically EOL already!
| maintainers = [{name = "Learning Equality", email = "dev@learningequality.org"}] | ||
| readme = "README.md" | ||
| license-files = ["LICENSE"] | ||
| requires-python = ">=3.6,<3.15" |
There was a problem hiding this comment.
so we are still supporting those versions, we are just using 3.10 as the default now?
There was a problem hiding this comment.
The build tools require at least 3.9, which is what we used to build and publish the wheel before these changes. So yes the installation still supports these versions, just that development needs newer versions.
rtibbles
left a comment
There was a problem hiding this comment.
Code changes make sense - I did some spot checks on the different CI jobs, and all the tests seemed to be running with the correct packages installed and on the right Python versions, so all the changes seemed to have successfully maintained what is required!
| github_token: ${{ github.token }} | ||
| paths: '["morango/migrations/*.py", ".github/workflows/check_migrations_sqlite.yml", "setup.py", "requirements/*.txt"]' | ||
| paths: '["morango/migrations/*.py", ".github/workflows/check_migrations_sqlite.yml", "pyproject.toml"]' | ||
| build: |
There was a problem hiding this comment.
Interesting - this might make doing a parallel version in Kolibri slightly more challenging, because there we build the whl file in Python 3.6 to bundle the dependencies (I am sure we'll find a work around, but this is good extra context).
| migration_test: | ||
| name: SQLite migration tests | ||
| needs: pre_job | ||
| needs: [pre_job, build] |
There was a problem hiding this comment.
I don't think it's a concern in morango - but once concern I've had in Kolibri is that our workflows are overly granular.
I've experimented with having more top level "CI" in some repos recently - so that our CI checks become more of a cascade (make sure it builds first, then test kind of thing).
With no good way in Github Actions to group workflows better, I am tempted to do more of this - but morango doesn't have enough for this to be a concern!
| [project] | ||
| name = "morango" | ||
| dynamic = ["version"] | ||
| description = "Pure Python sqlite-based Django DB replication engine." |
There was a problem hiding this comment.
Is it SQLite based? :)
(I know this is copied, but just funny given how much work we've done to make sure it works on postgres too!)
Summary
project.tomlformatproject.tomlsetuptools-scmwhich uses repository tags for versioninguvfor dependency management and buildsuvto set up pythonuv buildto generate the distribution files--installpkgwith pre-built wheel fortoxto avoid having it build Morango itself, and the issues that causes with EOL versions of pythonuvprekinstead ofpre-commitTODO
Reviewer guidance
AI usage
Local AI was used to do the initial migration. Claude was used to verify the approach, and make some corrections. Finally, manual trial and error were needed to fix what AI could not.