Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate import name spaces #68

Open
2 tasks
jackbdoughty opened this issue Nov 22, 2024 · 2 comments
Open
2 tasks

Consolidate import name spaces #68

jackbdoughty opened this issue Nov 22, 2024 · 2 comments
Labels
2 good first issue Good for newcomers

Comments

@jackbdoughty
Copy link
Contributor

jackbdoughty commented Nov 22, 2024

  • As a developer I would like the import namespaces to be a little leaner so that I need fewer lines of imports
  • As a scientist I would like imports such as fitting_utils to have more concise names

For the test on CRISP our imports ended up looking like this, for relatively simple scans:

from ibex_bluesky_core.callbacks.file_logger import HumanReadableFileCallback
from ibex_bluesky_core.callbacks.fitting import LiveFit
from ibex_bluesky_core.callbacks.fitting.livefit_logger import LiveFitLogger
from ibex_bluesky_core.callbacks.fitting.fitting_utils import Fit, Linear
from ibex_bluesky_core.callbacks.plotting import LivePlot
from ibex_bluesky_core.devices import get_pv_prefix
from ibex_bluesky_core.devices.block import BlockRw, BlockWriteConfig, block_rw
from ibex_bluesky_core.devices.simpledae import SimpleDae
from ibex_bluesky_core.devices.simpledae.controllers import (
    PeriodPerPointController,
    RunPerPointController,
)
from ibex_bluesky_core.devices.simpledae.reducers import MonitorNormalizer
from ibex_bluesky_core.devices.simpledae.waiters import GoodFramesWaiter, PeriodGoodFramesWaiter
from ibex_bluesky_core.run_engine import get_run_engine
from ibex_bluesky_core.callbacks.fitting import fitting_utils as fit

This is a bit verbose, mostly due to having to import things from multiple levels in a hierarchy

Acceptance criteria

  • Go through and add relevant public imports to __init__.pys and __all__ so that they are accessible from "higher level" modules - e.g. all simpledae functionality should probably be accessible from ibex_bluesky_core.devices.simpledae.
  • We may consider making more of our modules _private, so that it's clear what are the user-facing import paths and what is implementation details of the library

Notes

  • We do not need to change our internal structure to do this - just expose things via imports and __all__ at the right levels.

Planning

10/01/25 - 00:40:50

@Tom-Willemsen
Copy link
Contributor

Tom-Willemsen commented Nov 24, 2024

Could also look at flattening out some of our classes a bit / replacing with free functions - e.g. could Gaussian().fit() be just gaussian as a free function?

@jackbdoughty
Copy link
Contributor Author

For whoever picks this up, make sure to update doc\fitting\fitting.md according to new class/function/import names

@Tom-Willemsen Tom-Willemsen added the good first issue Good for newcomers label Dec 4, 2024
@KathrynBaker KathrynBaker removed this from PI_2024_08 Jan 9, 2025
@Chsudeepta Chsudeepta added the 2 label Jan 10, 2025
@KathrynBaker KathrynBaker moved this to Backlog in PI_2025_02 Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 good first issue Good for newcomers
Projects
Status: Backlog
Development

No branches or pull requests

3 participants