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

Add 0.10 docs #700

Merged
merged 43 commits into from
Feb 11, 2025
Merged

Add 0.10 docs #700

merged 43 commits into from
Feb 11, 2025

Conversation

coretl
Copy link
Collaborator

@coretl coretl commented Dec 9, 2024

Rewrite of the documentation and its structure including:

  • Making sim and epics.demo devices do the same
  • Placeholder for the same for tango.demo and fastcs.demo devices
  • New tutorials, how-tos and explanations
  • Reduce installed dependencies

The first half of #721
Fixes #677
Fixes #671
Fixes #484
Fixes #480
Fixes #479
Fixes #459
Fixes #443 (well enough anyway)
Fixes #386
Fixes #349
Fixes #303
Fixes #246
Fixes #227
Fixes #193
Fixes #622

@coretl coretl changed the title Add 1.0 docs Add 0.10 docs Jan 20, 2025
@coretl coretl force-pushed the docs branch 2 times, most recently from 73cc77e to f68f00c Compare January 21, 2025 16:54
@coretl
Copy link
Collaborator Author

coretl commented Jan 22, 2025

@evalott100 please can you make a new branch off this one, then PR back to the docs branch fixing some of the warnings in https://github.com/bluesky/ophyd-async/actions/runs/12911955696/job/36005625932?

Some of them are just missing docstrings, but there are a bunch that say something like:

docstring of ophyd_async.core._signal.set_and_wait_for_value:1: WARNING: py:class reference target not found: ophyd_async.core._signal_backend.SignalDatatypeT

I think this is because importing ophyd_async.core._signal_backend.SignalDatatypeT into ophyd_async.core loses its doc-comment (doc-comment because it is a TypeVar not a class). I have no idea how to get sphinx to recognise that SignalDatatypeT exists and is of a particular type.

I have tried:

  • Adding the following to ophyd_async.core.__init__:
"""
.. data:: SignalDatatypeT

    The supported `Signal` datatypes
"""
  • Doing the same with .. class:: SignalDatatypeT
  • Doing the same but in ophyd_async.core._signal_backend
  • Peppering the codebase with from __future__ import annotations

