Skip to content

Commit

Permalink
Upgrade to Pydantic 2 (#564)
Browse files Browse the repository at this point in the history
Fixes #273 

Supersedes #449 
---------
Co-authored-by: DiamondJoseph <53935796+DiamondJoseph@users.noreply.github.com>
Co-authored-by: Zoheb Shaikh <zoheb.shaikh@diamond.ac.uk>
  • Loading branch information
callumforrester committed Aug 20, 2024
1 parent fd41e57 commit 8217396
Show file tree
Hide file tree
Showing 12 changed files with 269 additions and 195 deletions.
136 changes: 75 additions & 61 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,57 +1,61 @@
accessible-pygments==0.0.5
aioca==1.7
aiofiles==24.1.0
aiohttp==3.9.5
aiohappyeyeballs==2.3.5
aiohttp==3.10.3
aiosignal==1.3.1
alabaster==0.7.16
annotated-types==0.7.0
anyio==4.4.0
appdirs==1.4.4
asciitree==0.3.3
asttokens==2.4.1
async-timeout==4.0.3
attrs==23.2.0
Babel==2.15.0
attrs==24.2.0
babel==2.16.0
beautifulsoup4==4.12.3
bidict==0.23.1
bluesky==1.13.0a3
black==24.8.0
bluesky==1.13.0a4
bluesky-kafka==0.10.0
bluesky-live==0.0.8
boltons==24.0.0
cachetools==5.3.3
cachetools==5.4.0
caproto==1.1.1
certifi==2024.7.4
cfgv==3.4.0
chardet==5.2.0
charset-normalizer==3.3.2
click==8.1.3
click==8.1.7
cloudpickle==3.0.0
colorama==0.4.6
colorlog==6.8.2
comm==0.2.2
confluent-kafka==2.4.0
confluent-kafka==2.5.0
contourpy==1.2.1
copier==8.1.0
coverage==7.5.4
copier==9.3.1
coverage==7.6.1
cycler==0.12.1
dask==2024.7.0
dask==2024.8.0
databroker==1.2.5
dataclasses-json==0.6.7
decorator==5.1.1
deepmerge==1.1.1
diff_cover==9.1.1
distlib==0.3.8
dls-bluesky-core==0.0.3
dls-dodal==1.29.2
dls-bluesky-core==0.0.4
dls-dodal==1.28.0
dnspython==2.6.1
docopt==0.6.2
doct==1.1.0
docutils==0.21.2
dunamai==1.21.2
dunamai==1.22.0
email_validator==2.2.0
entrypoints==0.4
epicscorelibs==7.0.7.99.0.2
event-model==1.20.0
exceptiongroup==1.2.1
executing==2.0.1
fastapi==0.99.1
fastapi==0.112.0
fastapi-cli==0.0.5
fasteners==0.19
filelock==3.15.4
flexcache==0.3
Expand All @@ -60,6 +64,8 @@ fonttools==4.53.1
frozenlist==1.4.1
fsspec==2024.6.1
funcy==2.0
gitdb==4.0.11
GitPython==3.1.43
graypy==2.1.0
h11==0.14.0
h5py==3.11.0
Expand All @@ -73,7 +79,7 @@ identify==2.6.0
idna==3.7
imageio==2.34.2
imagesize==1.4.1
importlib_metadata==8.0.0
importlib_metadata==8.2.0
importlib_resources==6.4.0
iniconfig==2.0.0
intake==0.6.4
Expand All @@ -88,12 +94,11 @@ jsonschema-specifications==2023.12.1
jupyterlab_widgets==3.0.11
kiwisolver==1.4.5
ldap3==2.9.1
livereload==2.7.0
locket==1.0.0
markdown-it-py==3.0.0
MarkupSafe==2.1.5
marshmallow==3.21.3
matplotlib==3.9.1
matplotlib==3.9.2
matplotlib-inline==0.1.7
mdit-py-plugins==0.4.1
mdurl==0.1.2
Expand All @@ -103,19 +108,19 @@ mongoquery==1.4.2
msgpack==1.0.8
msgpack-numpy==0.4.8
multidict==6.0.5
mypy==1.10.1
mypy==1.11.1
mypy-extensions==1.0.0
myst-parser==3.0.1
myst-parser==4.0.0
networkx==3.3
nodeenv==1.9.1
nose2==0.15.1
nslsii==0.10.3
numcodecs==0.12.1
numpy==1.26.4
numcodecs==0.13.0
numpy==2.0.1
opencv-python-headless==4.10.0.84
ophyd==1.9.0
ophyd-async==0.3.4
orjson==3.10.6
ophyd-async==0.3.1
orjson==3.10.7
p4p==4.1.12
packaging==24.1
pandas==2.2.2
Expand All @@ -128,104 +133,113 @@ picobox==4.0.0
pika==1.3.2
pillow==10.4.0
PIMS==0.7
Pint==0.24.1
pipdeptree==2.23.0
Pint==0.24.3
pipdeptree==2.23.1
platformdirs==4.2.2
pluggy==1.5.0
plumbum==1.8.3
ply==3.11
pre-commit==3.7.1
prettytable==3.10.0
pre-commit==3.8.0
prettytable==3.11.0
prompt-toolkit==3.0.36
psutil==6.0.0
ptyprocess==0.7.0
pure-eval==0.2.2
pure_eval==0.2.3
pvxslibs==1.3.1
py==1.11.0
pyasn1==0.6.0
pycryptodome==3.20.0
pydantic==1.10.17
pydantic==2.8.2
pydantic-extra-types==2.9.0
pydantic-settings==2.4.0
pydantic_core==2.20.1
pydata-sphinx-theme==0.15.4
pyepics==3.5.6
Pygments==2.18.0
pymongo==4.8.0
pyOlog==4.5.0
pyparsing==3.1.2
pytest==8.2.2
pytest-asyncio==0.23.7
pyright==1.1.375
pytest==8.3.2
pytest-asyncio==0.23.8
pytest-cov==5.0.0
pytest-random-order==1.1.1
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-multipart==0.0.9
pytz==2024.1
PyYAML==6.0.1
pyyaml-include==2.1
PyYAML==6.0.2
questionary==2.0.1
redis==5.0.7
redis==5.0.8
redis-json-dict==0.2.0
referencing==0.35.1
requests==2.32.3
responses==0.25.3
rpds-py==0.19.0
ruff==0.5.1
scanspec==0.6.6
setuptools-dso==2.10
rich==13.7.1
rpds-py==0.20.0
ruff==0.5.7
scanspec==0.7.1
setuptools-dso==2.11a2
shellingham==1.5.4
six==1.16.0
slicerator==1.1.0
smmap==5.0.1
sniffio==1.3.1
snowballstemmer==2.2.0
soupsieve==2.5
Sphinx==7.3.7
sphinx-autobuild==2024.2.4
Sphinx==7.4.5
sphinx-autobuild==2024.4.16
sphinx-autodoc-typehints==2.2.3
sphinx-click==6.0.0
sphinx-copybutton==0.5.2
sphinx_design==0.6.0
sphinx_mdinclude==0.6.1
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
sphinx_design==0.6.1
sphinx_mdinclude==0.6.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-httpdomain==1.8.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-mermaid==0.9.2
sphinxcontrib-openapi==0.8.4
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
starlette==0.27.0
starlette==0.37.2
stomp-py==8.1.2
suitcase-mongo==0.6.0
suitcase-msgpack==0.3.0
suitcase-utils==0.5.4
super-state-machine==2.0.2
tifffile==2024.7.2
tomli==2.0.1
tifffile==2024.8.10
toolz==0.12.1
tornado==6.4.1
tox==3.28.0
tox-direct==0.4
tqdm==4.66.4
tqdm==4.66.5
traitlets==5.14.3
typer==0.12.3
types-aiofiles==24.1.0.20240626
types-mock==5.1.0.20240425
types-PyYAML==6.0.12.20240311
types-requests==2.32.0.20240622
types-PyYAML==6.0.12.20240808
types-requests==2.32.0.20240712
types-urllib3==1.26.25.14
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.1
tzlocal==5.2
ujson==5.10.0
urllib3==2.2.2
uvicorn==0.30.1
uvicorn==0.30.5
uvloop==0.19.0
virtualenv==20.26.3
watchfiles==0.22.0
watchfiles==0.23.0
wcwidth==0.2.13
websocket-client==1.8.0
websockets==12.0
widgetsnbextension==4.0.11
workflows==2.27
xarray==2024.6.0
xarray==2024.7.0
yarl==1.9.4
zarr==2.18.2
zict==2.2.0
zipp==3.19.2
zocalo==0.32.0
zipp==3.20.0
zocalo==1.0.0
33 changes: 25 additions & 8 deletions docs/reference/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ components:
description: State of internal environment.
properties:
error_message:
anyOf:
- minLength: 1
type: string
- type: 'null'
description: If present - error loading context
minLength: 1
title: Error Message
type: string
initialized:
description: blueapi context initialized
title: Initialized
Expand All @@ -64,17 +66,21 @@ components:
description: Representation of a plan
properties:
description:
anyOf:
- type: string
- type: 'null'
description: Docstring of the plan
title: Description
type: string
name:
description: Name of the plan
title: Name
type: string
schema:
anyOf:
- type: object
- type: 'null'
description: Schema of the plan's parameters
title: Schema
type: object
required:
- name
title: PlanModel
Expand All @@ -98,16 +104,20 @@ components:
description: Request to change the state of the worker.
properties:
defer:
anyOf:
- type: boolean
- type: 'null'
default: false
description: Should worker defer Pausing until the next checkpoint
title: Defer
type: boolean
new_state:
$ref: '#/components/schemas/WorkerState'
reason:
anyOf:
- type: string
- type: 'null'
description: The reason for the current run to be aborted
title: Reason
type: string
required:
- new_state
title: StateChangeRequest
Expand Down Expand Up @@ -178,6 +188,7 @@ components:
type: string
required:
- task_id
- task
title: TrackableTask
type: object
ValidationError:
Expand Down Expand Up @@ -221,9 +232,13 @@ components:
description: Worker's active task ID, can be None
properties:
task_id:
anyOf:
- type: string
- type: 'null'
description: The ID of the current task, None if the worker is idle
title: Task Id
type: string
required:
- task_id
title: WorkerTask
type: object
info:
Expand Down Expand Up @@ -340,8 +355,10 @@ paths:
name: task_status
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Task Status
type: string
responses:
'200':
content:
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ dependencies = [
"nslsii",
"pyepics",
"aioca",
"pydantic<2.0", # Leave pinned until can check incompatibility
"pydantic>=2.0",
"scanspec>=0.7.1",
"pydantic-settings",
"stomp-py",
"aiohttp",
"PyYAML",
Expand Down
Loading

0 comments on commit 8217396

Please sign in to comment.