Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skeletonified client #61

Merged
merged 77 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
ededf00
Initial structure
coretl Jan 7, 2022
de6d5f1
Squash all into new skeleton base commit
coretl Feb 7, 2022
52a0239
switch org to DiamondLightSource
gilesknap Sep 2, 2022
13da301
Bump actions/checkout from 2 to 3
dependabot[bot] Sep 2, 2022
0f37bbc
Bump black from 22.6.0 to 22.8.0
dependabot[bot] Sep 2, 2022
9e16fc2
fix twine command
gilesknap Sep 2, 2022
c975f6d
obscure the docs cleanup email
gilesknap Sep 2, 2022
10e2396
Made tox faster with tox-direct
coretl Sep 9, 2022
d7a937a
Switch to pydata-theme and split docs
coretl Sep 9, 2022
4d21bc3
Run sdist install in container workflow
coretl Sep 13, 2022
5203856
Update CI badges
GDYendell Sep 13, 2022
d96f15a
Update code.yml
gilesknap Oct 3, 2022
68976f4
Update .github/workflows/code.yml
gilesknap Oct 4, 2022
92f10b4
Fix make version switcher to use the right key
coretl Oct 14, 2022
d35ffdb
Add sphinx autobuild
coretl Oct 14, 2022
7c11165
Use PyPA action for PyPI Publish
garryod Oct 5, 2022
1acb1d4
Fix password parameter
garryod Oct 5, 2022
5ff0a30
Bump black from 22.8.0 to 22.10.0
dependabot[bot] Oct 10, 2022
323424f
Sanitize ref name for docs version
coretl Oct 14, 2022
964446a
move requirements assests to lockfiles zip
gilesknap Oct 18, 2022
b0426ce
fix .dockerignore, build options
gilesknap Oct 18, 2022
a8d55dd
add check for dirty repo when building wheel
gilesknap Nov 1, 2022
081e205
fix dockerignore to not dirty repo
gilesknap Nov 1, 2022
9da307f
fix Github Release assets spec
gilesknap Nov 2, 2022
dd95a77
Improve tox-direct handling
coretl Nov 4, 2022
4ccb601
Rely on the container less
gilesknap Nov 8, 2022
fa99c26
Mount ssh & inputrc in mounts list
garryod Nov 14, 2022
c5f583f
Moved config to pyproject.toml
garryod Nov 11, 2022
a08124f
add version label to container registry push
gilesknap Nov 17, 2022
d97fd67
Use importlib.metadata to get package version
garryod Nov 11, 2022
7383739
Make twine check strict
garryod Nov 17, 2022
15a1d44
Don't check switcher if not published
coretl Nov 24, 2022
6f0604b
Don't use flake8==6 until plugins catch up
coretl Nov 25, 2022
7a68885
Remove flake8 constraint
coretl Nov 28, 2022
d4633ab
Add agreed upon extensions to customizations
garryod Nov 18, 2022
f916925
Add common-utils to dev container features
garryod Nov 25, 2022
4981421
Link to condatiners.dev for devcontainer spec
garryod Dec 2, 2022
7300883
Remove unused matrix from linkcheck CI
garryod Dec 7, 2022
f67ddd4
Add publish to anaconda step
garryod Nov 30, 2022
e2e7d86
Remove conda build & publish from CI
garryod Dec 20, 2022
8eb1194
Stop checking switcher in docs build
callumforrester Jan 5, 2023
0f6456e
Bump softprops/action-gh-release from 0.1.14 to 0.1.15
dependabot[bot] Dec 12, 2022
b9bf30b
Bump peaceiris/actions-gh-pages from 3.9.0 to 3.9.1
dependabot[bot] Jan 9, 2023
db76a31
simplify local container workflow
tizayi Jan 9, 2023
db2f8e3
add how to do pin requirements doc
gilesknap Jan 18, 2023
dace85f
add local container testing docs
gilesknap Jan 19, 2023
c4a3e7c
Fix reference to non-existent setup.cfg file
AlexanderWells-diamond Jan 25, 2023
ea63670
changed to use '[dev]' instead of [dev] in the docs
evalott100 Jan 27, 2023
bfe204a
Removed scheduled job in code.yaml and added keepalive-workflow
evalott100 Jan 27, 2023
2fd923e
Added the link to autogenerate precommit
evalott100 Feb 6, 2023
913fd74
Made suggested changes
evalott100 Jan 20, 2023
9e4055e
Add explicit dependency on pytest
AlexanderWells-diamond Mar 2, 2023
d5ab1fb
Made changes
evalott100 Mar 24, 2023
9cd9532
Add python 3.7 support
JoshuaAppleby Apr 4, 2023
64d2a03
Include link in dev install tutorial to epics-containers devcontainer…
callumforrester Apr 18, 2023
8d283aa
Improve container build workflow
AlexanderWells-diamond May 30, 2023
c68c75e
Changed coverage parameters
evalott100 Jun 2, 2023
f02b12e
Added vscode settings
evalott100 Jun 5, 2023
3415f1c
Slight changes to the sed command, and ensuring output is utf-8 on wi…
evalott100 Jun 20, 2023
5536081
Remove trailing spaces and rationalise newlines
AlexanderWells-diamond Sep 1, 2023
e150491
Use ruff as a linter as a replacement for flake8/isort
Sep 12, 2023
2e53832
Bump docker/build-push-action from 3 to 5
dependabot[bot] Oct 2, 2023
239f39f
Bump actions/checkout from 3 to 4
dependabot[bot] Oct 2, 2023
dfe03c2
Bump docker/login-action from 2 to 3
dependabot[bot] Oct 2, 2023
4de663b
Bump docker/metadata-action from 4 to 5
dependabot[bot] Oct 2, 2023
357e927
Bump docker/setup-buildx-action from 2 to 3
dependabot[bot] Oct 2, 2023
834445f
Rename python3-pip-skeleton -> pandablocks
evalott100 Oct 17, 2023
1985bf7
Merge branch 'skeleton-merge-branch'
evalott100 Oct 17, 2023
18d094c
Moved files to match structure of the skeleton. Moved setup.cfg and P…
evalott100 Oct 17, 2023
8c65af3
Fixed tests
evalott100 Oct 17, 2023
5a3ce72
Made ruff and mypy complient, moved 'examples' into src/pandablocks
evalott100 Oct 17, 2023
7339b85
restored old __main__
evalott100 Oct 18, 2023
77a87f3
Restructured docs
evalott100 Oct 18, 2023
f0fc5d1
Deleted unnecessary files
evalott100 Oct 18, 2023
7e74ba6
Changed logo back to panda
evalott100 Oct 19, 2023
9193249
Cleaned up after conversion
evalott100 Oct 19, 2023
ddb7b01
Trying to get coverage working on 3.7
evalott100 Oct 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// For format details, see https://containers.dev/implementors/json_reference/
{
"name": "Python 3 Developer Container",
"build": {
"dockerfile": "../Dockerfile",
"target": "build",
// Only upgrade pip, we will install the project below
"args": {
"PIP_OPTIONS": "--upgrade pip"
}
},
"remoteEnv": {
"DISPLAY": "${localEnv:DISPLAY}"
},
// Add the URLs of features you want added when the container is built.
"features": {
"ghcr.io/devcontainers/features/common-utils:1": {
"username": "none",
"upgradePackages": false
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/venv/bin/python"
},
"customizations": {
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"tamasfe.even-better-toml",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters"
]
}
},
// Make sure the files we are mapping into the container exist on the host
"initializeCommand": "bash -c 'for i in $HOME/.inputrc; do [ -f $i ] || touch $i; done'",
"runArgs": [
"--net=host",
"--security-opt=label=type:container_runtime_t"
],
"mounts": [
"source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind",
"source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind",
// map in home directory - not strictly necessary but useful
"source=${localEnv:HOME},target=${localEnv:HOME},type=bind,consistency=cached"
],
// make the workspace folder the same inside and outside of the container
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
"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 .gitattributes

