diff --git a/README.md b/README.md index d185fe9..d271308 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# xpdtools [![CI](https://github.com/NSLS2/xpdtools/actions/workflows/ci.yml/badge.svg)](https://github.com/NSLS2/xpdtools/actions/workflows/ci.yml) +# XPD Tools [![CI](https://github.com/NSLS2/xpd-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/NSLS2/xpd-tools/actions/workflows/ci.yml) Tools for NSLS-II XPD beamline. diff --git a/pyproject.toml b/pyproject.toml index 6666469..4d10d3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61", "setuptools_scm[toml]>=7"] build-backend = "setuptools.build_meta" [project] -name = "xpdtools" +name = "xpd-tools" authors = [ { name = "Brookhaven National Laboratory", email = "jwlodek@bnl.gov" }, ] @@ -93,10 +93,10 @@ profiles = [ ] [tool.setuptools.package-data] -"xpdtools.panda_configurations" = ["*.yaml"] +"xpd_tools.panda_configurations" = ["*.yaml"] [tool.setuptools_scm] -write_to = "src/xpdtools/_version.py" +write_to = "src/xpd_tools/_version.py" [tool.pyright] typeCheckingMode = "standard" @@ -108,7 +108,7 @@ reportMissingImports = false # Ignore missing stubs in imported modules addopts = """ --tb=native -vv --strict-markers --doctest-modules --doctest-glob="*.rst" --doctest-glob="*.md" - --ignore=docs/examples --ignore=src/xpdtools/profiles + --ignore=docs/examples --ignore=src/xpd_tools/profiles """ # https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings filterwarnings = [ @@ -127,7 +127,7 @@ timeout = 60 [tool.coverage.run] patch = ["subprocess"] -data_file = "/tmp/xpdtools.coverage" +data_file = "/tmp/xpd_tools.coverage" # branch = true [tool.coverage.paths] @@ -166,7 +166,7 @@ convention = "numpy" # See https://github.com/DiamondLightSource/python-copier-template/issues/154 # Remove this line to forbid private member access in tests "tests/**/*" = ["SLF001", "S101", "D"] -"src/xpdtools/profiles/**" = ["F401"] +"src/xpd_tools/profiles/**" = ["F401"] [tool.ruff.lint.flake8-import-conventions.extend-aliases] # We often shorten "Annotated" to "A" for brevity @@ -177,4 +177,4 @@ convention = "numpy" extend-ignore-names = ["RE"] [tool.importlinter] -root_package = "xpdtools" +root_package = "xpd_tools" diff --git a/src/xpdtools/__init__.py b/src/xpd_tools/__init__.py similarity index 100% rename from src/xpdtools/__init__.py rename to src/xpd_tools/__init__.py diff --git a/src/xpdtools/detectors/__init__.py b/src/xpd_tools/detectors/__init__.py similarity index 100% rename from src/xpdtools/detectors/__init__.py rename to src/xpd_tools/detectors/__init__.py diff --git a/src/xpdtools/detectors/panda.py b/src/xpd_tools/detectors/panda.py similarity index 96% rename from src/xpdtools/detectors/panda.py rename to src/xpd_tools/detectors/panda.py index eb5e4bc..ce0922d 100644 --- a/src/xpdtools/detectors/panda.py +++ b/src/xpd_tools/detectors/panda.py @@ -11,7 +11,7 @@ from ophyd_async.fastcs.panda import HDFPanda, apply_panda_settings from ophyd_async.plan_stubs import apply_settings_if_different, retrieve_settings -PANDA_CONFIG_PATH = Path(str(files("xpdtools.panda_configurations"))) +PANDA_CONFIG_PATH = Path(str(files("xpd_tools.panda_configurations"))) # Built dynamically from the packaged yaml files, so member names are only known # at runtime. cast to type[Enum] so the checker treats it as a class (issubclass, diff --git a/src/xpdtools/detectors/pilatus4.py b/src/xpd_tools/detectors/pilatus4.py similarity index 100% rename from src/xpdtools/detectors/pilatus4.py rename to src/xpd_tools/detectors/pilatus4.py diff --git a/src/xpdtools/detectors/utils.py b/src/xpd_tools/detectors/utils.py similarity index 95% rename from src/xpdtools/detectors/utils.py rename to src/xpd_tools/detectors/utils.py index 33ae5a1..ae12179 100644 --- a/src/xpdtools/detectors/utils.py +++ b/src/xpd_tools/detectors/utils.py @@ -1,4 +1,4 @@ -"""Utility functions for xpdtools detectors.""" +"""Utility functions for xpd_tools detectors.""" from collections.abc import Generator from typing import Any diff --git a/src/xpdtools/flyers.py b/src/xpd_tools/flyers.py similarity index 100% rename from src/xpdtools/flyers.py rename to src/xpd_tools/flyers.py diff --git a/src/xpdtools/motors.py b/src/xpd_tools/motors.py similarity index 100% rename from src/xpdtools/motors.py rename to src/xpd_tools/motors.py diff --git a/src/xpdtools/panda_configurations/__init__.py b/src/xpd_tools/panda_configurations/__init__.py similarity index 100% rename from src/xpdtools/panda_configurations/__init__.py rename to src/xpd_tools/panda_configurations/__init__.py diff --git a/src/xpdtools/panda_configurations/single_axis_flyscan.yaml b/src/xpd_tools/panda_configurations/single_axis_flyscan.yaml similarity index 100% rename from src/xpdtools/panda_configurations/single_axis_flyscan.yaml rename to src/xpd_tools/panda_configurations/single_axis_flyscan.yaml diff --git a/src/xpdtools/plans.py b/src/xpd_tools/plans.py similarity index 97% rename from src/xpdtools/plans.py rename to src/xpd_tools/plans.py index 3128187..be14bb7 100644 --- a/src/xpdtools/plans.py +++ b/src/xpd_tools/plans.py @@ -9,8 +9,8 @@ from ophyd_async.epics.adcore import AreaDetector from ophyd_async.fastcs.panda import HDFPanda -from xpdtools.detectors.utils import get_detector_acq_times -from xpdtools.flyers import get_zero_encoder_position +from xpd_tools.detectors.utils import get_detector_acq_times +from xpd_tools.flyers import get_zero_encoder_position from .flyers import ( SingleAxisFlyscanController, diff --git a/src/xpdtools/profiles/default.py b/src/xpd_tools/profiles/default.py similarity index 100% rename from src/xpdtools/profiles/default.py rename to src/xpd_tools/profiles/default.py diff --git a/src/xpdtools/profiles/xpdd.py b/src/xpd_tools/profiles/xpdd.py similarity index 76% rename from src/xpdtools/profiles/xpdd.py rename to src/xpd_tools/profiles/xpdd.py index 2b268c4..46efca8 100644 --- a/src/xpdtools/profiles/xpdd.py +++ b/src/xpd_tools/profiles/xpdd.py @@ -20,14 +20,14 @@ from ophyd_async.plan_stubs import store_settings from tiled.client import from_uri -from xpdtools.detectors.panda import PandAConfiguration, switch_panda_configuration -from xpdtools.detectors.pilatus4 import Pilatus4Detector -from xpdtools.motors import RotationMotor -from xpdtools.plans import single_axis_flyscan -from xpdtools.utils import ProposalIDPrompt, initialize_run_engine - -XPDTOOLS_RUNNING_IN_CI = ( - os.environ.get("XPDTOOLS_RUNNING_IN_CI", "false").lower() == "true" +from xpd_tools.detectors.panda import PandAConfiguration, switch_panda_configuration +from xpd_tools.detectors.pilatus4 import Pilatus4Detector +from xpd_tools.motors import RotationMotor +from xpd_tools.plans import single_axis_flyscan +from xpd_tools.utils import ProposalIDPrompt, initialize_run_engine + +XPD_TOOLS_RUNNING_IN_CI = ( + os.environ.get("XPD_TOOLS_RUNNING_IN_CI", "false").lower() == "true" ) os.environ["REDIS_HOST"] = "xf28id2-xpdd-redis1.nsls2.bnl.gov" @@ -45,22 +45,17 @@ RE.waiting_hook = ProgressBarManager() # type: ignore[assignment] -if not XPDTOOLS_RUNNING_IN_CI: +if not XPD_TOOLS_RUNNING_IN_CI: tiled_writing_client = from_uri( "https://tiled.nsls2.bnl.gov", api_key=os.environ.get("TILED_BLUESKY_WRITING_API_KEY_XPDD", ""), )["xpdd"]["migration"] else: - from tiled.server.simple import SimpleTiledServer + from tiled.client import simple - tiled_server = SimpleTiledServer( - directory="/tmp/xpdtools", - readable_storage="/tmp/tiled_server", - api_key="xpdtools", + tiled_reading_client = tiled_writing_client = c = simple( + "/tmp/xpd_tools", api_key="xpd_tools", readable_storage="/tmp/xpd_tools" ) - tiled_writing_client = from_uri(tiled_server.uri) - tiled_reading_client = c = from_uri(tiled_server.uri) - # Setup writing to the database tw = TiledWriter(tiled_writing_client) @@ -74,7 +69,7 @@ if ipython is not None and isinstance(ipython, TerminalInteractiveShell): ipython.prompts = ProposalIDPrompt(RE, ipython) ipython.run_line_magic("autoawait", "call_in_bluesky_event_loop") - if not XPDTOOLS_RUNNING_IN_CI: + if not XPD_TOOLS_RUNNING_IN_CI: tiled_reading_client = c = from_uri("https://tiled.nsls2.bnl.gov")["xpdd"][ "migration" ] @@ -82,7 +77,7 @@ path_provider = NSLS2PathProvider(RE.md, beamline_tla="xpd", beamline_tla_suffix="-new") -with init_devices(mock=XPDTOOLS_RUNNING_IN_CI): +with init_devices(mock=XPD_TOOLS_RUNNING_IN_CI): panda1 = HDFPanda("XF:28ID2-ES{PANDA:1}:", path_provider) rot_motor = RotationMotor("XF:28IDD-ES:2{Twister}Mtr") step_motor = AsyncEpicsMotor("XF:28IDD-ES:2{Twister}Mtr", name="amazon_motor") diff --git a/src/xpdtools/utils.py b/src/xpd_tools/utils.py similarity index 95% rename from src/xpdtools/utils.py rename to src/xpd_tools/utils.py index 22c75b5..f4d354f 100644 --- a/src/xpdtools/utils.py +++ b/src/xpd_tools/utils.py @@ -21,13 +21,13 @@ def print_version_info(): from ophyd_async import __version__ as ophyd_async_version from tiled import __version__ as tiled_version - from xpdtools import __version__ as xpdtools_version + from xpd_tools import __version__ as xpd_tools_version rprint("\n[bold]Version Information[/bold]") rprint(f" [bold]bluesky[/bold]: [blue]{bluesky_version}[/blue]") rprint(f" [bold]ophyd_async[/bold]: [blue]{ophyd_async_version}[/blue]") rprint(f" [bold]tiled[/bold]: [blue]{tiled_version}[/blue]") - rprint(f" [bold]xpdtools[/bold]: [blue]{xpdtools_version}[/blue]\n") + rprint(f" [bold]xpd-tools[/bold]: [blue]{xpd_tools_version}[/blue]\n") def show_docs(name: str, doc: dict[str, Any]): diff --git a/tests/detectors/test_panda.py b/tests/detectors/test_panda.py index 91565ae..bed110e 100644 --- a/tests/detectors/test_panda.py +++ b/tests/detectors/test_panda.py @@ -2,7 +2,7 @@ import pytest -from xpdtools.detectors.panda import ( +from xpd_tools.detectors.panda import ( PandAConfiguration, PandASettingsProvider, ) diff --git a/tests/test_flyers.py b/tests/test_flyers.py index 96bbc56..b86077b 100644 --- a/tests/test_flyers.py +++ b/tests/test_flyers.py @@ -1,7 +1,7 @@ import pytest from ophyd_async.core import FlyMotorInfo -from xpdtools.flyers import ( +from xpd_tools.flyers import ( PandaPcompDirection, SingleAxisFlyscanInfo, calculate_move_time_for_flyscan, diff --git a/tests/test_motors.py b/tests/test_motors.py index 31be732..ff8a35e 100644 --- a/tests/test_motors.py +++ b/tests/test_motors.py @@ -1,6 +1,6 @@ import pytest -from xpdtools.motors import get_encoder_value_from_pos +from xpd_tools.motors import get_encoder_value_from_pos @pytest.mark.parametrize( diff --git a/tests/test_plans.py b/tests/test_plans.py index 721d5a1..3c43a0f 100644 --- a/tests/test_plans.py +++ b/tests/test_plans.py @@ -22,9 +22,9 @@ from ophyd_async.epics.adcore import ADWriterFactory, NDFileHDF5IO from ophyd_async.fastcs.panda import DatasetTable, HDFPanda, PandaHdf5DatasetType -from xpdtools.detectors.pilatus4 import Pilatus4Detector -from xpdtools.motors import RotationMotor -from xpdtools.plans import single_axis_flyscan +from xpd_tools.detectors.pilatus4 import Pilatus4Detector +from xpd_tools.motors import RotationMotor +from xpd_tools.plans import single_axis_flyscan NUM_IMAGES = 11 SCAN_START = 0.0 diff --git a/tests/test_utils.py b/tests/test_utils.py index 14dd5f0..263135e 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,7 +6,7 @@ from pygments.token import Token from pytest_mock import MockerFixture -from xpdtools.utils import ProposalIDPrompt, start_beamtime +from xpd_tools.utils import ProposalIDPrompt, start_beamtime def test_start_beamtime( @@ -37,7 +37,7 @@ def fake_sync_experiment(*args, **kwargs): return sample_metadata mocker.patch( - "xpdtools.utils.sync_experiment", + "xpd_tools.utils.sync_experiment", side_effect=fake_sync_experiment, ) @@ -68,7 +68,7 @@ def fake_sync_experiment(*args, **kwargs): return {} mocker.patch( - "xpdtools.utils.sync_experiment", + "xpd_tools.utils.sync_experiment", side_effect=fake_sync_experiment, ) diff --git a/uv.lock b/uv.lock index baa0437..49901c8 100644 --- a/uv.lock +++ b/uv.lock @@ -4677,7 +4677,7 @@ wheels = [ ] [[package]] -name = "xpdtools" +name = "xpd-tools" source = { editable = "." } dependencies = [ { name = "bluesky" },