Unify CI for pydicom projects #1815
Replies: 9 comments 18 replies
-
I just had a search for these kinds of mypy errors, and it turned indeed out to be only a few items, and the one complaining was mainly myself 😁 : mrbean-bremen commented Dec 19, 2021 Hm, only just noticed that the typing check failed in the last commit - I didn't pay attention as the code had not changed, but mypy has been updated to 0.920 in that run😒 mrbean-bremen commented Dec 29, 2021 Yeah, I did all these changes due to mypy 0.930 in my PR, too. kalebdfischer commented Mar 15, 2022 • Linting failures are not attributable to any change in this PR. mrbean-bremen commented Mar 15, 2022 •
That's true - they are probably due to a new mypy version that fixed another issue. This comes up with every new mypy version, and we just fix it it whateve PR it occurs first. mrbean-bremen commented Apr 30, 2022 Hm, now the mypy check failed again due to a new mypy version... Should be sufficient to fix this with the next PR. kalebdfischer commented Nov 8, 2022 Not sure why mypy is complaining about files that are not changed by this MR - I haven't been able to reproduce locally. mrbean-bremen commented Nov 14, 2022 Those typing errors each time a new mypy version is released get a bit annoying. @darcymason - maybe we pin the mypy version (like we did for the patch release) and update mypy ourselves when needed? Or switch to pre-commit, which will create PRs for updated tools, which can then be adapted to pass. darcymason commented Nov 14, 2022
Sounds good to me. ... which we did afterwards. |
Beta Was this translation helpful? Give feedback.
-
-- @darcymason On this point, the way we handle it in PyMedPhys is we have the PR blocker CI tests run with pinned dependencies, but then we have a separate "updates" test that unpins everything and gives early warning about the issues coming around the corner. This then frees a new contributor to get their small PR merged, even if the updates would have got the PR blocked. And then a maintainer can do a follow-up PR fixing the update failure CI tests. |
Beta Was this translation helpful? Give feedback.
-
Sure, if you like the results. Right now I've been starting with PyMedPhys's workflow, so I'm learning from your team. |
Beta Was this translation helpful? Give feedback.
-
You mean, if the user does not want to use |
Beta Was this translation helpful? Give feedback.
-
I've been looking into all these things and playing with some in the darcymason/egsnrc repo. My thought process / principles for these choices are:
Here are my thoughts on a reasonable set of tools for pydicom (to be validated with real-world experience in pydicom, of course):
So those are the thoughts - any comments welcome. I think these ideas should play well with the other pydicom org libraries too, but I will starting pushing up PRs to pydicom/pydicom in the next couple of days where they can also be seen in action and we can adjust with experience. |
Beta Was this translation helpful? Give feedback.
-
I've been looking into it. I will start with duplication and then get a better solution. I thought to modify sync-with-poetry (probably create our own from it) but have now also discovered pyproject-pre-commit which is itself a pre-commit hook that then calls the linters etc. It doesn't have
Okay, I'll try to remember this so we can circle back to it.
We switched from readthedocs years ago, I'd be reluctant to go back ... unless somehow can just point github pages to it? |
Beta Was this translation helpful? Give feedback.
-
So, on my egsnrc repo where I was testing various things, I now have a pre-commit-ci auto-PR which updated On another note, ruff has updated twice already in a few days (I had my test repo on "daily" check), so we may be getting those almost every week. But with small frequent updates the chance of any differences in someone's PR are likely also very small. |
Beta Was this translation helpful? Give feedback.
-
In continuing news, I have done/am working on:
|
Beta Was this translation helpful? Give feedback.
-
@SimonBiggs, I think my workflow changes are fairly firmed up now, in #1834, if you want to have a look. |
Beta Was this translation helpful? Give feedback.
-
This is a spin-off of a pynetdicom PR, discussing CI in the
pydicom
projects. Here is the discussion so far:mrbean-bremen Jun 19, 2023 •
On a related note, I think it would help to use the same approach for tests/checks for all pydicom core repositories (by that I mean the ones closely related to pydicom, e.g. pydicom itself, pynetdicom, pylibjpeg and the various pylibjpeg plugins, and pyjpegls). I would like to hear what @darcymason thinks on this account - he is currently working on restructuring pydicom for the eventual 3.0 release, and this is something that may also be considered. The tests/checks are currently a bit of a patchwork, created by PRs by different people, and I would like to see a more unified approach for the mentioned repos. Maybe we can create a separate issue in pydicom for this...
sjswerdloff Jun 19, 2023
Ah... One could have a separate group that is for the automated CI/CD, if that level of efficiency is important. More or less same as tests, but cut out the stuff that is for local / development work.
@SimonBiggs has done fantastic work on the automation of pymedphys, and that automation makes maintenance (and being a maintainer) much easier.
darcymason Jun 19, 2023
Agree about the patchwork, and that is why I have been spending the time migrating to pyproject.toml-based config (clearly the future now) and trying to do so in a build-backend-independent way as much as possible. As mentioned in another issue somewhere, I've tried poetry several times over the years and never really got it. And I get the impression that a lot of its functionality has now been moved into pyproject.toml ways that are compatible with other tools. All the build tools are competing now and this space will be a bit messy for a while.
As to running locally, there is act which actually picks up the github actions workflows. I looked at it (or something similar) in the past but I think it didn't have Windows support previously. In any case, it appeals to me because it would be nice to just directly run the github actions. I intend to give it a try soon.
And to continue to be a bit contrarian 😉 I prefer not pinning versions of tools, I'd rather see the error come up and try to deal with it. I recently got over the pydicom mypy pinning - while refactoring anyway, I couldn't remember exactly why it had been pinned, and thought it better to fix up a bunch of problems with the current version, rather than some previous version and then later try to upgrade versions.
In any case, I think act (or similar tool) is likely a permanent solution for CI vs local, if it works.
mrbean-bremen mrbean-bremen Jun 19, 2023
Yes, using pyproject.toml is now the way to go, though that leaves the question of which tools to use open. I had a try at poetry several years ago and IIRC it didn't impress me, but I guess this has improved together with the whole packaging metaverse. I'm fairly agnostic concerning the used tools, I just want to have some consistence for ease of maintenance. This includes the "meta tools" like poetry, and the actual linters like flake8 etc - would be good to have a single approach. Also, we currently have both command line tools, and GH integrations via annotations, and I tend to get confused with all the different linters.
The reason was that the build usually failed in some random PR after a mypy update, and every time this happened it created some back-and-forth with the PR creator as to how to handle these errors, which are completely unrelated to the PR. Also, this used to happen in several PRs at once, so we had to decide, in which one it had to be fixed.
As I wrote, I would like to have both: a pinned version for the PRs, so that the creator of the PR can concentrate on their own changes, and an unpinned version which shows the errors, but does not fail the build. As I understood, pymedphys does something like this, though I may have got that wrong.
Independently of what I wrote before, this sounds like a good thing. It also seems to work under Windows now (using Docker Desktop). Pre-commit is also an option - I use it in another repo, though that runs only for the current OS (in an isolated environment).
darcymason darcymason Jun 19, 2023
Of note on the latter, I was really impressed with ruff now that switching to it was contributed in pydicom. Super-fast, and covers everything, including (as in my last PR) upgrading for Python version changes. Mind you, it still uses all the flags from the previous linters, so some of the issues might still follow.
That is a good point. Hopefully quite rare, but I do remember that happening. I'm on the fence as to whether it is worth the extra complication of having different versions in different workflows, vs. the occasional problem like that coming up. Related point, I found it confusing doing the pydicom workflow changes recently, that the same thing is repeated over in several different jobs, in different workflow files. I'd like to minimize that kind of duplication.
CC @darcymason @sjswerdloff @SimonBiggs
Beta Was this translation helpful? Give feedback.
All reactions