This file was deleted.

57 changes: 57 additions & 0 deletions .github/actions/install_requirements/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Install requirements
description: Run pip install with requirements and upload resulting requirements
inputs:
requirements_file:
description: Name of requirements file to use and upload
required: true
install_options:
description: Parameters to pass to pip install
required: true
python_version:
description: Python version to install
default: "3.x"

runs:
using: composite

steps:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}

- name: Pip install
run: |
touch ${{ inputs.requirements_file }}
# -c uses requirements.txt as constraints, see 'Validate requirements file'
pip install -c ${{ inputs.requirements_file }} ${{ inputs.install_options }}
shell: bash

- name: Create lockfile
run: |
mkdir -p lockfiles
pip freeze --exclude-editable > lockfiles/${{ inputs.requirements_file }}
# delete the self referencing line and make sure it isn't blank
sed -i'' -e '/file:/d' lockfiles/${{ inputs.requirements_file }}
shell: bash

- name: Upload lockfiles
uses: actions/upload-artifact@v3
with:
name: lockfiles
path: lockfiles

# This eliminates the class of problems where the requirements being given no
# longer match what the packages themselves dictate. E.g. In the rare instance
# where I install some-package which used to depend on vulnerable-dependency
# but now uses good-dependency (despite being nominally the same version)
# pip will install both if given a requirements file with -r
- name: If requirements file exists, check it matches pip installed packages
run: |
if [ -s ${{ inputs.requirements_file }} ]; then
if ! diff -u ${{ inputs.requirements_file }} lockfiles/${{ inputs.requirements_file }}; then
echo "Error: ${{ inputs.requirements_file }} need the above changes to be exhaustive"
exit 1
fi
fi
shell: bash
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
<meta http-equiv="refresh" content="0; url=./master/index.html">
<link rel="canonical" href="master/index.html">
</head>
</html>
</html>
99 changes: 99 additions & 0 deletions .github/pages/make_switcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
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]:
ret = stdout.decode().strip().split("\n")
print(f"{label}: {ret}")
return ret


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]:
"""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], remove: Optional[str]) -> 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:
builds = set(get_branch_contents(ref))
except CalledProcessError:
builds = set()
logging.warning(f"Cannot get {ref} contents")

# Add and remove from the list of builds
if add:
builds.add(add)
if remove:
assert remove in builds, f"Build '{remove}' not in {sorted(builds)}"
builds.remove(remove)

# Get a sorted list of tags
tags = get_sorted_tags_list()

# Make the sorted versions list from main branches and tags
versions: List[str] = []
for version in ["master", "main"] + tags:
if version in builds:
versions.append(version)
builds.remove(version)

# Add in anything that is left to the bottom
versions += sorted(builds)
print(f"Sorted versions: {versions}")
return versions


def write_json(path: Path, repository: str, versions: str):
org, repo_name = repository.split("/")
struct = [
{"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):
parser = ArgumentParser(
description="Make a versions.txt file from gh-pages directories"
)
parser.add_argument(
"--add",
help="Add this directory to the list of existing directories",
)
parser.add_argument(
"--remove",
help="Remove this directory from the list of existing directories",
)
parser.add_argument(
"repository",
help="The GitHub org and repository name: ORG/REPO",
)
parser.add_argument(
"output",
type=Path,
help="Path of write switcher.json to",
)
args = parser.parse_args(args)

# Write the versions file
versions = get_versions("origin/gh-pages", args.add, args.remove)
write_json(args.output, args.repository, versions)


if __name__ == "__main__":
main()
Loading
Loading