Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 570-make-table-subcla…
Browse files Browse the repository at this point in the history
…ss-enums-be-sequence-enum-rather-than-numpy-string
  • Loading branch information
coretl committed Sep 20, 2024
2 parents 806cc49 + 1007da7 commit 0f1c4a0
Show file tree
Hide file tree
Showing 117 changed files with 1,014 additions and 954 deletions.
3 changes: 1 addition & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Changes here will be overwritten by Copier
_commit: 2.1.0
_commit: 2.3.0
_src_path: gh:DiamondLightSource/python-copier-template
author_email: [email protected]
author_name: Tom Cobb
component_owner: ''
description: Asynchronous Bluesky hardware abstraction code, compatible with control
systems like EPICS and Tango
distribution_name: ophyd-async
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
// After the container is created, install the python project in editable form
"postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install"
}
}
2 changes: 1 addition & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
# Use isort to sort imports
881a35b43584103ca572b6f4e472dd8b6fd6ea87
# Replace flake8 and mypy with ruff and pyrite
e2f8317e7584e4de788c2b39e5b5edaa98c1bc9e
e2f8317e7584e4de788c2b39e5b5edaa98c1bc9e
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ It is recommended that developers use a [vscode devcontainer](https://code.visua

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

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/2.1.0/how-to.html).
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/2.3.0/how-to.html).
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Bug Report
about: The template to use for reporting bugs and usability issues
title: " "
labels: 'bug'
assignees: ''

---

Describe the bug, including a clear and concise description of the expected behavior, the actual behavior and the context in which you encountered it (ideally include details of your environment).

## Steps To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error


## Acceptance Criteria
- Specific criteria that will be used to judge if the issue is fixed
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Issue
about: The standard template to use for feature requests, design discussions and tasks
title: " "
labels: ''
assignees: ''

---

A brief description of the issue, including specific stakeholders and the business case where appropriate

## Acceptance Criteria
- Specific criteria that will be used to judge if the issue is fixed
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Fixes #ISSUE

### Instructions to reviewer on how to test:
1. Do thing x
2. Confirm thing y happens

### Checks for reviewer
- [ ] Would the PR title make sense to a user on a set of release notes
2 changes: 1 addition & 1 deletion .github/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
<link rel="canonical" href="main/index.html">
</head>

</html>
</html>
25 changes: 13 additions & 12 deletions .github/pages/make_switcher.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
"""Make switcher.json to allow docs to switch between different versions."""

import json
import logging
from argparse import ArgumentParser
from pathlib import Path
from subprocess import CalledProcessError, check_output
from typing import List, Optional


def report_output(stdout: bytes, label: str) -> List[str]:
def report_output(stdout: bytes, label: str) -> list[str]:
"""Print and return something received frm stdout."""
ret = stdout.decode().strip().split("\n")
print(f"{label}: {ret}")
return ret


def get_branch_contents(ref: str) -> List[str]:
def get_branch_contents(ref: str) -> list[str]:
"""Get the list of directories in a branch."""
stdout = check_output(["git", "ls-tree", "-d", "--name-only", ref])
return report_output(stdout, "Branch contents")


def get_sorted_tags_list() -> List[str]:
def get_sorted_tags_list() -> list[str]:
"""Get a list of sorted tags in descending order from the repository."""
stdout = check_output(["git", "tag", "-l", "--sort=-v:refname"])
return report_output(stdout, "Tags list")


def get_versions(ref: str, add: Optional[str]) -> List[str]:
def get_versions(ref: str, add: str | None) -> list[str]:
"""Generate the file containing the list of all GitHub Pages builds."""
# Get the directories (i.e. builds) from the GitHub Pages branch
try:
Expand All @@ -41,7 +43,7 @@ def get_versions(ref: str, add: Optional[str]) -> List[str]:
tags = get_sorted_tags_list()

# Make the sorted versions list from main branches and tags
versions: List[str] = []
versions: list[str] = []
for version in ["master", "main"] + tags:
if version in builds:
versions.append(version)
Expand All @@ -53,21 +55,20 @@ def get_versions(ref: str, add: Optional[str]) -> List[str]:
return versions


def write_json(path: Path, repository: str, versions: str):
def write_json(path: Path, repository: str, versions: list[str]):
"""Write the JSON switcher to path."""
org, repo_name = repository.split("/")
pages_url = f"https://{org}.github.io"
if repo_name != f"{org}.github.io":
# Only add the repo name if it isn't the source for the org pages site
pages_url += f"/{repo_name}"
struct = [
{"version": version, "url": f"{pages_url}/{version}/"} for version in versions
{"version": version, "url": f"https://{org}.github.io/{repo_name}/{version}/"}
for version in versions
]
text = json.dumps(struct, indent=2)
print(f"JSON switcher:\n{text}")
path.write_text(text, encoding="utf-8")


def main(args=None):
"""Parse args and write switcher."""
parser = ArgumentParser(
description="Make a versions.json file from gh-pages directories"
)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .github/pages
keep_files: true
keep_files: true
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ jobs:
needs: check
if: needs.check.outputs.branch-pr == ''
uses: ./.github/workflows/_dist.yml

pypi:
if: github.ref_type == 'tag'
needs: dist
uses: ./.github/workflows/_pypi.yml
permissions:
id-token: write

release:
if: github.ref_type == 'tag'
needs: [dist, docs]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ cov.xml

# Sphinx documentation
docs/_build/
docs/_api

# PyBuilder
target/
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ repos:
- id: check-added-large-files
- id: check-yaml
- id: check-merge-conflict
- id: end-of-file-fixer

- repo: local
hooks:
Expand Down
16 changes: 16 additions & 0 deletions docs/_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
:orphan:

..
This page is not included in the TOC tree, but must exist so that the
autosummary pages are generated for ophyd_async and all its
subpackages
API
===

.. autosummary::
:toctree: _api
:template: custom-module-template.rst
:recursive:

ophyd_async
1 change: 0 additions & 1 deletion docs/_templates/README

This file was deleted.

40 changes: 0 additions & 40 deletions docs/_templates/custom-class-template.rst

This file was deleted.

102 changes: 36 additions & 66 deletions docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -1,72 +1,42 @@
.. note::

Ophyd async is included on a provisional basis until the v1.0 release and
Ophyd async is considered experimental until the v1.0 release and
may change API on minor release numbers before then

{{ fullname | escape | underline}}
{{ ('``' + fullname + '``') | underline }}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: Module attributes

.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
:nosignatures:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:template: custom-class-template.rst
:nosignatures:
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree:
:nosignatures:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- set filtered_members = [] %}
{%- for item in members %}
{%- if item in functions + classes + exceptions + attributes %}
{% set _ = filtered_members.append(item) %}
{%- endif %}
{%- endfor %}
{% endif %}
{% endblock %}

.. automodule:: {{ fullname }}
:members:

{% block modules %}
{% if modules %}
.. rubric:: Submodules

.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block members %}
{% if filtered_members %}
.. rubric:: Members

.. autosummary::
:nosignatures:
{% for item in filtered_members %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
Loading

0 comments on commit 0f1c4a0

Please sign in to comment.