My next steps were going to be:

  • Add from __future__ import annotations for everything (don't know if you can do this for the whole module)
  • Use autodoc_type_aliases to map ophyd_async.core._signal_backend.SignalDatatypeT to ophyd_async.core.SignalDatatypeT as defined by one of the methods above
  • Do some googling

evalott100 added a commit that referenced this pull request Jan 28, 2025
@evalott100
Copy link
Contributor

evalott100 commented Jan 30, 2025

Will continue tomorrow.

Observations

TypeVars

All broken throughout.

Event model types

It can't reference DataKey in the type hint despite event model being in the intersphinx mapping.

/home/eva/Code/ophyd-async/src/ophyd_async/core/__init__.py:docstring of ophyd_async.core._signal_backend.make_datakey:1: WARNING: 'any' reference target not found: DataKey

TriggerInfo

Can't get pydantic fields working so get the errors

...
/home/eva/Code/ophyd-async/src/ophyd_async/core/_detector.py:docstring of ophyd_async.core._detector.TriggerInfo:1: WARNING: py:obj reference target not found: ophyd_async.core._detector.TriggerInfo.livetime
/home/eva/Code/ophyd-async/src/ophyd_async/core/_detector.py:docstring of ophyd_async.core._detector.TriggerInfo:1: WARNING: py:obj reference target not found: ophyd_async.core._detector.TriggerInfo.frame_timeout
...

DeviceProcessor

/home/eva/Code/ophyd-async/src/ophyd_async/core/__init__.py:docstring of ophyd_async.core._device.init_devices:1: WARNING: py:class reference target not found: ophyd_async.core._device.DeviceProcessor

Sphinx can't find this, not in public api.

Numpy types

Related to TypeVar issues I think. But it's giving this issue on DeviceFiller, no idea why.

...
/home/eva/Code/ophyd-async/src/ophyd_async/core/_device_filler.py:docstring of ophyd_async.core._device_filler.DeviceFiller:1: WARNING: py:class reference target not found: numpy.int8
...

Asyncio types

Can't find asyncio.Task in async status...

/home/eva/Code/ophyd-async/src/ophyd_async/core/_status.py:docstring of ophyd_async.core._status.AsyncStatus:1: WARNING: py:class reference target not found: _asyncio.Task

We should be getting this through the python intersphinx mapping already present. I assume it's because of AS and WAS TypeVar weirdness.

Table

I think this is because of pydantic weirdness in the case of Table.all, and also decorators in the case of validate_array_dtypes.

/home/eva/Code/ophyd-async/src/ophyd_async/core/_table.py:docstring of ophyd_async.core._table.Table:1: WARNING: py:obj reference target not found: ophyd_async.core._table.Table.validate_array_dtypes
/home/eva/Code/ophyd-async/src/ophyd_async/core/_table.py:docstring of ophyd_async.core._table.Table:1: WARNING: py:obj reference target not found: ophyd_async.core._table.Table.all fields
/home/eva/Code/ophyd-async/src/ophyd_async/core/_table.py:docstring of ophyd_async.core._table.Table:1: WARNING: py:obj reference target not found: ophyd_async.core._table.Table.validate_lengths
/home/eva/Code/ophyd-async/src/ophyd_async/core/_table.py:docstring of ophyd_async.core._table.Table:1: WARNING: py:obj reference target not found: ophyd_async.core._table.Table.all fields
/home/eva/Code/ophyd-async/src/ophyd_async/core/_table.py:docstring of ophyd_async.core._table.Table.validate_array_dtypes:1: WARNING: py:obj reference target not found: ophyd_async.core._table.Table.all fields
/home/eva/Code/ophyd-async/src/ophyd_async/core/_table.py:docstring of ophyd_async.core._table.Table.validate_lengths:1: WARNING: py:obj reference target not found: ophyd_async.core._table.Table.all fields

AD Core stuff

...
/scratch/twj43146/Programming/ophyd-async/src/ophyd_async/epics/adcore/_core_io.py:docstring of ophyd_async.epics.adcore._core_io.DetectorState:1:<autosummary>:1: WARNING: py:obj reference target not found: ophyd_async.epics.adcore.NDFileIO
...

To be covered in #754.

Unused InvalidFlyMotorException

`InvalidFlyMotorException`` is not actually used anywhere:

class MotorLimitsException(Exception):
pass
class InvalidFlyMotorException(Exception):
pass

Tango

Struggling with the DeviceProxy, AsyncDeviceProxy, and SyncDeviceProxy which define the __doc__ on a partial:

DeviceProxy = partial(get_device_proxy, green_mode=GreenMode.Asyncio)
DeviceProxy.__doc__ = """
    DeviceProxy(self, dev_name, wait=False, timeout=None)
        -> DeviceProxy
    ...
"""
scratch/twj43146/Programming/ophyd-async/src/ophyd_async/tango/core/__init__.py:docstring of ophyd_async.tango.core._signal.tango_signal_w:1: WARNING: py:class reference target not found: tango._tango.DeviceProxy
/scratch/twj43146/Programming/ophyd-async/src/ophyd_async/tango/core/__init__.py:docstring of ophyd_async.tango.core._signal.tango_signal_x:1: WARNING: py:class reference target not found: tango._tango.DeviceProxy
/scratch/twj43146/Programming/ophyd-async/src/ophyd_async/tango/core/_base_device.py:docstring of ophyd_async.tango.core._base_device.TangoDevice:1: WARNING: py:class reference target not found: tango._tango.DeviceProxy

Also having problems with DevVoid, and CommandInfo:

/scratch/twj43146/Programming/ophyd-async/src/ophyd_async/tango/demo/_tango/_servers.py:docstring of ophyd_async.tango.demo._tango._servers.DemoCounter.reset:1: WARNING: py:class reference target not found: DevVoid
/scratch/twj43146/Programming/ophyd-async/src/ophyd_async/tango/core/__init__.py:docstring of ophyd_async.tango.core._tango_transport.get_trl_descriptor:1: WARNING: py:class reference target not found: tango._tango.CommandInfo

Myst cross-reference issues

/scratch/twj43146/Programming/ophyd-async/docs/how-to/choose-right-baseclass.md:33: WARNING: 'myst' cross-reference target not found: 'TangoConnector'
/scratch/twj43146/Programming/ophyd-async/docs/how-to/choose-right-baseclass.md:33: WARNING: 'myst' cross-reference target not found: 'EpicsConnector'
/scratch/twj43146/Programming/ophyd-async/docs/how-to/choose-right-baseclass.md:33: WARNING: 'myst' cross-reference target not found: 'PviConnector'
/scratch/twj43146/Programming/ophyd-async/docs/how-to/implement-ad-detector.md:16: WARNING: 'myst' cross-reference target not found: 'ADBaseIO'
/scratch/twj43146/Programming/ophyd-async/docs/how-to/implement-ad-detector.md:25: WARNING: 'myst' cross-reference target not found: 'ADBaseController'
/scratch/twj43146/Programming/ophyd-async/docs/how-to/implement-ad-detector.md:40: WARNING: 'myst' cross-reference target not found: 'ADWriter'
/scratch/twj43146/Programming/ophyd-async/docs/how-to/implement-ad-detector.md:40: WARNING: 'myst' cross-reference target not found: 'adcore.ADHDFWriter'
/scratch/twj43146/Programming/ophyd-async/docs/how-to/implement-ad-detector.md:44: WARNING: 'myst' cross-reference target not found: 'adcore.NDPluginBase'
/scratch/twj43146/Programming/ophyd-async/docs/tutorials/implementing-devices.md:169: WARNING: 'myst' cross-reference target not found: 'SignalDatatype'

@coretl
Copy link
Collaborator Author

coretl commented Feb 10, 2025

@evalott100 please could you give this another review?

I propose to merge this in approximately this state with further work in other tickets:

I will write up the last remaining tutorial (detectors) as part of another PR

@coretl coretl requested a review from evalott100 February 10, 2025 14:41
@coretl coretl marked this pull request as ready for review February 10, 2025 14:41
Copy link
Member

@jwlodek jwlodek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a few typos

docs/explanations/design-goals.md Show resolved Hide resolved
src/ophyd_async/core/_providers.py Outdated Show resolved Hide resolved
src/ophyd_async/core/_providers.py Outdated Show resolved Hide resolved
@coretl coretl mentioned this pull request Feb 10, 2025
Copy link
Contributor

@evalott100 evalott100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots here, changes to the docs are great!

All the following should be regarded as NITs.

docs/how-to/interact-with-signals.md Outdated Show resolved Hide resolved
docs/tutorials/using-devices.md Outdated Show resolved Hide resolved
docs/tutorials/using-devices.md Outdated Show resolved Hide resolved
docs/tutorials/using-devices.md Outdated Show resolved Hide resolved
src/ophyd_async/core/_protocol.py Outdated Show resolved Hide resolved
src/ophyd_async/epics/demo/_stage.py Outdated Show resolved Hide resolved
src/ophyd_async/sim/_point_detector.py Outdated Show resolved Hide resolved
src/ophyd_async/sim/_point_detector.py Outdated Show resolved Hide resolved
src/ophyd_async/sim/_stage.py Outdated Show resolved Hide resolved
src/ophyd_async/testing/_mock_signal_utils.py Outdated Show resolved Hide resolved
@coretl coretl merged commit 663ad9d into main Feb 11, 2025
21 of 22 checks passed
@coretl coretl deleted the docs branch February 11, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment