fmi-faim / faim-ipa

A collection of Image Processing and Analysis (IPA) functions used at the Facility for Advanced Imaging and Microscopy (FAIM)
BSD 3-Clause "New" or "Revised" License
9 stars 6 forks source link

Use lower-case module names everywhere #117

Closed imagejan closed 3 months ago

imagejan commented 7 months ago

We currently have CamelCase class names inside CamelCase module files with the same name, and expose classes on module level by importing them in __init__.py, e.g.:

https://github.com/fmi-faim/faim-ipa/blob/f4191359d3f35144190188e59dcdb90eebcefb78/src/faim_ipa/hcs/cellvoyager/__init__.py#L1-L2 https://github.com/fmi-faim/faim-ipa/blob/f4191359d3f35144190188e59dcdb90eebcefb78/src/faim_ipa/hcs/imagexpress/__init__.py#L1-L5

This is problematic, as changing the order of imports such as:

from .ImageXpressPlateAcquisition import ImageXpressPlateAcquisition  # noqa: F401
from .ImageXpressWellAcquisition import ImageXpressWellAcquisition  # noqa: F401
+++ from .MixedAcquisition import MixedAcquisition  # noqa: F401
from .SinglePlaneAcquisition import SinglePlaneAcquisition  # noqa: F401
from .StackAcquisition import StackAcquisition  # noqa: F401
--- from .MixedAcquisition import MixedAcquisition  # noqa: F401

leads to errors like this:

ERROR tests/hcs/imagexpress/test_ImageXpress.py - TypeError: module() takes at most 2 arguments (3 given)

.. as we mix modules and classes with the same name.


We should instead use all-lower-case names for the module files, and CamelCase exclusively for the class names. What do you think, @tibuch?

tibuch commented 7 months ago

I don't know what the best practice is here.

I think I had the files in CamelCase because I wanted to name them like the class inside. Maybe this is a java thing which I tried to replicate.

But definitely in favor of fixing this.