Skip to content

Commit 454132a

Browse files
authored
Merge pull request #26 from DiamondLightSource/copier-template
Copier template
2 parents 0c758c0 + 1c6b7ff commit 454132a

File tree

155 files changed

+1738
-2766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+1738
-2766
lines changed

.containerignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.copier-answers.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changes here will be overwritten by Copier
2+
_commit: 1.0.2-87-g16b7b0e
3+
_src_path: gh:DiamondLightSource/python-copier-template
4+
author_email: [email protected]
5+
author_name: Giles Knap
6+
component_owner: group:default/sscc
7+
description: GUI for low level control and monitoring of turbo pmac and power pmac
8+
motion controllers
9+
distribution_name: dls-pmac-control
10+
docker: true
11+
docs_type: sphinx
12+
git_platform: github.com
13+
github_org: DiamondLightSource
14+
package_name: dls_pmac_control
15+
repo_name: dls-pmac-control

.coveragerc

Lines changed: 0 additions & 9 deletions
This file was deleted.

.devcontainer.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

.devcontainer/Dockerfile

Lines changed: 0 additions & 36 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 32 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,46 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/python-3
1+
// For format details, see https://containers.dev/implementors/json_reference/
32
{
4-
"name": "Python 3",
3+
"name": "Python 3 Developer Container",
54
"build": {
6-
"dockerfile": "Dockerfile",
7-
"target": "developer",
8-
"context": "..",
9-
"args": {}
5+
"dockerfile": "../Dockerfile",
6+
"target": "developer"
107
},
118
"remoteEnv": {
9+
// Allow X11 apps to run inside the container
1210
"DISPLAY": "${localEnv:DISPLAY}"
1311
},
14-
// Set *default* container specific settings.json values on container create.
15-
"settings": {
16-
"python.defaultInterpreterPath": "/usr/local/bin/python",
17-
"python.linting.enabled": true,
18-
"python.linting.pylintEnabled": true,
19-
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
20-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
21-
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
22-
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
23-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
24-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
25-
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
26-
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
27-
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
12+
"customizations": {
13+
"vscode": {
14+
// Set *default* container specific settings.json values on container create.
15+
"settings": {
16+
"python.defaultInterpreterPath": "/venv/bin/python"
17+
},
18+
// Add the IDs of extensions you want installed when the container is created.
19+
"extensions": [
20+
"ms-python.python",
21+
"github.vscode-github-actions",
22+
"tamasfe.even-better-toml",
23+
"redhat.vscode-yaml",
24+
"ryanluker.vscode-coverage-gutters",
25+
"charliermarsh.ruff",
26+
"ms-azuretools.vscode-docker"
27+
]
28+
}
2829
},
29-
// Add the IDs of extensions you want installed when the container is created.
30-
"extensions": [
31-
"ms-python.python",
32-
"ms-python.vscode-pylance",
33-
"streetsidesoftware.code-spell-checker",
34-
"ryanluker.vscode-coverage-gutters",
35-
"mhutchie.git-graph",
36-
"eamodio.gitlens",
37-
"gruntfuggly.todo-tree",
38-
"redhat.vscode-yaml",
39-
"nsd.vscode-epics",
40-
"alefragnani.bookmarks"
41-
],
4230
"features": {
43-
//"docker-from-docker": "20.10",
44-
"git": "os-provided"
31+
// Some default things like git config
32+
"ghcr.io/devcontainers/features/common-utils:2": {
33+
"upgradePackages": false
34+
}
4535
},
46-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
47-
// "forwardPorts": [],
48-
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
49-
// "remoteUser": "vscode",
50-
// Make sure the files we are mapping into the container exist on the host
51-
"initializeCommand": "bash -c 'for i in $HOME/.inputrc $HOME/.bashrc_dev; do [ -f $i ] || touch $i; done'",
5236
"runArgs": [
53-
"--privileged",
37+
// Allow the container to access the host X11 display and EPICS CA
5438
"--net=host",
55-
"-v=${localEnv:HOME}/.ssh:/root/.ssh",
56-
"-v=${localEnv:HOME}/.bashrc_dev:/root/.bashrc",
57-
"-v=${localEnv:HOME}/.inputrc:/root/.inputrc"
58-
],
59-
"mounts": [
60-
// map in home directory - not strictly necessary but may be useful
61-
"source=${localEnv:HOME},target=${localEnv:HOME},type=bind,consistency=cached"
39+
// Make sure SELinux does not disable with access to host filesystems like tmp
40+
"--security-opt=label=disable"
6241
],
63-
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
64-
"workspaceFolder": "/workspace",
42+
// Mount the parent as /workspaces so we can pip install peers as editable
43+
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
6544
// After the container is created, install the python project in editable form
66-
// This installs into the system python of the container
67-
"postCreateCommand": "pip install $([ -f requirements_dev.txt ] && echo -r requirements_dev.txt ) -e .[dev]"
45+
"postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install"
6846
}

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Dockerfile
2+
README.md
3+
tests\**

.github/CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contribute to the project
2+
3+
Contributions and issues are most welcome! All issues and pull requests are
4+
handled through [GitHub](https://github.com/DiamondLightSource/dls-pmac-control/issues). Also, please check for any existing issues before
5+
filing a new one. If you have a great idea but it involves big changes, please
6+
file a ticket before making a pull request! We want to make sure you don't spend
7+
your time coding something that might not fit the scope of the project.
8+
9+
## Issue or Discussion?
10+
11+
Github also offers [discussions](https://github.com/DiamondLightSource/dls-pmac-control/discussions) as a place to ask questions and share ideas. If
12+
your issue is open ended and it is not obvious when it can be "closed", please
13+
raise it as a discussion instead.
14+
15+
## Code Coverage
16+
17+
While 100% code coverage does not make a library bug-free, it significantly
18+
reduces the number of easily caught bugs! Please make sure coverage remains the
19+
same or is improved by a pull request!
20+
21+
## Developer Information
22+
23+
It is recommended that developers use a [vscode devcontainer](https://code.visualstudio.com/docs/devcontainers/containers). This repository contains configuration to set up a containerized development environment that suits its own needs.
24+
25+
This project was created using the [Diamond Light Source Copier Template](https://github.com/DiamondLightSource/python-copier-template) for Python projects.
26+
The template's [Developer Guide](https://diamondlightsource.github.io/python-copier-template) contains detailed information on setting up a development environment, running the tests and what standards the code and documentation
27+
should follow.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Install requirements
2+
description: Install a version of python then call pip install and report what was installed
3+
inputs:
4+
python-version:
5+
description: Python version to install, default is from Dockerfile
6+
default: "dev"
7+
pip-install:
8+
description: Parameters to pass to pip install
9+
default: "$([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]"
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Get version of python
15+
run: |
16+
PYTHON_VERSION="${{ inputs.python-version }}"
17+
if [ $PYTHON_VERSION == "dev" ]; then
18+
PYTHON_VERSION=$(sed -n "s/ARG PYTHON_VERSION=//p" Dockerfile)
19+
fi
20+
echo "PYTHON_VERSION=$PYTHON_VERSION" >> "$GITHUB_ENV"
21+
shell: bash
22+
23+
- name: Setup python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ env.PYTHON_VERSION }}
27+
28+
- name: Install packages
29+
run: pip install ${{ inputs.pip-install }}
30+
shell: bash
31+
32+
- name: Report what was installed
33+
run: pip freeze
34+
shell: bash

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ updates:
99
directory: "/"
1010
schedule:
1111
interval: "weekly"
12+
groups:
13+
actions:
14+
patterns:
15+
- "*"
1216

1317
- package-ecosystem: "pip"
1418
directory: "/"
1519
schedule:
1620
interval: "weekly"
21+
groups:
22+
dev-dependencies:
23+
patterns:
24+
- "*"

0 commit comments

Comments
 (0)