From 89295edddcc7da7be50682a19a1667852e1e7eed Mon Sep 17 00:00:00 2001 From: Antoine Weisrock Date: Sun, 3 Dec 2023 16:58:31 +0100 Subject: [PATCH 1/3] refactor: add a check for detecting deprecated Modifier using evaluate() --- src/crappy/modifier/_deprecated.py | 2 ++ src/crappy/modifier/meta_modifier/meta_modifier.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/crappy/modifier/_deprecated.py b/src/crappy/modifier/_deprecated.py index b3e41594..34af9636 100644 --- a/src/crappy/modifier/_deprecated.py +++ b/src/crappy/modifier/_deprecated.py @@ -2,6 +2,8 @@ from .meta_modifier import Modifier +# Do not forget to revert changes in MetaModifier + class Moving_avg(Modifier): """Empty class for signaling an object of version 1.5 whose name changed in diff --git a/src/crappy/modifier/meta_modifier/meta_modifier.py b/src/crappy/modifier/meta_modifier/meta_modifier.py index dc6677f4..e7c596ca 100644 --- a/src/crappy/modifier/meta_modifier/meta_modifier.py +++ b/src/crappy/modifier/meta_modifier/meta_modifier.py @@ -15,6 +15,11 @@ def __new__(mcs, name: str, bases: tuple, dct: dict) -> type: def __init__(cls, name: str, bases: tuple, dct: dict) -> None: super().__init__(name, bases, dct) + if hasattr(cls, 'evaluate'): + raise DefinitionError("The evaluate method is deprecated for Modifiers " + "since version 2.0.0, just rename it to __call__ " + "to get your Modifier working again.") + # Checking that a Modifier with the same name doesn't already exist if name in cls.classes: raise DefinitionError(f"The {name} class is already defined !") From 96ed205581cafb674e453ffc58776a273b73db07 Mon Sep 17 00:00:00 2001 From: Antoine Weisrock Date: Sun, 3 Dec 2023 17:23:21 +0100 Subject: [PATCH 2/3] fix: repair broken links in documentation --- README.md | 4 +- docs/source/features.rst | 106 +++++++++--------- .../tutorials/complex_custom_objects.rst | 24 ++-- docs/source/tutorials/custom_objects.rst | 6 +- docs/source/tutorials/more_complexity.rst | 4 +- docs/source/what_is_crappy.rst | 4 +- 6 files changed, 75 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index cc69253f..a69e2126 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ Command and Real-time Acquisition in Parallelized PYthon (CRAPPY) [![Downloads](https://pepy.tech/badge/crappy)](https://pepy.tech/project/crappy) [![Documentation Status](https://readthedocs.org/projects/crappy/badge/?version=latest)](https://crappy.readthedocs.io/en/latest/?badge=latest) -[![PyPi version](https://badgen.net/pypi/v/crappy/)](https://pypi.org/project/crappy) -[![Python version](https://img.shields.io/pypi/pyversions/crappy.svg)](https://pypi.python.org/pypi/crappy/) +[![PyPi version](https://badgen.net/pypi/v/crappy/)](https://pypi.org/project/crappy/) +[![Python version](https://img.shields.io/pypi/pyversions/crappy.svg)](https://pypi.org/project/crappy/) CRAPPY aims to provide a free and open-source software canvas for driving experimental setups in a versatile and accessible way. diff --git a/docs/source/features.rst b/docs/source/features.rst index caa3c8a1..07db0def 100644 --- a/docs/source/features.rst +++ b/docs/source/features.rst @@ -7,9 +7,9 @@ exposed to the users. Information on how to use them can be found in the :ref:`Tutorials`, as well as guidelines for creating your own objects. For most Blocks, one or several directly runnable example scripts are available in the `examples folder `_ of the GitHub repository. For each object listed on this page, you -can click on its name to open the complete documentation given in the -:ref:`API`. +tree/master/examples>`_ of the GitHub repository. For each object listed on +this page, you can click on its name to open the complete documentation given +in the :ref:`API`. Functionalities (Blocks) ------------------------ @@ -28,8 +28,8 @@ Data display real-time temperature map. The examples folder on GitHub contains `one example of the Canvas Block - `_. + `_. - :ref:`Dashboard` @@ -38,8 +38,8 @@ Data display displayed for each label. The examples folder on GitHub contains `one example of the Dashboard Block - `_. + `_. - :ref:`Grapher` @@ -61,8 +61,8 @@ Data display Prints the values it receives in the terminal. Mostly useful for debugging. The examples folder on GitHub contains `one example of the Link Reader Block - `_. + `_. Data recording ++++++++++++++ @@ -74,8 +74,8 @@ Data recording recording any other type of data. The examples folder on GitHub contains `one example of the HDF Recorder Block - `_. + `_. - :ref:`Recorder` @@ -85,8 +85,8 @@ Data recording instead in this situation. The examples folder on GitHub contains `one example of the Recorder Block - `_. + `_. :ref:`A tutorial section <2.d. The Recorder Block>` is also dedicated to the Recorder Block. @@ -102,8 +102,8 @@ Data processing computationally-intensive :ref:`Multiplexer`. The examples folder on GitHub contains `one example of the Mean Block - `_. + `_. - :ref:`Multiplexer` @@ -114,8 +114,8 @@ Data processing post-processing. The examples folder on GitHub contains `one example of the Multiplexer Block - `_. + `_. Real-time image correlation +++++++++++++++++++++++++++ @@ -129,8 +129,8 @@ Real-time image correlation sent to downstream Blocks. The examples folder on GitHub contains `several examples of the DIS Correl - Block `_. + Block `_. - :ref:`GPU Correl` @@ -158,8 +158,8 @@ Video-extensometry Block as its input. The examples folder on GitHub contains `one example of the Auto Drive Block - `_. + `_. - :ref:`DIC VE` @@ -172,8 +172,8 @@ Video-extensometry patch playing the same role as a dot. The examples folder on GitHub contains `several examples of the DIC VE Block - `_. + `_. - :ref:`GPU VE` @@ -200,8 +200,8 @@ Video-extensometry areas. The examples folder on GitHub contains `one example of the Video Extenso - Block `_. + Block `_. Signal generation +++++++++++++++++ @@ -213,8 +213,8 @@ Signal generation Useful for triggering a behavior at a user-chosen moment during a test. The examples folder on GitHub contains `one example of the Button Block - `_. + `_. - :ref:`Generator` @@ -223,9 +223,9 @@ Signal generation can only output a combination of :ref:`Generator Paths`. The examples folder on GitHub contains `several examples of the Generator - Block `_ specifically, but it is also used in many of the other - examples. + Block `_ specifically, but it is also used in many of the + other examples. :ref:`A tutorial section <2.a. The Generator Block and its Paths>` is also dedicated to the Generator Block, and :ref:`another one @@ -241,8 +241,8 @@ Signal generation exact characteristics are unknown or can vary. The examples folder on GitHub contains `one example of the PID Block - `_. + `_. Hardware control ++++++++++++++++ @@ -255,8 +255,8 @@ Hardware control Block usually doesn't have input nor output Links. The examples folder on GitHub contains `several examples of the Camera Block - `_. + `_. :ref:`A tutorial section <2.b. The Camera Block>` is also dedicated to the Camera Block, and :ref:`another one <4. Custom Cameras>` is dedicated to the @@ -271,8 +271,8 @@ Hardware control Links when setting commands. The examples folder on GitHub contains `several examples of the IOBlock Block - `_. + `_. :ref:`A tutorial section <2.e. The IOBlock Block>` is also dedicated to the IOBlock Block, and :ref:`another one <3. Custom InOuts>` is dedicated to the @@ -286,8 +286,8 @@ Hardware control is intended for driving motors and similar devices. The examples folder on GitHub contains `several examples of the Machine Block - `_. + `_. :ref:`A tutorial section <2.f. The Machine Block>` is also dedicated to the Machine Block, and :ref:`another one <2. Custom Actuators>` is dedicated to @@ -301,8 +301,8 @@ Hardware control microcontroller, send commands, and receive data. The examples folder on GitHub contains `on example of the UController Block - `_. + `_. Others ++++++ @@ -315,8 +315,8 @@ Others controlling a test. The examples folder on GitHub contains `on example of the Client Server Block - `_. + `_. - :ref:`Fake Machine` @@ -326,16 +326,16 @@ Others debugging or prototyping. The examples folder on GitHub contains `on example of the Fake Machine Block - `_. + `_. - :ref:`Sink` Discards any received data. Used for prototyping and debugging only. The examples folder on GitHub contains `on example of the Sink Block - `_. + `_. - :ref:`Stop Block` @@ -343,8 +343,8 @@ Others criteria. One of the clean ways to stop a script in Crappy. The examples folder on GitHub contains `on example of the Stop Block - `_. + `_. Refer to the :ref:`dedicated tutorial section <3. Properly stopping a script>` to learn more about how to properly stop a @@ -356,8 +356,8 @@ Others One of the clean ways to stop a script in Crappy. The examples folder on GitHub contains `on example of the Stop Button Block - `_. + `_. Refer to the :ref:`dedicated tutorial section <3. Properly stopping a script>` to learn more about how to properly stop a @@ -372,9 +372,9 @@ Supported Cameras - :ref:`Basler Ironman Camera Link` Allows reading images from a camera communicating over Camera Link plugged to - a `microEnable 5 ironman AD8-PoCL `_ PCIexpress board. May as well - work with similar boards. + a `microEnable 5 ironman AD8-PoCL `_ PCIexpress board. May as well work with + similar boards. .. Important:: This Camera object relies on C++ libraries, which are not distributed with diff --git a/docs/source/tutorials/complex_custom_objects.rst b/docs/source/tutorials/complex_custom_objects.rst index eabecf1c..caea8654 100644 --- a/docs/source/tutorials/complex_custom_objects.rst +++ b/docs/source/tutorials/complex_custom_objects.rst @@ -114,9 +114,10 @@ self-explanatory by just reading the code and the comments. You can :download:`download this custom Path example ` to run it locally on your machine. You should see that the duty cycle of the generated square signal -varies according to the target duty cycle, as expected. In the `examples on -GitHub `_, you'll find another example of a custom Generator Path. +varies according to the target duty cycle, as expected. In the `custom objects +examples on GitHub `_, you'll find another example of a custom +Generator Path. .. Note:: If you want to have debug information displayed in the terminal from your @@ -213,12 +214,12 @@ It is passed no matter its value, so it might be equal to :obj:`None` ! It is your duty to handle the two situations when it has or hasn't an actual value. For hardware that doesn't support speed adjustment when operated in position mode, this argument can always be ignored. You can have a look at the -`Actuators distributed with Crappy -`_ -to see how the various :meth:`~crappy.actuator.Actuator.set_position` methods -implement the speed management in position mode. Also, an example of a -:ref:`Machine` Block with a variable target speed can be found in the `examples -folder on GitHub `_ to see how +the various :meth:`~crappy.actuator.Actuator.set_position` methods implement +the speed management in position mode. Also, an example of a :ref:`Machine` +Block with a variable target speed can be found in the `blocks examples folder +on GitHub `_. 4. More about custom Cameras @@ -680,8 +681,9 @@ the detected eyes on the displayed images : Python modules installed. This custom Camera Block script is based on an example that you can find in the -`examples folder on GitHub `__. You can :download:`download it +`custom objects examples folder on GitHub `__. You can +:download:`download it ` to run it locally on your machine. Note that the :py:`'Webcam'` camera is used here, so this example will require a camera readable by OpenCV to be plugged to the computer. diff --git a/docs/source/tutorials/custom_objects.rst b/docs/source/tutorials/custom_objects.rst index fa9874f7..221a2599 100644 --- a/docs/source/tutorials/custom_objects.rst +++ b/docs/source/tutorials/custom_objects.rst @@ -371,9 +371,9 @@ Actuators. The new methods are : labels in :py:`cmd_labels`. Once again, let's switch to practice by writing a custom InOut class. We'll -keep it very basic, you can browse the `InOuts distributed with Crappy -`_ to -have an overview of what a real-life InOut looks like. +keep it very basic, you can browse the `collection of InOuts distributed with +Crappy `_ to have an overview of what a real-life InOut looks like. .. literalinclude:: /downloads/custom_objects/custom_inout.py :language: python diff --git a/docs/source/tutorials/more_complexity.rst b/docs/source/tutorials/more_complexity.rst index 9adf2d19..0b7a8999 100644 --- a/docs/source/tutorials/more_complexity.rst +++ b/docs/source/tutorials/more_complexity.rst @@ -124,8 +124,8 @@ you to have a look at the section detailing :ref:`how to code your own Modifiers <1. Custom Modifiers>`. You can :download:`download this Modifier example ` to run it locally on your machine. The Modifiers distributed with Crappy are also showcased in the -`examples folder on GitHub -`_. +`examples folder on GitHub `_. 3. Advanced Generator condition ------------------------------- diff --git a/docs/source/what_is_crappy.rst b/docs/source/what_is_crappy.rst index 769262c3..8b409c20 100644 --- a/docs/source/what_is_crappy.rst +++ b/docs/source/what_is_crappy.rst @@ -91,7 +91,7 @@ won't be able to help you. So Crappy is **NOT for you** if : :target: https://crappy.readthedocs.io/en/latest/?badge=latest .. |PyPi version| image:: https://badgen.net/pypi/v/crappy/ - :target: https://pypi.org/project/crappy + :target: https://pypi.org/project/crappy/ .. |PyPI pyversions| image:: https://img.shields.io/pypi/pyversions/crappy.svg - :target: https://pypi.python.org/pypi/crappy/ + :target: https://pypi.org/project/crappy/ From f7d61aaaef9df7d9c5c644ff3d025947daf15dd4 Mon Sep 17 00:00:00 2001 From: Antoine Weisrock Date: Sun, 3 Dec 2023 17:25:29 +0100 Subject: [PATCH 3/3] build: update version to 2.0.1 --- docs/source/conf.py | 2 +- src/crappy/__version__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index d3780c7e..dd43aa48 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -16,7 +16,7 @@ from time import gmtime, strftime from re import match -__version__ = '2.0.0' +__version__ = '2.0.1' # -- Project information ----------------------------------------------------- diff --git a/src/crappy/__version__.py b/src/crappy/__version__.py index 23678b0e..e3e7796b 100644 --- a/src/crappy/__version__.py +++ b/src/crappy/__version__.py @@ -1,3 +1,3 @@ # coding: utf-8 -__version__ = '2.0.0' +__version__ = '2.0.1'