Skip to content

Commit

Permalink
Skeleton update (#68)
Browse files Browse the repository at this point in the history
* Squash all into new skeleton base commit

* switch org to DiamondLightSource

* Bump actions/checkout from 2 to 3

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump black from 22.6.0 to 22.8.0

Bumps [black](https://github.com/psf/black) from 22.6.0 to 22.8.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@22.6.0...22.8.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix twine command

* obscure the docs cleanup email

* Made tox faster with tox-direct

* Switch to pydata-theme and split docs

There are now developer and user guides. The version switcher is native
to the theme so added a script to generate it.

* Run sdist install in container workflow

This saves another runner starting up just for this

* Update CI badges

* Update code.yml

Fixing a bug that occurs when releasing. (This is already fixed in the skeleton-cli project but failed to get copied to skeleton).

* Update .github/workflows/code.yml

Co-authored-by: Tom C (DLS) <[email protected]>

* Fix make version switcher to use the right key

Pin pydata-sphinx-theme to allow the build to complete
pydata/pydata-sphinx-theme#987

* Add sphinx autobuild

* Use PyPA action for PyPI Publish

Use the official Python Packaging Authority (PyPA) Action to publish to PyPI

* Fix password parameter

* Bump black from 22.8.0 to 22.10.0

Bumps [black](https://github.com/psf/black) from 22.8.0 to 22.10.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@22.8.0...22.10.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Sanitize ref name for docs version

Translate punctuation and unicode in branch names to _

* move requirements assests to lockfiles zip

* fix .dockerignore, build options

* add check for dirty repo when building wheel

* fix dockerignore to not dirty repo

* fix Github Release assets spec

* Improve tox-direct handling

- Environment variable no longer needs to be set
- All commands run with tox-direct by default
- All environment variables passed through

* Rely on the container less

- Moved wheel and sdist creation to the dist job
- Rely on the test matrix to run tests
- Simplified container build to make minimal for build and runtime
  and use wheel from 'dist': only publish to GHCR for tagged builds
- Create separate requirements-*.txt for each of the test matrix
- Fix actions-gh-pages version and don't run it for dependabot
- Move Dockerfile to .devcontainer and use as context to improve
  build times
- Other minor improvements and simplifications

* Mount ssh & inputrc in mounts list

* Moved config to pyproject.toml

* add version label to container registry push

* Use importlib.metadata to get package version

* Make twine check strict

* Don't check switcher if not published

- pydata-sphinx-theme 0.11 started checking switcher
- this meant you couldn't bootstrap a gh-pages build
- pydata-sphinx-theme 0.12 put in an option not to check
- but we want checking if the file exists
- so only check if we can get the json file
- and suggest user turns pages on if we can't

* Don't use flake8==6 until plugins catch up

john-hen/Flake8-pyproject#12

* Remove flake8 constraint

Also shrink dep list where intermediate
modules are covered by others

* Add agreed upon extensions to customizations

* Add common-utils to dev container features

* Link to condatiners.dev for devcontainer spec

* Remove unused matrix from linkcheck CI

* Add publish to anaconda step

* Remove conda build & publish from CI

* Stop checking switcher in docs build

* Bump softprops/action-gh-release from 0.1.14 to 0.1.15

Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 0.1.14 to 0.1.15.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](softprops/action-gh-release@1e07f43...de2c0eb)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump peaceiris/actions-gh-pages from 3.9.0 to 3.9.1

Bumps [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages) from 3.9.0 to 3.9.1.
- [Release notes](https://github.com/peaceiris/actions-gh-pages/releases)
- [Changelog](https://github.com/peaceiris/actions-gh-pages/blob/main/CHANGELOG.md)
- [Commits](peaceiris/actions-gh-pages@de7ea6f...64b46b4)

---
updated-dependencies:
- dependency-name: peaceiris/actions-gh-pages
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* simplify local container workflow

* add how to do pin requirements doc

* add local container testing docs

* Fix reference to non-existent setup.cfg file

* changed to use '[dev]' instead of [dev] in the docs

* Removed scheduled job in code.yaml and added keepalive-workflow

* Added the link to autogenerate precommit

* Made suggested changes

* Add explicit dependency on pytest

* Made changes

* Add python 3.7 support

* Include link in dev install tutorial to epics-containers devcontainer page

* Improve container build workflow

This will test the container before it is pushed to GHCR

* Changed coverage parameters

* Added vscode settings

* Slight changes to the sed command, and ensuring output is utf-8 on windows

* Remove trailing spaces and rationalise newlines

Some tools remove trailing whitespace by default on save, so may as well
correct the originals.
Ensures every file ends with an empty blank line. Again some tools do
this automatically.

* Use ruff as a linter as a replacement for flake8/isort

* Bump docker/build-push-action from 3 to 5

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](docker/build-push-action@v3...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump docker/login-action from 2 to 3

Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump docker/metadata-action from 4 to 5

Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4 to 5.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md)
- [Commits](docker/metadata-action@v4...v5)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump docker/setup-buildx-action from 2 to 3

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* (#153) Fix docs build by providing default arg

* Fixes for latest skeleton

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Tom Cobb <[email protected]>
Co-authored-by: Giles Knap <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom C (DLS) <[email protected]>
Co-authored-by: Garry O'Donnell <garry.o'[email protected]>
Co-authored-by: Giles Knap <[email protected]>
Co-authored-by: Callum Forrester <[email protected]>
Co-authored-by: tizayi <[email protected]>
Co-authored-by: AlexWells <[email protected]>
Co-authored-by: Eva Lott <[email protected]>
Co-authored-by: Joshua Appleby <[email protected]>
Co-authored-by: Tom Willemsen <[email protected]>
Co-authored-by: Dominic Oram <[email protected]>
  • Loading branch information
14 people authored Nov 29, 2023
1 parent 3e0640a commit e0c13bc
Show file tree
Hide file tree
Showing 24 changed files with 144 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
"workspaceFolder": "${localWorkspaceFolder}",
// After the container is created, install the python project in editable form
"postCreateCommand": "pip install -e '.[dev]'"
}
}
1 change: 0 additions & 1 deletion .github/actions/install_requirements/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ runs:
fi
fi
shell: bash

1 change: 1 addition & 0 deletions .github/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
<link rel="canonical" href="main/index.html">
</head>

</html>
2 changes: 1 addition & 1 deletion .github/pages/make_switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_versions(ref: str, add: Optional[str], remove: Optional[str]) -> List[st
def write_json(path: Path, repository: str, versions: str):
org, repo_name = repository.split("/")
struct = [
dict(version=version, url=f"https://{org}.github.io/{repo_name}/{version}/")
{"version": version, "url": f"https://{org}.github.io/{repo_name}/{version}/"}
for version in versions
]
text = json.dumps(struct, indent=2)
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ venv*
# further build artifacts
lockfiles/

# ruff cache
.ruff_cache/
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ repos:
entry: black --check --diff
types: [python]

- id: flake8
name: Run flake8
- id: ruff
name: Run ruff
stages: [commit]
language: system
entry: flake8
entry: ruff
types: [python]
5 changes: 3 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"ms-python.python",
"tamasfe.even-better-toml",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters"
"ryanluker.vscode-coverage-gutters",
"charliermarsh.Ruff"
]
}
}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,4 @@
// "NDPosPluginFileReader", no classes
],
},
]
]
11 changes: 7 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.flake8Enabled": false,
"python.linting.mypyEnabled": true,
"python.linting.enabled": true,
"python.testing.pytestArgs": [
Expand All @@ -13,7 +13,10 @@
"python.formatting.provider": "black",
"python.languageServer": "Pylance",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll.ruff": false,
"source.organizeImports.ruff": true
}
}
}
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"problemMatcher": [],
}
]
}
}
70 changes: 35 additions & 35 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
("py:class", "'bool'"),
("py:class", "'object'"),
("py:class", "'id'"),
("py:class", "typing.Literal"),
("py:class", "typing_extensions.Literal"),
]

