mxcube / mxcubecore

Backend used by MXCuBE
http://mxcube.github.io/mxcube/
GNU Lesser General Public License v3.0
11 stars 52 forks source link

Package Management, Linting / Code Quality and GitHub Actions Improvements #715

Closed oldfielj-ansto closed 1 year ago

oldfielj-ansto commented 1 year ago

This PR makes changes in several places, none of which impact the overall functionality of the MXCuBE Core package. These changes aren't meant to be merged in their current state, rather they are intended to start a discussion around package management tools, linting/code quality tools and package distribution.

Summary of Changes:

oldfielj-ansto commented 1 year ago

The "Linting & Code Quality" action fails here due to the aforementioned Pre-Commit settings for Black, etc.

The "Coverage Report" action fails due to the repository GitHub action permissions as they are currently configured, this can be rectified without changing those settings by generating and providing the action with a new token that has sufficient permissions to comment on a PR.

An example of the what the "Coverage Report" action comment looks like can be found here. https://github.com/AustralianSynchrotron/mxcubecore/pull/3#issuecomment-1266292792

marcus-oscarsson commented 1 year ago

Thanks a lot @oldfielj-ansto for this very nice PR, It is very much appreciated :+1:

marcus-oscarsson commented 1 year ago

I like the idea of trying out Poetry, I did actually consider it when we introduced bump2version but did not have the time to investigate it enough. It seems to me to provide a more complete solution over setup.py, I like the overview the pyproject.toml gives and that it handles virtual environments (basically a must when working with Python)

Over all it looks like a good update of our current routines, I suspect that we might need to discuss what to do with the Flake8 warnings/errors. I think we should try to get as much of this as possible in place, perhaps excluding Flake8 to start with. Then come up with a plan on how to perform the necessary changes for Flake8, if we think it will bring us some additional value.

rhfogh commented 1 year ago

It is very good that someone is doing this. It will be painful to incorporate, but then taking your medicine always is.

Could I propose that someone runs the full black/flake8 on a separate branch and makes the linted branch and the linter report available to all of us? We could then look at the kind of changes that would await us, digest it, and then discuss what checks we might want to disable (if any, of course).

marcus-oscarsson commented 1 year ago

Looks great :) thanks !

marcus-oscarsson commented 1 year ago

Ill go a head and merge this, there might be some adjustments later on but it puts a lot of good things in place.

oldfielj-ansto commented 1 year ago

@marcus-oscarsson Cool OK, I'll need to raise another PR to fix an issue I've been troubleshooting with Python3.11.

Seems that the "gipc" package is failing to install as it is not yet compatible with the latest release of Gevent. Since it looks like this package is only used by sites requiring the "TangoLimaVideo" and "TangoLimaVideoLoopback" hardware objects, I should be able to lock it to Python3.10 and below, allowing sites not using these hardware objects to start experimenting with Python3.11.

I've also been playing around with the code quality / linting tool configs and have gotten the number of automatic refactors down to 112, which I think is a more manageable starting point than the 800+ we started with in this PR.

Just working on adjusting the Flake8 configuration to document what the warning being disabled are, and muting some of the more nuisance spam warnings.

marcus-oscarsson commented 1 year ago

@oldfielj-ansto. Ok I see. I had the same problem and simply pinned gevent to "21.12.0" which I think should work fine as well.

We will tune these things a bit as we go, I guess its the easiest way. Sounds great for the linting, 112 errors sounds manageable :),