pyobs-zwoeaf 2.0.0.dev4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyobs_zwoeaf-2.0.0.dev4/.github/workflows/pypi.yml +29 -0
- pyobs_zwoeaf-2.0.0.dev4/.github/workflows/ruff.yml +26 -0
- pyobs_zwoeaf-2.0.0.dev4/.gitignore +173 -0
- pyobs_zwoeaf-2.0.0.dev4/.idea/inspectionProfiles/Project_Default.xml +35 -0
- pyobs_zwoeaf-2.0.0.dev4/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- pyobs_zwoeaf-2.0.0.dev4/.idea/modules.xml +8 -0
- pyobs_zwoeaf-2.0.0.dev4/.idea/pyobs-zwoeaf.iml +11 -0
- pyobs_zwoeaf-2.0.0.dev4/.idea/workspace.xml +4 -0
- pyobs_zwoeaf-2.0.0.dev4/.pre-commit-config.yaml +10 -0
- pyobs_zwoeaf-2.0.0.dev4/CMakeLists.txt +13 -0
- pyobs_zwoeaf-2.0.0.dev4/DEVELOPMENT.md +337 -0
- pyobs_zwoeaf-2.0.0.dev4/LICENSE +22 -0
- pyobs_zwoeaf-2.0.0.dev4/PKG-INFO +9 -0
- pyobs_zwoeaf-2.0.0.dev4/README.md +76 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/demo/c/Makefile +53 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/demo/c/bin/x86/test_console +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/demo/c/main.cpp +139 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/include/EAF_focuser.h +473 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/armv6/libEAFFocuser.a +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/armv6/libEAFFocuser.so.1.6 +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/armv7/libEAFFocuser.a +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/armv7/libEAFFocuser.so.1.6 +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/armv8/libEAFFocuser.a +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/armv8/libEAFFocuser.so.1.6 +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/eaf.rules +3 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/mac/libEAFFocuser.a +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/mac/libEAFFocuser.dylib +1 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/mac/libEAFFocuser.dylib.1.6 +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/x64/libEAFFocuser.a +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/x64/libEAFFocuser.so.1.6 +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/x86/libEAFFocuser.a +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/lib/x86/libEAFFocuser.so.1.6 +0 -0
- pyobs_zwoeaf-2.0.0.dev4/lib/license.txt +20 -0
- pyobs_zwoeaf-2.0.0.dev4/pyproject.toml +40 -0
- pyobs_zwoeaf-2.0.0.dev4/src/pyobs_zwoeaf/EAF_focuser.cpp +166 -0
- pyobs_zwoeaf-2.0.0.dev4/src/pyobs_zwoeaf/__init__.py +1 -0
- pyobs_zwoeaf-2.0.0.dev4/src/pyobs_zwoeaf/cli.py +103 -0
- pyobs_zwoeaf-2.0.0.dev4/src/pyobs_zwoeaf/eaffocuser.py +148 -0
- pyobs_zwoeaf-2.0.0.dev4/uv.lock +1804 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish package to PyPI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags:
|
|
5
|
+
- 'v*'
|
|
6
|
+
jobs:
|
|
7
|
+
build-n-publish:
|
|
8
|
+
name: Build and publish package to PyPI
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Check out repository code
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: astral-sh/setup-uv@v5
|
|
16
|
+
with:
|
|
17
|
+
enable-cache: true
|
|
18
|
+
python-version: "3.11"
|
|
19
|
+
|
|
20
|
+
- name: Install system dependencies
|
|
21
|
+
run: sudo apt-get install -y libudev-dev
|
|
22
|
+
|
|
23
|
+
- name: Build
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Publish
|
|
27
|
+
env:
|
|
28
|
+
PYPI_TOKEN: ${{ secrets.pypi_password }}
|
|
29
|
+
run: uv publish --token $PYPI_TOKEN
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: ruff
|
|
2
|
+
on: push
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
ruff:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
timeout-minutes: 10
|
|
8
|
+
|
|
9
|
+
steps:
|
|
10
|
+
- name: Check out repository code
|
|
11
|
+
uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: astral-sh/setup-uv@v5
|
|
15
|
+
with:
|
|
16
|
+
enable-cache: true
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
|
|
19
|
+
- name: Install system dependencies
|
|
20
|
+
run: sudo apt-get install -y libudev-dev
|
|
21
|
+
|
|
22
|
+
- name: Install packages
|
|
23
|
+
run: uv sync --all-extras --dev
|
|
24
|
+
|
|
25
|
+
- name: Run ruff
|
|
26
|
+
run: uv run ruff check src/pyobs_zwoeaf/
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib64/
|
|
18
|
+
parts/
|
|
19
|
+
sdist/
|
|
20
|
+
var/
|
|
21
|
+
wheels/
|
|
22
|
+
share/python-wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
*.py,cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
cover/
|
|
52
|
+
|
|
53
|
+
# Translations
|
|
54
|
+
*.mo
|
|
55
|
+
*.pot
|
|
56
|
+
|
|
57
|
+
# Django stuff:
|
|
58
|
+
*.log
|
|
59
|
+
local_settings.py
|
|
60
|
+
db.sqlite3
|
|
61
|
+
db.sqlite3-journal
|
|
62
|
+
|
|
63
|
+
# Flask stuff:
|
|
64
|
+
instance/
|
|
65
|
+
.webassets-cache
|
|
66
|
+
|
|
67
|
+
# Scrapy stuff:
|
|
68
|
+
.scrapy
|
|
69
|
+
|
|
70
|
+
# Sphinx documentation
|
|
71
|
+
docs/_build/
|
|
72
|
+
|
|
73
|
+
# PyBuilder
|
|
74
|
+
.pybuilder/
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
86
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
87
|
+
# .python-version
|
|
88
|
+
|
|
89
|
+
# pipenv
|
|
90
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
91
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
92
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
93
|
+
# install all needed dependencies.
|
|
94
|
+
#Pipfile.lock
|
|
95
|
+
|
|
96
|
+
# UV
|
|
97
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
98
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
99
|
+
# commonly ignored for libraries.
|
|
100
|
+
#uv.lock
|
|
101
|
+
|
|
102
|
+
# poetry
|
|
103
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
104
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
105
|
+
# commonly ignored for libraries.
|
|
106
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
107
|
+
#poetry.lock
|
|
108
|
+
|
|
109
|
+
# pdm
|
|
110
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
111
|
+
#pdm.lock
|
|
112
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
113
|
+
# in version control.
|
|
114
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
115
|
+
.pdm.toml
|
|
116
|
+
.pdm-python
|
|
117
|
+
.pdm-build/
|
|
118
|
+
|
|
119
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
120
|
+
__pypackages__/
|
|
121
|
+
|
|
122
|
+
# Celery stuff
|
|
123
|
+
celerybeat-schedule
|
|
124
|
+
celerybeat.pid
|
|
125
|
+
|
|
126
|
+
# SageMath parsed files
|
|
127
|
+
*.sage.py
|
|
128
|
+
|
|
129
|
+
# Environments
|
|
130
|
+
.env
|
|
131
|
+
.venv
|
|
132
|
+
env/
|
|
133
|
+
venv/
|
|
134
|
+
ENV/
|
|
135
|
+
env.bak/
|
|
136
|
+
venv.bak/
|
|
137
|
+
|
|
138
|
+
# Spyder project settings
|
|
139
|
+
.spyderproject
|
|
140
|
+
.spyproject
|
|
141
|
+
|
|
142
|
+
# Rope project settings
|
|
143
|
+
.ropeproject
|
|
144
|
+
|
|
145
|
+
# mkdocs documentation
|
|
146
|
+
/site
|
|
147
|
+
|
|
148
|
+
# mypy
|
|
149
|
+
.mypy_cache/
|
|
150
|
+
.dmypy.json
|
|
151
|
+
dmypy.json
|
|
152
|
+
|
|
153
|
+
# Pyre type checker
|
|
154
|
+
.pyre/
|
|
155
|
+
|
|
156
|
+
# pytype static type analyzer
|
|
157
|
+
.pytype/
|
|
158
|
+
|
|
159
|
+
# Cython debug symbols
|
|
160
|
+
cython_debug/
|
|
161
|
+
|
|
162
|
+
# PyCharm
|
|
163
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
164
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
165
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
166
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
167
|
+
#.idea/
|
|
168
|
+
|
|
169
|
+
# Ruff stuff:
|
|
170
|
+
.ruff_cache/
|
|
171
|
+
|
|
172
|
+
# PyPI configuration file
|
|
173
|
+
.pypirc
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
5
|
+
<inspection_tool class="Mypy" enabled="false" level="ERROR" enabled_by_default="false" />
|
|
6
|
+
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
|
7
|
+
<option name="ourVersions">
|
|
8
|
+
<value>
|
|
9
|
+
<list size="5">
|
|
10
|
+
<item index="0" class="java.lang.String" itemvalue="3.11" />
|
|
11
|
+
<item index="1" class="java.lang.String" itemvalue="3.12" />
|
|
12
|
+
<item index="2" class="java.lang.String" itemvalue="3.13" />
|
|
13
|
+
<item index="3" class="java.lang.String" itemvalue="3.14" />
|
|
14
|
+
<item index="4" class="java.lang.String" itemvalue="3.15" />
|
|
15
|
+
</list>
|
|
16
|
+
</value>
|
|
17
|
+
</option>
|
|
18
|
+
</inspection_tool>
|
|
19
|
+
<inspection_tool class="PyStubPackagesAdvertiser" enabled="true" level="WARNING" enabled_by_default="true">
|
|
20
|
+
<option name="ignoredPackages">
|
|
21
|
+
<list>
|
|
22
|
+
<option value="PyQt5" />
|
|
23
|
+
<option value="PyQt5-stubs==5.14.2.2" />
|
|
24
|
+
</list>
|
|
25
|
+
</option>
|
|
26
|
+
</inspection_tool>
|
|
27
|
+
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
|
28
|
+
<option name="ignoredIdentifiers">
|
|
29
|
+
<list>
|
|
30
|
+
<option value="astropy.units.*" />
|
|
31
|
+
</list>
|
|
32
|
+
</option>
|
|
33
|
+
</inspection_tool>
|
|
34
|
+
</profile>
|
|
35
|
+
</component>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/pyobs-zwoeaf.iml" filepath="$PROJECT_DIR$/.idea/pyobs-zwoeaf.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="PYTHON_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
|
7
|
+
</content>
|
|
8
|
+
<orderEntry type="jdk" jdkName="uv (pyobs-zwoeaf)" jdkType="Python SDK" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
</component>
|
|
11
|
+
</module>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15...4.0)
|
|
2
|
+
project(EAF_focuser)
|
|
3
|
+
|
|
4
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
5
|
+
|
|
6
|
+
find_library(UDEV_LIB NAMES udev libudev REQUIRED)
|
|
7
|
+
|
|
8
|
+
python_add_library(EAF_focuser MODULE src/pyobs_zwoeaf/EAF_focuser.cpp WITH_SOABI)
|
|
9
|
+
target_link_libraries(EAF_focuser PRIVATE pybind11::headers)
|
|
10
|
+
target_link_libraries(EAF_focuser PRIVATE ${CMAKE_SOURCE_DIR}/lib/lib/x64/libEAFFocuser.a ${UDEV_LIB})
|
|
11
|
+
target_include_directories(EAF_focuser PUBLIC lib/include/)
|
|
12
|
+
|
|
13
|
+
install(TARGETS EAF_focuser DESTINATION pyobs_zwoeaf)
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# pyobs 2.0 — Phase 5: External Hardware Modules
|
|
2
|
+
|
|
3
|
+
This document covers the migration of this pyobs hardware module to the
|
|
4
|
+
pyobs 2.0 API.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Step 0 — Branch main/master into 1.x for legacy support
|
|
9
|
+
|
|
10
|
+
Before making any changes, preserve the current state as a legacy branch.
|
|
11
|
+
First check which branch is the default — it may be `main` or `master`:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git remote show origin | grep "HEAD branch"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**If the default branch is `master`, rename it to `main` first:**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git checkout master
|
|
21
|
+
git branch -m master main
|
|
22
|
+
git push origin main
|
|
23
|
+
git push origin --delete master
|
|
24
|
+
# Update the default branch in GitHub repository settings to main
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then branch off for legacy support:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git checkout main
|
|
31
|
+
git checkout -b 1.x
|
|
32
|
+
git push origin 1.x
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Create `develop` for all 2.0 work:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git checkout main
|
|
39
|
+
git checkout -b develop
|
|
40
|
+
git push origin develop
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Set `develop` as the default branch in GitHub repository settings.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Step 1 — Add ruff, update tooling
|
|
48
|
+
|
|
49
|
+
### pyproject.toml changes
|
|
50
|
+
|
|
51
|
+
1. Bump `pyobs-core` to `>=2.0.0.dev1`.
|
|
52
|
+
|
|
53
|
+
2. In `[dependency-groups] dev`: add `ruff>=0.9.0`, remove `flake8` and any
|
|
54
|
+
mypy stub packages (`pandas-stubs`, `pyside6-stubs`, etc.) — pyrefly
|
|
55
|
+
doesn't use `.pyi` stubs from PyPI.
|
|
56
|
+
|
|
57
|
+
3. Add config sections (match pyobs-core develop exactly):
|
|
58
|
+
|
|
59
|
+
```toml
|
|
60
|
+
[tool.ruff]
|
|
61
|
+
target-version = "py311"
|
|
62
|
+
line-length = 120
|
|
63
|
+
|
|
64
|
+
[tool.ruff.lint]
|
|
65
|
+
select = ["E", "F", "W", "I", "UP", "G"]
|
|
66
|
+
|
|
67
|
+
[tool.pyrefly]
|
|
68
|
+
python-version = "3.11"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> **Note on the `G` rule**: it flags `log.info(f"...")` — all logging calls
|
|
72
|
+
> must use `%`-style formatting: `log.info("value: %s", val)`.
|
|
73
|
+
|
|
74
|
+
### .pre-commit-config.yaml
|
|
75
|
+
|
|
76
|
+
Replace the flake8 hook with ruff:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
repos:
|
|
80
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
81
|
+
rev: 25.1.0
|
|
82
|
+
hooks:
|
|
83
|
+
- id: black
|
|
84
|
+
language_version: python3.11
|
|
85
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
86
|
+
rev: v0.9.0
|
|
87
|
+
hooks:
|
|
88
|
+
- id: ruff
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Delete .flake8
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
rm .flake8
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Run once to fix existing issues
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
uv run ruff check --fix .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Step 2 — Replace get_* with state and capabilities
|
|
106
|
+
|
|
107
|
+
### Remove getter methods
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
# BEFORE (pyobs 1.x)
|
|
111
|
+
async def get_binning(self) -> tuple[int, int]:
|
|
112
|
+
return self._binning
|
|
113
|
+
|
|
114
|
+
async def list_binnings(self) -> list[IBinning.State]:
|
|
115
|
+
return [IBinning.State(x=1, y=1), IBinning.State(x=2, y=2)]
|
|
116
|
+
|
|
117
|
+
async def get_full_frame(self) -> IWindow.State:
|
|
118
|
+
return IWindow.State(x=0, y=0, width=self._width, height=self._height)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
# AFTER (pyobs 2.0)
|
|
123
|
+
# In open():
|
|
124
|
+
await self.comm.set_capabilities(IWindow.Capabilities(
|
|
125
|
+
full_frame=IWindow.State(x=0, y=0, width=self._width, height=self._height)
|
|
126
|
+
))
|
|
127
|
+
await self.comm.set_capabilities(IBinning.Capabilities(
|
|
128
|
+
binnings=[IBinning.State(x=1, y=1), IBinning.State(x=2, y=2)]
|
|
129
|
+
))
|
|
130
|
+
# Initial states also in open():
|
|
131
|
+
await self.comm.set_state(IWindow.State(x=0, y=0, width=self._width, height=self._height))
|
|
132
|
+
await self.comm.set_state(IBinning.State(x=self._binning[0], y=self._binning[1]))
|
|
133
|
+
# In set_binning():
|
|
134
|
+
await self.comm.set_state(IBinning.State(x=x, y=y))
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Interface → change pattern
|
|
138
|
+
|
|
139
|
+
| Old getter | New pattern |
|
|
140
|
+
|---|---|
|
|
141
|
+
| `get_full_frame()` | `set_capabilities(IWindow.Capabilities(full_frame=...))` in `open()` |
|
|
142
|
+
| `get_window()` | remove — no equivalent; current window tracked in `_window` and published via `set_state(IWindow.State(...))` |
|
|
143
|
+
| `list_binnings()` | `set_capabilities(IBinning.Capabilities(binnings=[...]))` in `open()` |
|
|
144
|
+
| `list_image_formats()` | `set_capabilities(IImageFormat.Capabilities(image_formats=[...]))` in `open()` |
|
|
145
|
+
| `get_binning()` | `set_state(IBinning.State(...))` in `set_binning()` + `open()` |
|
|
146
|
+
| `get_exposure_status()` | `set_state(IExposure.State(...))` in `_change_exposure_status()` |
|
|
147
|
+
| `get_exposure_time()` | `set_state(IExposureTime.State(...))` in `set_exposure_time()` + `open()` |
|
|
148
|
+
| `get_image_type()` | `set_state(IImageType.State(...))` in `set_image_type()` + `open()` |
|
|
149
|
+
| `get_filter()` | `set_state(IFilters.State(...))` in `set_filter()` + `open()` |
|
|
150
|
+
| `list_filters()` | `set_capabilities(IFilters.Capabilities(filters=[...]))` in `open()` |
|
|
151
|
+
| `get_focus()` | `set_state(IFocuser.State(...))` in `set_focus()` + `open()` |
|
|
152
|
+
| `get_motion_status()` | handled by `MotionStatusMixin` — just call `_change_motion_status()` |
|
|
153
|
+
| `is_ready()` | `set_state(IReady.State(ready=...))` in `open()` and when it changes |
|
|
154
|
+
| `get_cooling()` | `set_state(ICooling.State(setpoint=..., power=..., enabled=...))` in `set_cooling()` and background task |
|
|
155
|
+
| `get_temperatures()` | `set_state(ITemperatures.State(readings=[ITemperatures.Temperature(name=..., value=...)]))` in background polling task |
|
|
156
|
+
| `get_gain()` / `get_offset()` | `set_state(IGain.State(gain=..., offset=...))` in `set_gain()`, `set_offset()` + `open()` |
|
|
157
|
+
| `get_video()` | `set_capabilities(IVideo.Capabilities(url=...))` in `open()` |
|
|
158
|
+
|
|
159
|
+
### ICooling and ITemperatures
|
|
160
|
+
|
|
161
|
+
`ICooling` extends `ITemperatures` but they have separate `State` dataclasses.
|
|
162
|
+
Both must be published independently:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
# temperatures (from background polling loop)
|
|
166
|
+
await self.comm.set_state(
|
|
167
|
+
ITemperatures.State(readings=[ITemperatures.Temperature(name="CCD", value=temp)])
|
|
168
|
+
)
|
|
169
|
+
# cooling control state
|
|
170
|
+
await self.comm.set_state(
|
|
171
|
+
ICooling.State(setpoint=self._setpoint, power=round(power_pct), enabled=True)
|
|
172
|
+
)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`ICooling.State.power` is typed `int | None` — convert the raw PWM fraction
|
|
176
|
+
(`raw / 255 * 100`) with `round()` before passing it.
|
|
177
|
+
|
|
178
|
+
### __init__.py re-exports
|
|
179
|
+
|
|
180
|
+
Ruff's `F401` rule requires explicit re-exports. Change:
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
# before
|
|
184
|
+
from .mymodule import MyClass
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
# after
|
|
189
|
+
from .mymodule import MyClass as MyClass
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Step 3 — Add pyobs-independent GUI
|
|
195
|
+
|
|
196
|
+
Each hardware module should have a standalone Qt GUI that works without pyobs
|
|
197
|
+
running — useful for testing hardware directly (e.g. during commissioning).
|
|
198
|
+
|
|
199
|
+
The pattern from **pyobs-qhyccd** (`pyobs_qhyccd/gui.py`) is the reference.
|
|
200
|
+
It uses reusable widgets from `pyobs.utils.gui.*` and talks directly to the
|
|
201
|
+
hardware driver without going through pyobs Comm.
|
|
202
|
+
|
|
203
|
+
### Typical structure
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
# mymodule/gui.py
|
|
207
|
+
import asyncio
|
|
208
|
+
import sys
|
|
209
|
+
import qasync
|
|
210
|
+
from PySide6 import QtWidgets
|
|
211
|
+
from pyobs.utils.gui.camera import (
|
|
212
|
+
DataDisplayWidget, BinningWidget, ImageFormatWidget,
|
|
213
|
+
ExposureTimeWidget, ExposeWidget,
|
|
214
|
+
)
|
|
215
|
+
from .driver import MyDriver
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class MainWindow(QtWidgets.QMainWindow):
|
|
219
|
+
def __init__(self) -> None:
|
|
220
|
+
super().__init__()
|
|
221
|
+
self.driver = MyDriver()
|
|
222
|
+
self.driver.open()
|
|
223
|
+
# ... build UI from pyobs.utils.gui widgets ...
|
|
224
|
+
|
|
225
|
+
@qasync.asyncSlot()
|
|
226
|
+
async def _expose_clicked(self) -> None:
|
|
227
|
+
# ... call driver directly ...
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def main() -> None:
|
|
231
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
232
|
+
asyncio.run(async_main(app), loop_factory=qasync.QEventLoop)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
if __name__ == "__main__":
|
|
236
|
+
main()
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Register as a console script in `pyproject.toml`:
|
|
240
|
+
|
|
241
|
+
```toml
|
|
242
|
+
[project.scripts]
|
|
243
|
+
mymodule-gui = "mymodule.gui:main"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Available pyobs GUI widgets (`pyobs.utils.gui`)
|
|
247
|
+
|
|
248
|
+
- `camera.DataDisplayWidget` — displays FITS images
|
|
249
|
+
- `camera.BinningWidget` — binning selector
|
|
250
|
+
- `camera.ImageFormatWidget` — INT8/INT16 selector
|
|
251
|
+
- `camera.ExposureTimeWidget` — exposure time spinner
|
|
252
|
+
- `camera.ExposeWidget` — expose/abort buttons with progress
|
|
253
|
+
- `camera.windowingwidget.WindowingWidget` — ROI selector
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Step 4 — Testing
|
|
258
|
+
|
|
259
|
+
Each module should have a `test/` directory with a `local.yaml` config that
|
|
260
|
+
uses `LocalComm` so it can be tested without an XMPP server:
|
|
261
|
+
|
|
262
|
+
```yaml
|
|
263
|
+
# test/local.yaml
|
|
264
|
+
class: pyobs.modules.MultiModule
|
|
265
|
+
|
|
266
|
+
vfs: &vfs
|
|
267
|
+
class: pyobs.vfs.VirtualFileSystem
|
|
268
|
+
roots:
|
|
269
|
+
cache:
|
|
270
|
+
class: pyobs.vfs.LocalFile
|
|
271
|
+
root: /tmp/pyobs-test/
|
|
272
|
+
|
|
273
|
+
modules:
|
|
274
|
+
camera: # or telescope, focuser, etc.
|
|
275
|
+
class: mymodule.MyCamera
|
|
276
|
+
name: camera
|
|
277
|
+
vfs: *vfs
|
|
278
|
+
comm:
|
|
279
|
+
class: pyobs.comm.local.LocalComm
|
|
280
|
+
name: camera
|
|
281
|
+
|
|
282
|
+
gui:
|
|
283
|
+
class: pyobs_gui.GUI
|
|
284
|
+
name: gui
|
|
285
|
+
vfs: *vfs
|
|
286
|
+
comm:
|
|
287
|
+
class: pyobs.comm.local.LocalComm
|
|
288
|
+
name: gui
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Run with:
|
|
292
|
+
```bash
|
|
293
|
+
pyobs test/local.yaml
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Repo checklist
|
|
299
|
+
|
|
300
|
+
For each external module repo, in order:
|
|
301
|
+
|
|
302
|
+
- [ ] Branch `main` → `1.x` (legacy)
|
|
303
|
+
- [ ] Create `develop` branch
|
|
304
|
+
- [ ] Bump `pyobs-core` to `>=2.0.0.dev1` in `pyproject.toml`
|
|
305
|
+
- [ ] Add `ruff>=0.9.0` to dev deps; remove `flake8` and mypy stub packages
|
|
306
|
+
- [ ] Add `[tool.ruff]`, `[tool.ruff.lint]`, `[tool.pyrefly]` sections to `pyproject.toml`
|
|
307
|
+
- [ ] Update `.pre-commit-config.yaml`: replace flake8 hook with ruff
|
|
308
|
+
- [ ] Delete `.flake8`
|
|
309
|
+
- [ ] Run `ruff check --fix .`
|
|
310
|
+
- [ ] Fix re-exports in `__init__.py` (`Foo as Foo`)
|
|
311
|
+
- [ ] Convert f-string log calls to `%`-style (`log.info("x: %s", x)`)
|
|
312
|
+
- [ ] Remove all `get_*` / `list_*` / `is_ready` methods
|
|
313
|
+
- [ ] Add `set_capabilities(...)` calls in `open()`
|
|
314
|
+
- [ ] Add `set_state(...)` calls in `open()` (initial values) and wherever values change
|
|
315
|
+
- [ ] Add standalone GUI in `<package>/gui.py`
|
|
316
|
+
- [ ] Add `test/local.yaml`
|
|
317
|
+
- [ ] Update `README.md` to mention pyobs 2.0 requirement
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Key pyobs-core 2.0 APIs
|
|
322
|
+
|
|
323
|
+
```python
|
|
324
|
+
# In open() — publish static hardware info
|
|
325
|
+
await self.comm.set_capabilities(IWindow.Capabilities(...))
|
|
326
|
+
await self.comm.set_capabilities(IBinning.Capabilities(...))
|
|
327
|
+
|
|
328
|
+
# In open() and wherever values change — publish live state
|
|
329
|
+
await self.comm.set_state(IBinning.State(x=2, y=2))
|
|
330
|
+
await self.comm.set_state(ICooling.State(setpoint=-20, power=80, enabled=True))
|
|
331
|
+
|
|
332
|
+
# Presence — set by Module.set_state() automatically
|
|
333
|
+
# No manual action needed
|
|
334
|
+
|
|
335
|
+
# Reading remote state (e.g. telescope pointing for camera WCS)
|
|
336
|
+
await self.comm.subscribe_state("telescope", IPointingRaDec, self._on_pointing)
|
|
337
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Tim-Oliver Husser
|
|
4
|
+
thusser@uni-goettingen.de
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyobs-zwoeaf
|
|
3
|
+
Version: 2.0.0.dev4
|
|
4
|
+
Summary: pyobs model for ZWO EAF focus motors
|
|
5
|
+
Author-Email: Lennart Jonas Buhrke <l.buhrke@stud.uni-goettingen.de>, Tim-Oliver Husser <thusser@uni-goettingen.de>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: <3.14,>=3.11
|
|
8
|
+
Requires-Dist: pyobs-core<3,>=2.0.0.dev6
|
|
9
|
+
|