-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
378 Convert source tree to python-copier-template (#667)
* (#378) Initial changes for copier template v1.0.0 * (#378) More sensible pre-commit defaults. Fix some broken unit tests * (#378) unit tests mostly working * Add Pycharm project files to .gitignore * (#378) Update to version v2.1.0 of copier template from v1.0.0 * (#378) minor fixes to documentation generation * (#378) Enable pypi publishing * (#378) Update software catalog info * (#378) Rebase onto latest main * (#378) Use diff-quality rather than pyright, make pyright, ruff happy * (#378) Make ruff happy, and code less evil. Add diff-cover to dependencies * (#378) Fix test failures due to missing decorator parentheses. Add missing pyright plugin to dependencies * (#378) Set fetch-depth to 0 for diff-quality * (#378) Fix dist CI * (#378) fix tests, ruff after rebase against main * (#378) Add warning suppression to unit tests for pydantic v2
- Loading branch information
Showing
145 changed files
with
1,725 additions
and
1,295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Changes here will be overwritten by Copier | ||
_commit: 2.1.0 | ||
_src_path: gh:DiamondLightSource/python-copier-template | ||
author_email: [email protected] | ||
author_name: Dominic Oram | ||
component_owner: group:data-acquisition | ||
description: Ophyd devices and other utils that could be used across DLS beamlines | ||
distribution_name: dls-dodal | ||
docker: false | ||
docs_type: sphinx | ||
git_platform: github.com | ||
github_org: DiamondLightSource | ||
package_name: dodal | ||
pypi: true | ||
repo_name: dodal | ||
type_checker: pyright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Contribute to the project | ||
|
||
Contributions and issues are most welcome! All issues and pull requests are | ||
handled through [GitHub](https://github.com/DiamondLightSource/dodal/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/dodal/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. | ||
|
||
## Code Coverage | ||
|
||
While 100% code coverage does not make a library bug-free, it significantly | ||
reduces the number of easily caught bugs! Please make sure coverage remains the | ||
same or is improved by a pull request! | ||
|
||
## Developer Information | ||
|
||
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. | ||
|
||
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). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,34 @@ | ||
name: Install requirements | ||
description: Run pip install with requirements and upload resulting requirements | ||
description: Install a version of python then call pip install and report what was installed | ||
inputs: | ||
requirements_file: | ||
description: Name of requirements file to use and upload | ||
required: true | ||
install_options: | ||
python-version: | ||
description: Python version to install, default is from Dockerfile | ||
default: "dev" | ||
pip-install: | ||
description: Parameters to pass to pip install | ||
required: true | ||
artifact_name: | ||
description: A user friendly name to give the produced artifacts | ||
required: true | ||
python_version: | ||
description: Python version to install | ||
default: "3.x" | ||
default: "$([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]" | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Get version of python | ||
run: | | ||
PYTHON_VERSION="${{ inputs.python-version }}" | ||
if [ $PYTHON_VERSION == "dev" ]; then | ||
PYTHON_VERSION=$(sed -n "s/ARG PYTHON_VERSION=//p" Dockerfile) | ||
fi | ||
echo "PYTHON_VERSION=$PYTHON_VERSION" >> "$GITHUB_ENV" | ||
shell: bash | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python_version }} | ||
python-version: ${{ env.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 }} | ||
- name: Install packages | ||
run: pip install ${{ inputs.pip-install }} | ||
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/[email protected] | ||
with: | ||
name: lockfiles-${{ inputs.python_version }}-${{ inputs.artifact_name }}-${{ github.sha }} | ||
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 | ||
- name: Report what was installed | ||
run: pip freeze | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
<link rel="canonical" href="main/index.html"> | ||
</head> | ||
|
||
</html> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
on: | ||
workflow_call: | ||
outputs: | ||
branch-pr: | ||
description: The PR number if the branch is in one | ||
value: ${{ jobs.pr.outputs.branch-pr }} | ||
|
||
jobs: | ||
pr: | ||
runs-on: "ubuntu-latest" | ||
outputs: | ||
branch-pr: ${{ steps.script.outputs.result }} | ||
steps: | ||
- uses: actions/github-script@v7 | ||
id: script | ||
if: github.event_name == 'push' | ||
with: | ||
script: | | ||
const prs = await github.rest.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
head: context.repo.owner + ':${{ github.ref_name }}' | ||
}) | ||
if (prs.data.length) { | ||
console.log(`::notice ::Skipping CI on branch push as it is already run in PR #${prs.data[0]["number"]}`) | ||
return prs.data[0]["number"] | ||
} |
Oops, something went wrong.