Skip to content

Commit

Permalink
Add 'pyctbgui/' from commit '152691ae1483eb54d6e73146a73c702483c5b38c'
Browse files Browse the repository at this point in the history
git-subtree-dir: pyctbgui
git-subtree-mainline: 15e8c0d
git-subtree-split: 152691a
  • Loading branch information
thattil committed Sep 6, 2024
2 parents 15e8c0d + 152691a commit 1056066
Show file tree
Hide file tree
Showing 76 changed files with 25,619 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pyctbgui/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BasedOnStyle: LLVM
IndentWidth: 4

UseTab: Never
ColumnLimit: 80
AlignConsecutiveAssignments: false
AlignConsecutiveMacros: true
13 changes: 13 additions & 0 deletions pyctbgui/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Bug Report
about: Create a report to help us improve
title: New Bug Report
labels: action - Bug, priority - Unclassified, status - Pending
template: bug_report.md
---
##### Priority:
<!-- Super Low, Low, Medium, High, Super High -->

##### *Describe the bug
<!-- A clear and concise description of what the bug is -->

16 changes: 16 additions & 0 deletions pyctbgui/.github/ISSUE_TEMPLATE/change_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Change Request
about: Suggest a change to an existing feature
title: New Change Request
labels: action - Change, priority - Unclassified, status - Pending
template: change_request.md
---
##### Priority:
<!-- Super Low, Low, Medium, High, Super High -->

##### *State the change request:

##### Is your change request related to a problem. Please describe:

##### Additional context:

1 change: 1 addition & 0 deletions pyctbgui/.github/ISSUE_TEMPLATE/conig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
25 changes: 25 additions & 0 deletions pyctbgui/.github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Feature Request
about: Suggest a feature, documentation or submit a question
title: New Feature Request
labels: action - Enhancement, priority - Unclassified, status - Pending
template: feature_request.md
---

##### Priority:
<!-- Super Low, Low, Medium, High, Super High -->

##### *State the feature:


##### Is your feature request related to a problem. Please describe:


##### Describe the solution you'd like:


##### Describe alternatives you've considered:


##### Additional context:

35 changes: 35 additions & 0 deletions pyctbgui/.github/workflows/build-and-test-inplace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build inplace, run tests and linting

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build C extension
run: |
make
- name: Run tests using pytest
run: |
make test
- name: check code formatting
run: |
make check_format
- name: lint the code with ruff
run: |
make lint
133 changes: 133 additions & 0 deletions pyctbgui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
nohup.out
.idea/
tests/.tmp
run_*
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
18 changes: 18 additions & 0 deletions pyctbgui/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/google/yapf
rev: v0.40.1
hooks:
- id: yapf
name: yapf
language: python
entry: yapf
args: [-i,--style,pyproject.toml]
types: [python]

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.285
hooks:
- id: ruff
11 changes: 11 additions & 0 deletions pyctbgui/CtbGui
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python3
from PyQt5 import QtWidgets
import sys

from pyctbgui.ui import MainWindow

if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
main = MainWindow()
main.show()
app.exec_()
2 changes: 2 additions & 0 deletions pyctbgui/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include pyctbgui/ui/*.ui
recursive-include src *.c *.h
39 changes: 39 additions & 0 deletions pyctbgui/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# TODO! Add support for making the pkg?
# Which tests should we have?

default: ext

ext: ## [DEFAULT] build c extension in place
rm -rf build/ pyctbgui/_decoder.cpython*
python setup.py build_ext --inplace

clean: ## Remove the build folder and the shared library
rm -rf build/ pyctbgui/_decoder.cpython*

test: ## Run unit tests using pytest
python -m pytest -v tests/unit

test_gui: ## Run E2E tests using pytest
python -m pytest -v tests/gui

setup_gui_test: ## Setup the environment for the E2E tests
ctbDetectorServer_virtual > /tmp/simulator.log 2>&1 &
slsReceiver > /tmp/slsReceiver.log 2>&1 &
sleep 3
sls_detector_put config tests/gui/data/simulator.config

killall: ## Kill all the processes started by setup_gui_test
killall slsReceiver ctbDetectorServer_virtual


lint: ## run ruff linter to check formatting errors
@ruff check tests pyctbgui *.py && echo "Ruff checks passed ✅"

format: ## format code inplace using style in pyproject.toml
yapf --style pyproject.toml -m -r -i tests pyctbgui *.py

check_format: ## Check if source is formatted properly
yapf --style pyproject.toml -r -d tests pyctbgui *.py

help: # from compiler explorer
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
31 changes: 31 additions & 0 deletions pyctbgui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# New Chip Test Board Gui using Python
Prototype for a new python based GUI for the Chip Test Board


## Getting started

```bash
git clone https://github.com/slsdetectorgroup/pyctbgui.git
cd pyctbgui
make #compiles the c extension inplace
./CtbGui
```


## Display help for the Makefile

```
$ make help
check_format Check if source is formatted properly
clean Remove the build folder and the shared library
ext [DEFAULT] build c extension in place
format format code inplace using style in pyproject.toml
lint run ruff linter to check formatting errors
test Run unit tests using pytest
```


## setup pre-commit hooks
```
pre-commit install
```
Loading

0 comments on commit 1056066

Please sign in to comment.