Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…pip-skeleton into skeleton-update
  • Loading branch information
GDYendell committed Nov 27, 2023
2 parents f5dec71 + 6f588b9 commit c19e345
Show file tree
Hide file tree
Showing 20 changed files with 102 additions and 99 deletions.
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

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>
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
20 changes: 10 additions & 10 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install python packages
uses: ./.github/actions/install_requirements
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Need this to get version number from last tag
fetch-depth: 0
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Need this to get version number from last tag
fetch-depth: 0
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# image names must be all lower case
- name: Generate image repo name
Expand All @@ -133,18 +133,18 @@ jobs:

- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build and export to Docker local cache
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
# Note build-args, context, file, and target must all match between this
# step and the later build-push-action, otherwise the second build-push-action
Expand All @@ -167,7 +167,7 @@ jobs:

- name: Create tags for publishing image
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_REPOSITORY }}
tags: |
Expand All @@ -179,8 +179,8 @@ jobs:

- name: Push cached image to container registry
if: github.ref_type == 'tag' # || github.ref_name == 'main'
uses: docker/build-push-action@v3
# This does not build the image again, it will find the image in the
uses: docker/build-push-action@v5
# This does not build the image again, it will find the image in the
# Docker cache and publish it
with:
# Note build-args, context, file, and target must all match between this
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: sleep 60

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Need this to get version number from last tag
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs_clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: gh-pages

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install python packages
uses: ./.github/actions/install_requirements
Expand All @@ -24,4 +24,4 @@ jobs:
run: tox -e docs build -- -b linkcheck

- name: Keepalive Workflow
uses: gautamkrishnar/keepalive-workflow@v1
uses: gautamkrishnar/keepalive-workflow@v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,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 @@ -22,4 +22,4 @@
},
}
]
}
}
15 changes: 11 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.flake8Enabled": false,
"python.linting.mypyEnabled": true,
"python.linting.enabled": true,
"python.testing.pytestArgs": ["--cov=python3_pip_skeleton", "--cov-report", "xml:cov.xml"],
"python.testing.pytestArgs": [
"--cov=python3_pip_skeleton",
"--cov-report",
"xml:cov.xml"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"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": [],
}
]
}
}
74 changes: 37 additions & 37 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,19 @@

# 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),
numpy=("https://numpy.org/doc/stable/", None),
)
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable/", 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 @@ -159,40 +158,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/DiamondLightSource/FastCS/releases
.. _release: https://github.com/DiamondLightSource/FastCS/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`
10 changes: 5 additions & 5 deletions docs/developer/tutorials/dev-install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ requires python 3.8 or later) or to run in a container under `VSCode
$ code FastCS
# Click on 'Reopen in Container' when prompted
# Open a new terminal
.. note::
See the epics-containers_ documentation for more complex
.. note::

See the epics-containers_ documentation for more complex
use cases, such as integration with podman.

See what was installed
Expand All @@ -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
Loading

0 comments on commit c19e345

Please sign in to comment.