Skip to content

Commit c7c27ca

Browse files
authored
Merge pull request #11 from DiamondLightSource/dev
-Major refactor to PV creation and data management -Reworked how many PVs work, how the simulation updates PVs and how the PVs update the simulation -Reworked and updated the docs -Type hinting and docs strings -Modified the CSV files to support the refactor -Streamlined the csv creation process.
2 parents b958b92 + e547546 commit c7c27ca

32 files changed

+7715
-7108
lines changed

.copier-answers.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 4.0.1
2+
_commit: 4.3.0
33
_src_path: gh:DiamondLightSource/python-copier-template
44
author_email: [email protected]
55
author_name: Tobyn Nicholls
@@ -9,10 +9,11 @@ component_type: service
99
description: Diamond virtual accelerator
1010
distribution_name: virtac
1111
docker: true
12+
docker_debug: false
1213
docs_type: sphinx
1314
git_platform: github.com
1415
github_org: DiamondLightSource
1516
package_name: virtac
16-
pypi: true
17+
pypi: false
1718
repo_name: virtac
1819
type_checker: mypy

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ It is recommended that developers use a [vscode devcontainer](https://code.visua
2424

2525
This project was created using the [Diamond Light Source Copier Template](https://github.com/DiamondLightSource/python-copier-template) for Python projects.
2626

27-
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/4.0.1/how-to.html).
27+
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/4.3.0/how-to.html).

.github/workflows/_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json
4646

4747
- name: Publish Docs to gh-pages
48-
if: github.ref_type == 'tag' || github.ref_name == 'main'
48+
if: github.ref_type == 'tag' || github.ref_name == 'main' || github.ref_name == 'dev'
4949
# We pin to the SHA, not the tag, for security reasons.
5050
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
5151
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0

.github/workflows/_pypi.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@ jobs:
4444

4545
dist:
4646
uses: ./.github/workflows/_dist.yml
47-
48-
pypi:
49-
needs: [dist, test]
50-
if: github.ref_type == 'tag'
51-
uses: ./.github/workflows/_pypi.yml
52-
permissions:
53-
id-token: write
47+
5448

5549
release:
5650
needs: [dist, test, docs]

Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The devcontainer should use the developer target and run as root with podman
22
# or docker with user namespaces.
3-
ARG PYTHON_VERSION=latest
3+
ARG PYTHON_VERSION=3.11
44
FROM python:${PYTHON_VERSION} AS developer
55

66
# Add any system dependencies for the developer/build environment here
@@ -14,8 +14,21 @@ COPY . /virtac/
1414
# Set up a virtual environment and put it in PATH
1515
RUN python -m venv /venv
1616
ENV PATH=/venv/bin:$PATH
17-
RUN pip install .
17+
ENV EPICS_CA_SERVER_PORT=8064
18+
ENV EPICS_CA_REPEATER_PORT=8065
1819

20+
# The build stage installs the context into the venv
21+
FROM developer AS build
22+
# Requires buildkit 0.17.0
23+
COPY --chmod=o+wrX . /workspaces/virtac
24+
WORKDIR /workspaces/virtac
25+
RUN touch dev-requirements.txt && pip install -c dev-requirements.txt .
26+
27+
# The runtime stage copies the built venv into a slim runtime container
28+
FROM python:${PYTHON_VERSION}-slim AS runtime
29+
# Add apt-get system dependecies for runtime here if needed
30+
COPY --from=build /venv/ /venv/
31+
ENV PATH=/venv/bin:$PATH
1932
ENV EPICS_CA_SERVER_PORT=8064
2033
ENV EPICS_CA_REPEATER_PORT=8065
2134

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![CI](https://github.com/DiamondLightSource/virtac/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/virtac/actions/workflows/ci.yml)
22
[![Coverage](https://codecov.io/gh/DiamondLightSource/virtac/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/virtac)
3-
[![PyPI](https://img.shields.io/pypi/v/virtac.svg)](https://pypi.org/project/virtac)
43
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
54

65
# virtac
@@ -12,10 +11,11 @@ This module contains all of the diamond specific configuration to build the diam
1211

1312
Source | <https://github.com/DiamondLightSource/virtac>
1413
:---: | :---:
15-
PyPI | `pip install virtac`
16-
Docker | `docker run ghcr.io/diamondlightsource/virtac:latest`
14+
Docker | `docker run -it --network=host ghcr.io/diamondlightsource/virtac:latest`
1715
Documentation | <https://diamondlightsource.github.io/virtac>
1816
Installation | <https://diamondlightsource.github.io/virtac/tutorials/installation>
1917
Releases | <https://github.com/DiamondLightSource/virtac/releases>
2018

2119
<!-- README only content. Anything below this line won't be included in index.md -->
20+
21+
The github pages documentation is automatically updated on pushes to the main and dev branches and also on tagged releases.

docs/conf.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
"sphinx_design",
5050
# So we can write markdown files
5151
"myst_parser",
52+
# For autodocumenting argparse based CLIs
53+
"sphinxcontrib.programoutput",
5254
]
5355

5456
# So we can use the ::: syntax
@@ -74,6 +76,8 @@
7476
("py:class", "number"),
7577
("py:class", "pythonSoftIoc.RecordWrapper"),
7678
("py:class", "pytac.lattice.Lattice"),
79+
("py:class", "pytac.element.Element"),
80+
("py:class", "CSVData"),
7781
("py:exc", "pytac.FieldException"),
7882
("py:exc", "pytac.ControlSystemException"),
7983
("py:exc", "pytac.HandleException"),
@@ -129,6 +133,8 @@
129133
# docs in the python documentation.
130134
intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}
131135

136+
intersphinx_disabled_reftypes = ["*"]
137+
132138
# A dictionary of graphviz graph attributes for inheritance diagrams.
133139
inheritance_graph_attrs = {"rankdir": "TB"}
134140

@@ -174,13 +180,7 @@
174180
},
175181
"use_edit_page_button": True,
176182
"github_url": f"https://github.com/{github_user}/{github_repo}",
177-
"icon_links": [
178-
{
179-
"name": "PyPI",
180-
"url": f"https://pypi.org/project/{project}",
181-
"icon": "fas fa-cube",
182-
}
183-
],
183+
"icon_links": [{}],
184184
"switcher": {
185185
"json_url": switcher_json,
186186
"version_match": version,

docs/how-to/update_csv_files.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Update CSV Files
2+
3+
Use the CLI to recreate the csv files. This runs create_csv.py and reads data from PVs on port 5064, so ensure you have configured your CA ports to 50XX.
4+
5+
You can run create_csv with the default arguments and the correct ringmode, eg:
6+
7+
:::{code-block} bash
8+
create_csv I04
9+
:::
10+
11+
```{program-output} create_csv -h
12+
```

docs/tutorials.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ Tutorials for installation and typical usage. New users start here.
66
:maxdepth: 1
77
:glob:
88
9-
tutorials/installation
10-
tutorials/virtac_example
9+
tutorials/*
1110
```

0 commit comments

Comments
 (0)