Skip to content

Commit aca034f

Browse files
committed
Move to markdown and cleanup how-to guides.
1 parent d7035d8 commit aca034f

20 files changed

Lines changed: 1004 additions & 74 deletions

docs/source/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
# -- General configuration ---------------------------------------------------
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1616

17-
extensions = []
17+
extensions = [
18+
"myst_parser",
19+
"sphinx_copybutton",
20+
]
1821

1922
templates_path = ['_templates']
2023
exclude_patterns = []
2124

25+
source_suffix = ".md"
2226

2327

2428
# -- Options for HTML output -------------------------------------------------
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Explanations
2-
============
1+
# Explanations
32

43
Welcome to the explanations section.

docs/source/how-to/apptainer.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Installing Apptainer
2+
3+
Virtual accelerators are deployed as [Apptainer](https://apptainer.org/) containers.
4+
5+
Instructions for how to install and run Apptainer on different OS are available here.
6+
7+
## Linux
8+
9+
Installation instructions are available at <https://apptainer.org/docs/admin/main/installation.html#installation-on-linux>.
10+
11+
Try to first install using the [pre-build packages](https://apptainer.org/docs/admin/main/installation.html#install-from-pre-built-packages) for your Linux distribution.
12+
13+
If that doesn't work (for example if it requires root permissions which you don't have), do an [unprivileged installation](https://apptainer.org/docs/admin/main/installation.html#install-from-pre-built-packages) instead.
14+
15+
You should then be able to run Apptainer in a terminal.
16+
17+
## Windows
18+
19+
For Windows you need to install and run in [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/). Follow the instructions at <https://apptainer.org/docs/admin/main/installation.html#windows>.
20+
21+
You can then start the Ubuntu app which opens a Linux terminal where you can run Apptainer.
22+
23+
## Mac
24+
25+
For Mac you need to use Lima. Instructions are available at <https://apptainer.org/docs/admin/main/installation.html#mac> but more detailed instructions are below since some additonal steps are required.
26+
27+
For ARM-based MacOS server:
28+
29+
```
30+
brew install qemu lima
31+
32+
limactl start –rosetta –vm-type=vz –network=vzNAT template://apptainer
33+
```
34+
35+
For Intel-based MacOS server:
36+
37+
```
38+
brew install lima
39+
40+
limactl start –vm-type=vz –network=vzNAT template://apptainer
41+
```
42+
43+
To run a container you need to first do the following command before you can run Apptainer:
44+
45+
```
46+
limactl shell apptainer
47+
```
48+
49+
To stop the container you need to do:
50+
51+
```
52+
limactl stop apptainer
53+
54+
limactl delete apptainer
55+
```

docs/source/how-to/contribute.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Ways to Contribute
2+
3+
Thank you for your interest in contributing to pyAML! This document outlines how you can help, whether you're fixing bugs, adding features, improving documentation, or participating in community discussions.
4+
5+
## 1. Reporting Issues
6+
7+
- **Bugs & Feature Requests:** Open an issue on GitHub. Use clear titles and provide as much detail as possible (steps to reproduce, expected/actual behaviour, screenshots, etc.).
8+
- Use an issue template if it is applicable to you. Don't forget to assign an issue to a project and set the status of the issue to TODO.
9+
- **Before Submitting:** Check existing issues to avoid duplicates.
10+
11+
## 2. Working on Tasks
12+
13+
- **Kanban Board:** We use [GitHub Projects](https://github.com/orgs/python-accelerator-middle-layer/projects) to manage tasks. Each column represents a stage in the workflow (e.g., "To Do", "In Progress", "Review", "Done").
14+
- **Claiming a Task:** Comment and assign yourself on the issue or card to let others know you’re working on it. Move the card to "In Progress".
15+
- **Part-time Contributors:** It’s okay to work at your own pace. Just keep the community updated on your progress.
16+
17+
## 3. Submitting Changes
18+
19+
- **Fork & Branch:** Fork the repo and create a branch for your changes.
20+
21+
- **Commits:** Write clear, atomic commit messages. Reference the issue number if applicable.
22+
23+
- **Formatting:** Ensure your code adheres to the project’s style guidelines. Run tests locally before submitting. It is recommended to use `pre-commit` hooks for this purpose.
24+
Sometimes pre-commit hook will block you committing due to formatting issues. They may be fixed automatically or require manual intervention. If they are fixed automatically just re-stage the files and commit again.
25+
If manual intervention is required, please follow the instructions provided by the pre-commit tool.
26+
27+
- **Pull Requests (PRs):**
28+
- Open a PR against the `main` branch.
29+
- Include a description of your changes and reference the relevant issue.
30+
- Ensure your code follows the project’s style and passes all tests.
31+
- A maintainer will review your PR and may suggest changes.
32+
33+
## 4. Documentation
34+
35+
- **Improving Docs:** Fix typos, clarify instructions, or add missing documentation.
36+
- The documentation is located in <https://github.com/python-accelerator-middle-layer/documentation>. Submit a PR as you would for code changes.
37+
38+
## 5. Participate in the Community
39+
40+
- **Website:** Our project website is at [python-accelerator-middle-layer.github.io](https://python-accelerator-middle-layer.github.io/).
41+
There you can find information about upcoming meetings and how to join them.
42+
43+
### Community Meetings
44+
- **Schedule:** Once every few months.
45+
- **Focus:** Discuss project direction, upcoming features, and community questions.
46+
47+
### Maintainer Meetings
48+
- **Schedule:** Bi-weekly, alternating with community meetings.
49+
- **Focus:** Technical discussions, code reviews.
50+
51+
## Getting Help
52+
- **Questions?** Open a discussion on GitHub or ask in our [Matrix space](https://to.matrix.helmholtz.cloud/#/#pyaml:helmholtz.cloud).
53+
- **Need Guidance?** Reach out to a maintainer or attend a maintainer or community meeting.
54+
55+
## Recognition
56+
All contributions are valued and recognised. Significant contributions may be highlighted in release notes or on the project website.
Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,10 @@
1-
Installation
2-
==================
3-
4-
## User Installation
5-
6-
The latest release can be installed from PyPI. If you want to communicate with a control system you in addition need to install the bindings you want by specifing extras.
7-
8-
You need at least Python 3.11.
9-
10-
**Remember to always install in a virtual environment to avoid breaking your Python environment.**
11-
12-
### Installing without Control System Bindings
13-
14-
15-
For example if you just want to use the simulator.
16-
17-
```
18-
pip install accelerator-middle-layer
19-
```
20-
21-
22-
### Installing with Control System Bindings
23-
24-
Available options for installing with control system bindings are:
25-
26-
- `tango-pyaml` for the tango-pyaml bindings.
27-
- `cs-oa-epics` for `ophyd-async` bindings with both EPICS channel and PV access.
28-
- `cs-oa-tango` for `ophyd-async` bindings for TANGO.
29-
30-
Example usage:
31-
32-
```
33-
pip install accelerator-middle-layer[cs-oa-epics]
34-
```
35-
36-
## Developer Installation
1+
# Developer Installation
372

383
To do development work you need to clone the source code from GitHub and install in editable mode.
394

40-
**Note: if you are not a maintainer of the code and have write permissions to the repository you need to first fork the repository.**
5+
```{important}
6+
If you are not a maintainer of the code and have write permissions to the repository you need to first fork the repository.**
7+
```
418

429
1. Clone the repository (or your fork)
4310

@@ -66,10 +33,10 @@ To do development work you need to clone the source code from GitHub and install
6633
6734
5. Install control system bindings *(optional)*
6835
69-
If you want to use control system bindings you need to also install the package for the binding you want to use. Follow the installation instructions in the corresponding repository.
36+
If you want to use control system bindings you need to also install the packages for the bindings you want to use. Follow the installation instructions in the corresponding repository.
7037
7138
If you want to do development work on the bindings they need to be installed in editable mode, but if not you can install the latest release from PyPI.
7239
7340
6. Install dummy control system for TANGO *(optional)*
7441
75-
If you want to test the TANGO bindings without requiring a live machine or virtual accelerator you can install the dummy TANGO control system available in `tests/dummy-cs/tango`. It is a simple emulation that allows to check the interface to the control system. The control system doesn't do anything but is only intended for tests during development.
42+
If you want to test the TANGO bindings without requiring a live machine or virtual accelerator you can install the dummy TANGO control system available in `tests/dummy-cs/tango`. It is a simple emulation that allows to check the interface to the control system. The control system doesn't do anything and is only intended for tests during development.

docs/source/how-to/index.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# How-to Guides
2+
3+
Here you can find task-oriented guides organized by topic.
4+
5+
```{toctree}
6+
:maxdepth: 1
7+
:caption: Getting Started
8+
9+
python-basics
10+
```
11+
12+
```{toctree}
13+
:maxdepth: 1
14+
:caption: Installation
15+
16+
user-installation
17+
developer-installation
18+
```
19+
20+
```{toctree}
21+
:maxdepth: 1
22+
:caption: Configuration
23+
24+
```
25+
26+
```{toctree}
27+
:maxdepth: 1
28+
:caption: Virtual Accelerator
29+
30+
apptainer
31+
```
32+
33+
```{toctree}
34+
:maxdepth: 1
35+
:caption: Contributing
36+
37+
contribute
38+
release.md
39+
```

docs/source/how-to/index.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# New to Python
2+
3+
If you are a new Python user this page provides some help to get started. It also provides some advice for MATLAB users migrating to Python.
4+
5+
Python is a large ecosystem with many tools to achieve similar things so this is not intended to be a complete list. Which tool to use is often based on personal preference and the intention of this guide is only to provide a starting point for you to find you preferred setup.
6+
7+
## Integrated Development Environments
8+
9+
Python can be run directly in a terminal or an [IPython](https://ipython.org/) shell but if you want to do more complex things like debug or develop code it is easier to use an Integrated Development Environment (IDE). There are many IDEs with Python support with different features, user experience etc so the choice is highly personal. Three common ones are:
10+
11+
- **Spyder**:
12+
<https://www.spyder-ide.org/>
13+
14+
Spyder is designed for scientific computing and data analysis. It has the most MATLAB-like interface which often makes it a preferred choice among MATLAB users. It works well when using standard scientific Python packages but has currently less support for custom Python classes. It also only has basic Git integration and works best with conda environments. There is an plugin for Jupyter notebooks but it is not available for all the installation options yet.
15+
16+
- **VS Code**:
17+
<https://code.visualstudio.com/>
18+
19+
VS Code supports Python through extensions. It also has extensions for other programming languages as well as for Jupyter notebooks. It has a very good Git integration making it a good choice if you are new to using version control and prefer to not use the terminal. It also has very good support for all type of virtual environments. In addition, it has extensions to connect to remote services (such as clusters) and JupyterHub. Many HPC centers therefore provide a web-based version for their users. It however makes heavy use of keyboard shortcuts which can be a bit of a learning curve for new users.
20+
21+
- **PyCharm**:
22+
<https://www.jetbrains.com/pycharm/>
23+
24+
PyCharm is a dedicated Python IDE. It has many features and customization possibilities and is often used by software professionals. There is both a community (free) and professional (paid) edition.
25+
26+
If you are a new user getting started who doesn't know yet what you prefer, a good choice is likely to start with VS Code.
27+
28+
## Jupyter Notebooks
29+
30+
A very common way to run Python in the scientific community is to use [Jupyter notebooks](https://jupyter.org/). Is a browser-based tool which is very useful for data visualisation and interactive work. It can be installed both in a basic version **Jupyter Notebook** or as **JupyterLab** which provides some useful IDE features. It is common that tutorials will be in the form of a notebook.
31+
32+
## Installing Python
33+
34+
There are many different ways to get an installation of Python. An important aspect is that you at some point might need to be able to switch between different versions and have more than one version installed simultaneously. There are different options available for this. Here are some common ones:
35+
36+
- **pyenv**:
37+
<https://github.com/pyenv/pyenv>
38+
39+
This is the most basic choice but probably too basic for most users. There is a plugin [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv) if you also want the tool to manage virtual environments.
40+
41+
- **conda**:
42+
<https://docs.conda.io/projects/conda/en/stable/>
43+
44+
Conda is often used in the scientific community. There are several versions available and some might require a license. A good choice to avoid license issues is to choose [Miniforge](https://github.com/conda-forge/miniforge). This gives you a minimal installation of the free community edition. In addition to different Python versions, it also provides an easy way to manage and create virtual environments.
45+
46+
- **uv**:
47+
<https://docs.astral.sh/uv/>
48+
49+
Uv is a new tool which is intended as a single tool to replace the functionality of many other tools. In addition to managing Python versions and virtual environments it can also help to build packages. It however has a bit of a learning curve so is likely mostly a good choice for the experienced user who also wants to do development work.
50+
51+
## Python Packages
52+
53+
After you have installed Python you need to install packages for the code that you want to use. There are two common ways to do this:
54+
55+
- **pip**:
56+
<https://pip.pypa.io/en/stable/>
57+
58+
Pip is the standard package installer for Python. It is often automatically installed when you install Python and is easy to use. You can install from different sources as explained in the documentation [https://pip.pypa.io/en/stable/getting-started/](https://pip.pypa.io/en/stable/getting-started/).
59+
60+
- **conda**
61+
62+
If you are using conda, it also provides its own way of installing packages. You can however still use pip in conda environments in case the package is not available as a conda package. The installation is similar to when using pip <https://www.anaconda.com/docs/getting-started/working-with-conda/packages/install-packages>.
63+
64+
65+
## Virtual Environments
66+
67+
A key aspect of a good Python setup is to use virtual environments. A virtual environment is a self-contained directory which contains a Python installation for a specific version plus additional packages. The purpose is to install packages without fear of compatibility issues that might cause your entire Python setup to break. If something goes wrong, you can just delete the virtual environment and start over.
68+
69+
```{warning}
70+
You should never install Python packages in your default Python environment. It can cause big problems and especially if your computer is using an OS which relies on Python.
71+
```
72+
73+
The recommended workflow is to always create a virtual environment, activate it and then install the Python packages you need into it. There are two different versions of virtual environments:
74+
75+
- **venv**:
76+
<https://docs.python.org/3/library/venv.html>
77+
78+
This is the standard way that comes with the Python installation. It is very lightweight but can sometimes be annoying to use because you need to remember the command to activate the environment after it was created. The virtual environment is created in the current working folder so there is also no global way to manage your environments if you want an easy way to switch between environments. However, tools exist to extend the functionality such as [virtualenv](https://virtualenv.pypa.io/en/latest/) and [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/).
79+
80+
- **conda**
81+
82+
Conda can also create virtual environments. It provides and easy way to activate and switch between environments so is a good choice for new users.
83+
84+
Some IDEs has the functionality to help you create and switch between virtual environments. This works for both type of environments and can substantially simplify the workflow compared to using the terminal.
85+
86+
## Example Resources
87+
88+
There are many resources available for learning Python and also dedicated resources tailored for the scientific community. Several organisations provide free courses and material for scientists. Here are some recommendations:
89+
90+
- **The Python documentation**: <https://www.python.org/>
91+
- **Python Packaging User Guide**: <https://packaging.python.org/en/latest/>
92+
- **Scientific Python**: <https://scientific-python.org/>
93+
- **Carpentries**: <https://carpentries.org/>
94+
- **CodeRefinery**: <https://coderefinery.org/>
95+
- **Software Sustainability Institute.**: <https://www.software.ac.uk/>

docs/source/how-to/release.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Release a new version on PyPI
2+
3+
1. Create a branch for a release
4+
2. Provide a list of changes and release description in the merge request. Justify a version bump is necessary.
5+
3. Tag the corresponding version.
6+
4. Approve and merge the PR.
7+
5. CI/CD will take care of PyPi release. (Make sure the version in CI/CD deployment pipeline matches the one you just tagged.)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# User Installation
2+
3+
The latest release can be installed from PyPI. If you want to communicate with a control system you also need to install the bindings you want by specifing extras.
4+
5+
You need at least Python 3.11.
6+
7+
```{note}
8+
Remember to always install in a virtual environment to avoid breaking your Python environment.
9+
```
10+
11+
## Installing without Control System Bindings
12+
13+
This if for example if you just want to use the simulator.
14+
15+
```
16+
pip install accelerator-middle-layer
17+
```
18+
19+
20+
## Installing with Control System Bindings
21+
22+
Available options for installing with control system bindings are:
23+
24+
- `tango-pyaml` for the tango-pyaml bindings.
25+
- `cs-oa-epics` for `ophyd-async` bindings with both EPICS channel and PV access.
26+
- `cs-oa-tango` for `ophyd-async` bindings for TANGO.
27+
28+
Example usage:
29+
30+
```
31+
pip install accelerator-middle-layer[cs-oa-epics]
32+
```
33+
34+

0 commit comments

Comments
 (0)