# Both the class’ and the __init__ method’s docstring are concatenated and
Expand Down Expand Up @@ -98,17 +98,16 @@

# This means you can link things like `str` and `asyncio` to the relevant
# docs in the python documentation.
intersphinx_mapping = dict(python=("https://docs.python.org/3/", None))
intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}

# A dictionary of graphviz graph attributes for inheritance diagrams.
inheritance_graph_attrs = dict(rankdir="TB")
inheritance_graph_attrs = {"rankdir": "TB"}

# Common links that should be available on every page
rst_epilog = """
.. _Diamond Light Source: http://www.diamond.ac.uk
.. _black: https://github.com/psf/black
.. _flake8: https://flake8.pycqa.org/en/latest/
.. _isort: https://github.com/PyCQA/isort
.. _ruff: https://beta.ruff.rs/docs/
.. _mypy: http://mypy-lang.org/
.. _pre-commit: https://pre-commit.com/
"""
Expand Down Expand Up @@ -149,40 +148,41 @@
# Point 3 makes checking switcher difficult, because the updated skeleton
# will fix the switcher at the end of the docs workflow, but never gets a chance
# to complete as the docs build warns and fails.
html_theme_options = dict(
logo=dict(
text=project,
),
use_edit_page_button=True,
github_url=f"https://github.com/{github_user}/{github_repo}",
icon_links=[
dict(
name="PyPI",
url=f"https://pypi.org/project/{project}",
icon="fas fa-cube",
)
html_theme_options = {
"logo": {
"text": project,
},
"use_edit_page_button": True,
"github_url": f"https://github.com/{github_user}/{github_repo}",
"icon_links": [
{
"name": "PyPI",
"url": f"https://pypi.org/project/{project}",
"icon": "fas fa-cube",
}
],
switcher=dict(
json_url=switcher_json,
version_match=version,
),
check_switcher=False,
navbar_end=["theme-switcher", "icon-links", "version-switcher"],
external_links=[
dict(
name="Release Notes",
url=f"https://github.com/{github_user}/{github_repo}/releases",
)
"switcher": {
"json_url": switcher_json,
"version_match": version,
},
"check_switcher": False,
"navbar_end": ["theme-switcher", "icon-links", "version-switcher"],
"external_links": [
{
"name": "Release Notes",
"url": f"https://github.com/{github_user}/{github_repo}/releases",
}
],
)
"navigation_with_keys": False,
}

# A dictionary of values to pass into the template engine’s context for all pages
html_context = dict(
github_user=github_user,
github_repo=project,
github_version=version,
doc_path="docs",
)
html_context = {
"github_user": github_user,
"github_repo": project,
"github_version": version,
"doc_path": "docs",
}

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
html_show_sphinx = False
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/how-to/build-docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ changes in this directory too::

$ tox -e docs autobuild -- --watch src

.. _sphinx: https://www.sphinx-doc.org/
.. _sphinx: https://www.sphinx-doc.org/
14 changes: 6 additions & 8 deletions docs/developer/how-to/lint.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Run linting using pre-commit
============================

Code linting is handled by black_, flake8_ and isort_ run under pre-commit_.
Code linting is handled by black_ and ruff_ run under pre-commit_.

Running pre-commit
------------------
Expand All @@ -26,16 +26,14 @@ repository::

$ black .

Likewise with isort::
Likewise with ruff::

$ isort .
$ ruff --fix .

If you get any flake8 issues you will have to fix those manually.
Ruff may not be able to automatically fix all issues; in this case, you will have to fix those manually.

VSCode support
--------------

The ``.vscode/settings.json`` will run black and isort formatters as well as
flake8 checking on save. Issues will be highlighted in the editor window.


The ``.vscode/settings.json`` will run black formatting as well as
ruff checking on save. Issues will be highlighted in the editor window.
2 changes: 1 addition & 1 deletion docs/developer/how-to/make-release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ To make a new release, please follow this checklist:
Note that tagging and pushing to the main branch has the same effect except that
you will not get the option to edit the release notes.

.. _release: https://github.com/epics-containers/pvi/releases
.. _release: https://github.com/epics-containers/pvi/releases
5 changes: 2 additions & 3 deletions docs/developer/reference/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ Code Standards
The code in this repository conforms to standards set by the following tools:

- black_ for code formatting
- flake8_ for style checks
- isort_ for import ordering
- ruff_ for style checks
- mypy_ for static type checking

.. seealso::
Expand Down Expand Up @@ -61,4 +60,4 @@ Docs follow the underlining convention::

.. seealso::

How-to guide `../how-to/build-docs`
How-to guide `../how-to/build-docs`
2 changes: 1 addition & 1 deletion docs/developer/tutorials/dev-install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ This will run in parallel the following checks:
- `../how-to/lint`


.. _epics-containers: https://epics-containers.github.io/main/user/tutorials/devcontainer.html
.. _epics-containers: https://epics-containers.github.io/main/user/tutorials/devcontainer.html
28 changes: 12 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ requires-python = ">=3.10"
dev = [
"black",
"mypy",
"flake8-isort",
"Flake8-pyproject",
"pipdeptree",
"pre-commit",
"pydata-sphinx-theme>=0.12",
"pytest",
"pytest-cov",
"ruff",
"sphinx-autobuild",
"sphinx-copybutton",
"sphinx-design",
Expand All @@ -64,20 +63,6 @@ write_to = "src/pvi/_version.py"
[tool.mypy]
ignore_missing_imports = true # Ignore missing stubs in imported modules

[tool.isort]
float_to_top = true
profile = "black"

[tool.flake8]
extend-ignore = [
"E203", # See https://github.com/PyCQA/pycodestyle/issues/373
"F811", # support typing.overload decorator
"F722", # allow Annotated[typ, some_func("some string")]
]
max-line-length = 88 # Respect black's line length (default 88),
exclude = [".tox", "venv"]


[tool.pytest.ini_options]
# Run pytest with all our checkers, and don't spam us with massive tracebacks on error
addopts = """
Expand Down Expand Up @@ -118,3 +103,14 @@ commands =
pre-commit: pre-commit run --all-files {posargs}
docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html
"""

[tool.ruff]
src = ["src", "tests"]
line-length = 88
select = [
"C4", # flake8-comprehensions - https://beta.ruff.rs/docs/rules/#flake8-comprehensions-c4
"E", # pycodestyle errors - https://beta.ruff.rs/docs/rules/#error-e
"F", # pyflakes rules - https://beta.ruff.rs/docs/rules/#pyflakes-f
"W", # pycodestyle warnings - https://beta.ruff.rs/docs/rules/#warning-w
"I001", # isort
]
34 changes: 17 additions & 17 deletions src/pvi/_convert/_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,23 @@ class AsynString(AsynParameter):
write_widget: AWriteWidget = field(default_factory=TextWrite)


InRecordTypes = dict(
ai=AsynFloat64,
bi=AsynBinary,
longin=AsynLong,
mbbi=AsynMultiBitBinary,
stringin=AsynString,
)


OutRecordTypes = dict(
ao=AsynFloat64,
bo=AsynBinary,
busy=AsynBusy,
longout=AsynLong,
mbbo=AsynMultiBitBinary,
stringout=AsynString,
)
InRecordTypes = {
"ai": AsynFloat64,
"bi": AsynBinary,
"longin": AsynLong,
"mbbi": AsynMultiBitBinary,
"stringin": AsynString,
}


OutRecordTypes = {
"ao": AsynFloat64,
"bo": AsynBinary,
"busy": AsynBusy,
"longout": AsynLong,
"mbbo": AsynMultiBitBinary,
"stringout": AsynString,
}


@dataclass
Expand Down
Loading

0 comments on commit e0c13bc

Please sign in to comment.