Skip to content

Commit e831afb

Browse files
committed
feat: 初始提交 - OGScope 电子极轴镜系统
- 基于 Orange Pi Zero 2W 的电子极轴镜系统 - 支持 IMX327 相机和 2.4寸 SPI LCD - FastAPI Web 服务和调试控制台 - 基础相机功能和图像处理 - 使用 CC BY-NC-SA 4.0 许可证
0 parents  commit e831afb

73 files changed

Lines changed: 15091 additions & 0 deletions

Some content is hidden

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

.gitattributes

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Git LFS (Large File Storage) 配置
2+
# 用于处理大文件,如星表数据、测试图像等
3+
4+
# 图像文件
5+
*.png filter=lfs diff=lfs merge=lfs -text
6+
*.jpg filter=lfs diff=lfs merge=lfs -text
7+
*.jpeg filter=lfs diff=lfs merge=lfs -text
8+
*.fits filter=lfs diff=lfs merge=lfs -text
9+
*.fit filter=lfs diff=lfs merge=lfs -text
10+
11+
# 3D 模型文件
12+
*.stl filter=lfs diff=lfs merge=lfs -text
13+
*.step filter=lfs diff=lfs merge=lfs -text
14+
15+
# 数据文件
16+
*.db filter=lfs diff=lfs merge=lfs -text
17+
*.dat filter=lfs diff=lfs merge=lfs -text
18+
*.bin filter=lfs diff=lfs merge=lfs -text
19+
*.npz filter=lfs diff=lfs merge=lfs -text
20+
21+
# 文档文件
22+
*.pdf filter=lfs diff=lfs merge=lfs -text
23+
24+
# 确保文本文件使用 LF 换行符
25+
*.py text eol=lf
26+
*.md text eol=lf
27+
*.txt text eol=lf
28+
*.json text eol=lf
29+
*.yaml text eol=lf
30+
*.yml text eol=lf
31+
*.toml text eol=lf
32+
*.sh text eol=lf
33+
*.html text eol=lf
34+
*.css text eol=lf
35+
*.js text eol=lf
36+

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, dev ]
6+
pull_request:
7+
branches: [ main, dev ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.9", "3.10", "3.11"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: 设置 Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: 安装 Poetry
25+
uses: snok/install-poetry@v1
26+
with:
27+
version: 1.7.1
28+
virtualenvs-create: true
29+
virtualenvs-in-project: true
30+
31+
- name: 加载缓存依赖
32+
uses: actions/cache@v3
33+
with:
34+
path: .venv
35+
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
36+
37+
- name: 安装依赖
38+
run: poetry install --no-interaction --no-root
39+
40+
- name: 代码格式检查 (Black)
41+
run: poetry run black --check ogscope tests
42+
43+
- name: 代码规范检查 (Ruff)
44+
run: poetry run ruff check ogscope tests
45+
46+
- name: 类型检查 (MyPy)
47+
run: poetry run mypy ogscope
48+
continue-on-error: true # 初期允许失败
49+
50+
- name: 运行测试
51+
run: poetry run pytest --cov=ogscope --cov-report=xml
52+
53+
- name: 上传覆盖率报告
54+
uses: codecov/codecov-action@v3
55+
with:
56+
file: ./coverage.xml
57+
flags: unittests
58+
name: codecov-umbrella
59+
60+
lint:
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- name: 设置 Python
66+
uses: actions/setup-python@v4
67+
with:
68+
python-version: "3.9"
69+
70+
- name: 安装 Poetry
71+
uses: snok/install-poetry@v1
72+
73+
- name: 安装依赖
74+
run: poetry install --no-interaction
75+
76+
- name: 运行 Ruff
77+
run: poetry run ruff check ogscope tests
78+
79+
- name: 运行 Black
80+
run: poetry run black --check ogscope tests
81+

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: 设置 Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.9"
18+
19+
- name: 安装 Poetry
20+
uses: snok/install-poetry@v1
21+
22+
- name: 构建包
23+
run: poetry build
24+
25+
- name: 创建 GitHub Release
26+
uses: softprops/action-gh-release@v1
27+
with:
28+
files: dist/*
29+
generate_release_notes: true
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
# 可选: 发布到 PyPI
34+
# - name: 发布到 PyPI
35+
# run: poetry publish
36+
# env:
37+
# POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
38+

.gitignore

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# ====================
2+
# Python
3+
# ====================
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
*.so
8+
.Python
9+
build/
10+
develop-eggs/
11+
dist/
12+
downloads/
13+
eggs/
14+
.eggs/
15+
lib/
16+
lib64/
17+
parts/
18+
sdist/
19+
var/
20+
wheels/
21+
pip-wheel-metadata/
22+
share/python-wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# ====================
29+
# 虚拟环境
30+
# ====================
31+
.env
32+
.venv
33+
env/
34+
venv/
35+
ENV/
36+
env.bak/
37+
venv.bak/
38+
.python-version
39+
40+
# ====================
41+
# Poetry
42+
# ====================
43+
poetry.lock # 在开发机和 Orange Pi 上可能不一致,建议忽略
44+
.poetry/
45+
46+
# ====================
47+
# IDE - PyCharm
48+
# ====================
49+
.idea/
50+
*.iml
51+
*.iws
52+
*.ipr
53+
.idea_modules/
54+
# 但保留 run configurations 可以提交(可选)
55+
# !.idea/runConfigurations
56+
57+
# ====================
58+
# IDE - VSCode (备用)
59+
# ====================
60+
.vscode/
61+
*.code-workspace
62+
# 但保留 settings 可以提交(可选)
63+
# !.vscode/settings.json
64+
65+
# ====================
66+
# 测试和覆盖率
67+
# ====================
68+
.pytest_cache/
69+
.coverage
70+
.coverage.*
71+
htmlcov/
72+
.tox/
73+
.nox/
74+
nosetests.xml
75+
coverage.xml
76+
*.cover
77+
*.py,cover
78+
.hypothesis/
79+
80+
# ====================
81+
# 日志文件
82+
# ====================
83+
*.log
84+
logs/
85+
*.log.*
86+
87+
# ====================
88+
# 数据库
89+
# ====================
90+
*.db
91+
*.sqlite
92+
*.sqlite3
93+
*.db-shm
94+
*.db-wal
95+
96+
# ====================
97+
# 配置文件(敏感信息)
98+
# ====================
99+
config.json
100+
config.local.json
101+
.env.local
102+
*.secret
103+
*.key
104+
105+
# 但保留默认配置
106+
!default_config.json
107+
!config.example.json
108+
109+
# ====================
110+
# 临时文件
111+
# ====================
112+
temp/
113+
tmp/
114+
*.tmp
115+
*.temp
116+
*.swp
117+
*.swo
118+
*~
119+
120+
# ====================
121+
# 系统文件
122+
# ====================
123+
.DS_Store
124+
.DS_Store?
125+
._*
126+
.Spotlight-V100
127+
.Trashes
128+
ehthumbs.db
129+
Thumbs.db
130+
131+
# ====================
132+
# 项目特定
133+
# ====================
134+
# 用户上传的图像
135+
uploads/
136+
captured_images/
137+
*.fits
138+
*.fit
139+
140+
# 星表数据(太大,不提交)
141+
star_catalogs/*.dat
142+
star_catalogs/*.bin
143+
!star_catalogs/README.md
144+
145+
# 测试图像(除了示例)
146+
test_images/*.jpg
147+
test_images/*.png
148+
!test_images/sample_*.jpg
149+
150+
# 硬件测试相关
151+
hardware_test_logs/
152+
calibration_data/*.json
153+
!calibration_data/example.json
154+
155+
# 3D 打印文件
156+
*.stl.bak
157+
*.3mf
158+
*.gcode
159+
160+
# 文档构建输出
161+
docs/_build/
162+
docs/_static/
163+
docs/_templates/
164+
site/
165+
166+
# ====================
167+
# PyCharm 远程开发
168+
# ====================
169+
# 远程部署配置(包含 IP 等敏感信息)
170+
.idea/deployment.xml
171+
.idea/webServers.xml
172+
.idea/remote-mappings.xml
173+
174+
# ====================
175+
# Git 备份
176+
# ====================
177+
*.orig
178+
*.rej
179+
180+
# ====================
181+
# 开发笔记
182+
# ====================
183+
TODO.md
184+
NOTES.md
185+
.obsidian/
186+
PiFinder-release
187+

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
args: ['--maxkb=1000']
10+
- id: check-json
11+
- id: check-toml
12+
- id: check-merge-conflict
13+
- id: debug-statements
14+
15+
- repo: https://github.com/psf/black
16+
rev: 24.1.1
17+
hooks:
18+
- id: black
19+
language_version: python3.9
20+
21+
- repo: https://github.com/astral-sh/ruff-pre-commit
22+
rev: v0.2.0
23+
hooks:
24+
- id: ruff
25+
args: [--fix, --exit-non-zero-on-fix]
26+
27+
- repo: https://github.com/pre-commit/mirrors-mypy
28+
rev: v1.8.0
29+
hooks:
30+
- id: mypy
31+
additional_dependencies: [types-all]
32+
args: [--ignore-missing-imports]
33+

0 commit comments

Comments
 (0)