Skip to content

Commit

Permalink
Update to copier template 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GDYendell committed Sep 17, 2024
1 parent 42ee5ae commit 0e71713
Show file tree
Hide file tree
Showing 19 changed files with 206 additions and 59 deletions.
10 changes: 6 additions & 4 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Changes here will be overwritten by Copier
_commit: 2.1.0-40-g9e70b8b
_commit: 2.3.0
_src_path: gh:DiamondLightSource/python-copier-template
author_email: [email protected]
author_name: Gary Yendell
component_lifecycle: experimental
component_owner: user:mef65357
component_type: service
description: Eiger control system integration with FastCS
distribution_name: eiger-fastcs
distribution_name: fastcs-eiger
docker: true
docs_type: sphinx
git_platform: github.com
github_org: DiamondLightSource
package_name: eiger_fastcs
package_name: fastcs_eiger
pypi: true
repo_name: eiger-fastcs
repo_name: fastcs-eiger
type_checker: mypy
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contribute to the project

Contributions and issues are most welcome! All issues and pull requests are
handled through [GitHub](https://github.com/DiamondLightSource/eiger-fastcs/issues). Also, please check for any existing issues before
handled through [GitHub](https://github.com/DiamondLightSource/fastcs-eiger/issues). Also, please check for any existing issues before
filing a new one. If you have a great idea but it involves big changes, please
file a ticket before making a pull request! We want to make sure you don't spend
your time coding something that might not fit the scope of the project.

## Issue or Discussion?

Github also offers [discussions](https://github.com/DiamondLightSource/eiger-fastcs/discussions) as a place to ask questions and share ideas. If
Github also offers [discussions](https://github.com/DiamondLightSource/fastcs-eiger/discussions) as a place to ask questions and share ideas. If
your issue is open ended and it is not obvious when it can be "closed", please
raise it as a discussion instead.

Expand All @@ -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).
14 changes: 8 additions & 6 deletions .github/pages/make_switcher.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Make switcher.json to allow docs to switch between different versions."""

import json
import logging
from argparse import ArgumentParser
Expand All @@ -6,6 +8,7 @@


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
Expand Down Expand Up @@ -52,21 +55,20 @@ def get_versions(ref: str, add: str | None) -> 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
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ RUN mkdir -p /epics/opi
WORKDIR /epics/opi

# change this entrypoint if it is not the same as the repo
ENTRYPOINT ["eiger-fastcs"]
ENTRYPOINT ["fastcs-eiger"]
CMD ["--version"]
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[![CI](https://github.com/DiamondLightSource/eiger-fastcs/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/eiger-fastcs/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/DiamondLightSource/eiger-fastcs/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/eiger-fastcs)
[![PyPI](https://img.shields.io/pypi/v/eiger-fastcs.svg)](https://pypi.org/project/eiger-fastcs)
[![CI](https://github.com/DiamondLightSource/fastcs-eiger/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/fastcs-eiger/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/DiamondLightSource/fastcs-eiger/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/fastcs-eiger)
[![PyPI](https://img.shields.io/pypi/v/fastcs-eiger.svg)](https://pypi.org/project/fastcs-eiger)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# Eiger FastCS
# FastCS Eiger

Control system integration for Dectris Eiger detectors using FastCS.

Expand All @@ -23,14 +23,13 @@ Control system integration for Dectris Eiger detectors using FastCS.

ii. `podman run --rm -it -v /tmp/opi:/epics/opi --net=host ghcr.io/DiamondLightSource/eiger-fastcs:latest`

Source | <https://github.com/DiamondLightSource/eiger-fastcs>
Source | <https://github.com/DiamondLightSource/fastcs-eiger>
:---: | :---:
PyPI | `pip install eiger-fastcs`
Docker | `docker run ghcr.io/diamondlightsource/eiger-fastcs:latest`
Documentation | <https://diamondlightsource.github.io/eiger-fastcs>
Releases | <https://github.com/DiamondLightSource/eiger-fastcs/releases>

PyPI | `pip install fastcs-eiger`
Docker | `docker run ghcr.io/diamondlightsource/fastcs-eiger:latest`
Documentation | <https://diamondlightsource.github.io/fastcs-eiger>
Releases | <https://github.com/DiamondLightSource/fastcs-eiger/releases>

<!-- README only content. Anything below this line won't be included in index.md -->

See https://diamondlightsource.github.io/eiger-fastcs for more detailed documentation.
See https://diamondlightsource.github.io/fastcs-eiger for more detailed documentation.
6 changes: 3 additions & 3 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: eiger-fastcs
title: eiger-fastcs
name: fastcs-eiger
title: fastcs-eiger
description: Eiger control system integration with FastCS
spec:
type: documentation
type: service
lifecycle: experimental
owner: user:mef65357
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 fastcs_eiger and all its
subpackages
API
===

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

fastcs_eiger
37 changes: 37 additions & 0 deletions docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{ ('``' + fullname + '``') | underline }}

{%- set filtered_members = [] %}
{%- for item in members %}
{%- if item in functions + classes + exceptions + attributes %}
{% set _ = filtered_members.append(item) %}
{%- endif %}
{%- endfor %}

.. 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 %}
27 changes: 18 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
"""Configuration file for the Sphinx documentation builder.
This file only contains a selection of the most common options. For a full
list see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
"""

import sys
from pathlib import Path
from subprocess import check_output

import requests

import eiger_fastcs
import fastcs_eiger

# -- General configuration ------------------------------------------------

# General information about the project.
project = "eiger-fastcs"
project = "fastcs-eiger"

# The full version, including alpha/beta/rc tags.
release = eiger_fastcs.__version__
release = fastcs_eiger.__version__

# The short X.Y version.
if "+" in release:
Expand All @@ -32,6 +33,8 @@
extensions = [
# Use this for generating API docs
"sphinx.ext.autodoc",
# and making summary tables at the top of API docs
"sphinx.ext.autosummary",
# This can parse google style docstrings
"sphinx.ext.napoleon",
# For linking to external sphinx documentation
Expand Down Expand Up @@ -80,6 +83,12 @@
# Don't inherit docstrings from baseclasses
autodoc_inherit_docstrings = False

# Document only what is in __all__
autosummary_ignore_module_all = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# Output graphviz directive produced images in a scalable format
graphviz_output_format = "svg"

Expand Down Expand Up @@ -119,7 +128,7 @@
# a list of builtin themes.
#
html_theme = "pydata_sphinx_theme"
github_repo = "eiger-fastcs"
github_repo = "fastcs-eiger"
github_user = "DiamondLightSource"
switcher_json = f"https://{github_user}.github.io/{github_repo}/switcher.json"
switcher_exists = requests.get(switcher_json).ok
Expand Down
6 changes: 3 additions & 3 deletions docs/how-to/run-container.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Run in a container

Pre-built containers with eiger-fastcs and its dependencies already
installed are available on [Github Container Registry](https://ghcr.io/DiamondLightSource/eiger-fastcs).
Pre-built containers with fastcs-eiger and its dependencies already
installed are available on [Github Container Registry](https://ghcr.io/DiamondLightSource/fastcs-eiger).

## Starting the container

To pull the container from github container registry and run:

```
$ docker run ghcr.io/diamondlightsource/eiger-fastcs:latest --version
$ docker run ghcr.io/diamondlightsource/fastcs-eiger:latest --version
```

To get a released version, use a numbered release instead of `latest`.
4 changes: 2 additions & 2 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Technical reference material including APIs and release notes.
:maxdepth: 1
:glob:
reference/*
API <_api/fastcs_eiger>
genindex
Release Notes <https://github.com/DiamondLightSource/eiger-fastcs/releases>
Release Notes <https://github.com/DiamondLightSource/fastcs-eiger/releases>
```
6 changes: 3 additions & 3 deletions docs/tutorials/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ $ source /path/to/venv/bin/activate
You can now use `pip` to install the library and its dependencies:

```
$ python3 -m pip install eiger-fastcs
$ python3 -m pip install fastcs-eiger
```

If you require a feature that is not currently released you can also install
from github:

```
$ python3 -m pip install git+https://github.com/DiamondLightSource/eiger-fastcs.git
$ python3 -m pip install git+https://github.com/DiamondLightSource/fastcs-eiger.git
```

The library should now be installed and the commandline interface on your path.
You can check the version that has been installed by typing:

```
$ eiger-fastcs --version
$ fastcs-eiger --version
```
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=64", "setuptools_scm[toml]>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "eiger-fastcs"
name = "fastcs-eiger"
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: Apache Software License",
Expand Down Expand Up @@ -45,17 +45,18 @@ dev = [
]

[project.scripts]
eiger-fastcs = "eiger_fastcs.__main__:app"
fastcs-eiger = "fastcs_eiger.__main__:main"

[project.urls]
GitHub = "https://github.com/DiamondLightSource/eiger-fastcs"
GitHub = "https://github.com/DiamondLightSource/fastcs-eiger"

[[project.authors]] # Further authors may be added by duplicating this section
email = "[email protected]"
name = "Gary Yendell"


[tool.setuptools_scm]
version_file = "src/eiger_fastcs/_version.py"
version_file = "src/fastcs_eiger/_version.py"

[tool.mypy]
ignore_missing_imports = true # Ignore missing stubs in imported modules
Expand All @@ -71,7 +72,7 @@ filterwarnings = "error"
testpaths = "docs src tests"

[tool.coverage.run]
data_file = "/tmp/eiger_fastcs.coverage"
data_file = "/tmp/fastcs_eiger.coverage"

[tool.coverage.paths]
# Tests are run from installed location, map back to the src directory
Expand All @@ -97,7 +98,7 @@ allowlist_externals =
commands =
pre-commit: pre-commit run --all-files --show-diff-on-failure {posargs}
type-checking: mypy src tests {posargs}
tests: pytest --cov=eiger_fastcs --cov-report term --cov-report xml:cov.xml {posargs}
tests: pytest --cov=fastcs_eiger --cov-report term --cov-report xml:cov.xml {posargs}
docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html
"""

Expand Down
Loading

0 comments on commit 0e71713

Please sign in to comment.