-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Simplify migrations #1510
Simplify migrations #1510
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the initiative and working on this long-standing feature proposal, @AdrianFreundQC! 🙏
I've done a first review iteration over the main code and docs (not the tests yet). It looks great, just a couple of minor comments so far.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1510 +/- ##
==========================================
- Coverage 97.39% 97.38% -0.02%
==========================================
Files 48 49 +1
Lines 4728 5004 +276
==========================================
+ Hits 4605 4873 +268
- Misses 123 131 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
f62dbf5
to
aa1c40b
Compare
I pushed the fixes as new commits to simplify review. |
CI failure looks unrelated. Should be fixed with a re-run |
One more thought I had: the migration command running twice on every update might be confusing and unexpected for new users, however it is required for more complex migrations. Changing the default value for |
I like this idea, it sounds like a better default behavior than running the command twice. 👌 By the way, I haven't forgotten about reviewing this PR, just haven't had enough time yet. 🙁 I'll try to do it on Monday. 🤞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done a full review this time. The implementation looks good to me. The legacy format test does not ensure identical behavior as before anymore, and I think the new format needs a bit more systematic testing (because it's more powerful/flexible). I think keeping the legacy tests unchanged and adapting and extending a copy thereof for the new format would be better than surgically adding some testing of the new format and mixing it with the legacy format (see my inline comment for more details).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely looks like the path forward. Thanks for taking care of all this!
Sorry for the delay. I've been quite busy recently. |
Thanks for the update and your continuous work on this PR, @AdrianFreundQC! 🙏 |
22d1ce4
to
7d5c7be
Compare
131b22c
to
9d31db2
Compare
I have no idea why the MacOS flake test is suddenly failing now. Maybe a broken cache?
The flake check runs fine on my machine. Also all the other tests work now. If you want you can already review the new tests. I'll go through all the discussions again and see if there's anything else I still have to do. |
@AdrianFreundQC Sorry for the inconvenience. It's because We're waiting for @yajo to resolve #1604 (because of a project-level settings change only he can make). Then, after rebasing your PR, CI checks should work again. |
One sec, your Python 3.8 and 3.9 CI checks are passing. 🤔 It seems GitHub has added those missing binaries. Let me get back to you. |
de08c15
to
4756477
Compare
I think all discussions should have been addressed now and the CI seems to be working (assuming my last change didn't break anything). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very amazing work, Thanks!
There's just one minor suggestion to enhance docs. Would you like to push it before merging?
4756477
to
e31c826
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @AdrianFreundQC! 👌 Just some totally minor remarks from my side. Plus in general, some lines seem very long. Would you mind running Ruff's formatter once?
About code formatting: IIRC, there is no Nix-based pre-commit hook for Ruff's formatter, which would explain why the flake-check
checks pass although I'm sure Ruff's formatter would disagree. @yajo Is there a way to enable Ruff's formatter to check code formatting? And does the Nix-locked version of Ruff even have the formatter already? We might need to update the lock file.
0713185
to
1dd1228
Compare
I ran addressed the two comments above and ran I also rebased on master again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. 🫣
Content-wise it looks good to me. I still see some minor formatting issues. Would you mind trying to fix them?
1dd1228
to
ff188ff
Compare
ff188ff
to
d80c011
Compare
No problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now! 🎉 Thank you very much for the hard work, implementing this great feature with proper tests, and patience with the reviews even on pedantic formatting fixes! 🙏 Fantastic job! 🥇 Let's get this merged! 🚀
Do you have an ETA on when the next version might get released? |
I'd like to at least have #1598 fixed before release. It appeared because of this merge IIRC. It should be quite easy to fix though, I just had very little time lately. Once that one's fixed I'll push the new release. Would you want to contribute it? |
Ah, nevermind. I just opened #1681. It was an easy one. |
Resolves #326
Here is a suggestion for how to simplify migrations. Some changes made to migrations were also applied to tasks for consistency.
The task configuration is 100% backwards compatible. The migration configuration is not backwards compatible. The old style should be seen as deprecated. This PR support both old and new style and shows a warning when the old style is used.
Tasks
Tasks can still be configured like before:
Additionally Tasks can be a dictionary, which allows passing one or more of the optional arguments
when
andworking_directory
.working_directory
defaults to the destination directory and can be either relative to it, or absolute. Both arguments can be templated.Migrations
It is no longer necessary to duplicate the same command line for every version to run a migration script.
This runs twice (before and after) on every update and still passes environment variables to the script.
Note that it can't pass
$VERSION_(PEP440_)CURRENT
because there is no current version. Only a from and to version.It is still possible to only run migrations on a specific version:
In this case
$VERSION_(PEP440_)CURRENT
is still passed to the command.This still runs both before and after.
working_directory
andwhen
are also supported for migrations. In addition all the environment variables passed to the command are also available for use in templating:Current State
All the features described here work.
I still want to do a bit of code cleanup and improve the documentation in the next few days.
I would also like some feedback on this design. Is there anything you don't agree with? Something I should change?