Crappy 2.0.0 is out ! #82
WeisLeDocto
announced in
Announcements
Replies: 1 comment
-
Amazing work @WeisLeDocto and @PIERROOOTT ! I am happy to see that not only Crappy was actively maintained after i stopped working on it, but it kept evolving to become a much more accomplished project. I hope that the LaMcube and many other users will benefit from this powerful toolbox ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there !
I'm glad to announce that the version 2.0.0 of Crappy was just released earlier this week !
It represents almost one year's worth of work, and brings major backwards-incompatible changes to the module at many levels.
This post describes the rationale of the update from version 1.5 to 2.0, and lists the most notable changes to Crappy in the new version. Guidelines for updating your code from version 1.5 to 2.0 are also given, and in the last section I give a few words about the short- and long-term perspectives of the project.
But first, I'd like to thank @PIERROOOTT who's been actively contributing to the project for a few months already !
Don't hesitate to provide any feedback on version 2.0.0, either by replying to this Discussion or creating a new Issue if you spot anything wrong.
Why a version 2.0.0 now ?
When @Dad0u stopped maintaining Crappy a bit more than a year ago, I became de facto the new maintainer. In my opinion, the project at that time suffered several major flaws:
All my efforts during the past year were directed towards improving the module on these points. On each of these aspects there is currently still room for improvement, but much has already been done. I will certainly keep working on Crappy until I'm fully satisfied, probably somewhere around version 2.2-2.3. Hopefully, the next maintainer -if there's any- will inherit a clean, stable, well-structured, and well-documented project.
What are the main changes ?
In line with the avenues of improvement listed above, here is a condensed list of the main changes brought to Crappy as a Python module and as a project in version 2.0.0. For a more detailed change list you can refer to the release post, and you'll get the full picture by looking directly at the changelogs. The main changes, in no specific order, are:
Camera
Block and of theDisplayer
Block by a single newCamera
Block that handles the acquisition, processing, display, and recording of the images. All these operations are now parallelized, when they were previously performed sequentially, therefore leading to a significant increase in performance.Block
, making full use of the possibilities offered by themultiprocessing
module, that drastically improved the stability at runtime. The most notable enhancement is visible when a script finishes, either due to an exception or because of a CTRL+C interruption. The termination of scripts used to be particularly unstable, it is now most of the time very smooth.print
function were replaced by a proper logging mechanism. It provides a much richer feedback, both in the console and in a log file, and users are free to tune the logging level for each Block independently.Generator Path
objects. That was previously not possible.setup.py
,requirements.txt
, etc.) and the configuration files for the documentation (.readthedocs.yml
,docs/source/conf.py
, etc.) were updated to the recent standards for their respective formats.StopBlock
andStopButton
Block. Otherwise, Crappy will (by default) raise an exception when returning, even if the termination went smoothly.examples/
folder of the project was totally refactored, and now features a much richer collection of example scripts. Each script is heavily commented, and most scripts can now run locally without requiring hardware (using fake hardware classes instead).How to upgrade your code from version 1.5 to 2.0 ?
As stated above, many changes from version 1.5.11 to 2.0.0 are backwards-incompatible ! In the general case, code running fine with version 1.5.11 will not run on version 2.0.0. Changes of that magnitude should definitely have been better advertised in the previous releases, and I apologize if some users have a hard time upgrading their code. The reasons why there were so few announcements about the big changes of version 2.0.0 are: a lack of perspective on my work, the scale of the changes, and my little experience as a maintainer. The future improvements will be handled in a much smoother way !
In practice, the first thing you should do before upgrading to version 2.0.0 is to first upgrade to 1.5.11 (
python -m pip install --upgrade crappy==1.5.11
). When running your code, you should seeFutureWarning
s signaling the classes and methods that were renamed in version 2.0.0. If you run your old code in version 2.0.0, it will also raise ad hoc exceptions signaling deprecated names and the replacement ones to use. Such exceptions were not implemented for the names of the arguments to pass, so you'll need to check the API section of the documentation to see if the old argument names are still valid. This should be clearly indicated (e.g. "Changed in version 1.5.10: renamed P argument to gain"). In most cases, upgrading your code will simply be a matter of correcting a few names.If your code uses the
Camera
Block, or if you defined your own Blocks, then the upgrade will be a bit more painful. I cannot give clear guidelines that would fit every situation, so my best advice in that case would be to get familiar with the new API for theBlock
andCamera
Block objects. The tutorials about creating custom Blocks, using the Camera Block, and creating custom Camera Blocks can surely be of great help to you. These steps are a bit of a pain, but the upgrade is totally worth the trouble !What's next ?
As I mentioned earlier, I consider the few goals that I set for Crappy to only be partially met with version 2.0.0. Therefore, I still have quite some work up ahead for the coming months. You can now get an overview of the planned changes in the Projects section on GitHub. In broad outline, these changes will include:
Block
,InOut
,Modifier
, etc.), because implementing such test for code driving hardware is not realistically feasible. Note that thetests/
folder of the project already contains a draft version of it.Camera
Block, able to direct streams arbitrarily between the different processes (acquisition, recording, display, processing) and to perform several processing tasks at once (see Create a more flexible Camera Block #61).crappy
(probably something likecrappy.collection
, on the same model asmatplotlib.pyplot
). The goal is to keep incrappy
only the core of the module, and a few hardware classes that will be actively maintained and promoted. On the other hand,crappy.collection
will be a collection of hardware classes, with less support from Crappy's maintainer(s). It is IMO a nice solution to keep extending the hardware library of Crappy, while keeping the core of the project reasonably small.Beta Was this translation helpful? Give feedback.
All reactions