Project Structure¶
This document describes the organization of the SCPI Instrument Control project.
Directory Layout¶
Siglent/
├── siglent/ # Main package (installed)
│ ├── __init__.py
│ ├── oscilloscope.py # Main API
│ ├── channel.py # Channel control
│ ├── trigger.py # Trigger settings
│ ├── waveform.py # Waveform data structures
│ ├── measurement.py # Measurement functions
│ ├── connection/ # Connection backends
│ ├── gui/ # GUI application
│ └── protocol_decoders/ # Protocol decoders
│
├── tests/ # Test suite (not installed)
│ ├── test_imports.py
│ ├── test_gui_initialization.py
│ ├── test_protocol_decoders.py
│ └── ...
│
├── scripts/ # Development utilities (not installed)
│ ├── run_debug.py # Debug GUI launcher
│ ├── run_debug.bat # Windows launcher
│ └── capture_screenshots.py
│
├── docs/ # Documentation
│ ├── images/ # Screenshots (installed)
│ ├── development/ # Dev docs (not installed)
│ │ ├── PYPI_DEPLOYMENT.md
│ │ └── PROJECT_STRUCTURE.md
│ ├── SCREENSHOT_GUIDE.md # Development guide
│ └── SDS800XHD_Series_ProgrammingGuide_EN11G.pdf # Scope manual
│
├── examples/ # Example scripts (installed)
│ ├── basic_usage.py
│ ├── measurements.py
│ ├── live_plot.py
│ └── ...
│
├── dist/ # Built packages (git ignored)
│ ├── siglent_oscilloscope-0.2.0.tar.gz
│ └── siglent_oscilloscope-0.2.0-py3-none-any.whl
│
├── README.md # Main documentation (installed)
├── CHANGELOG.md # Version history (installed)
├── LICENSE # MIT license (installed)
├── pyproject.toml # Package metadata
└── MANIFEST.in # Package inclusion rules
What Gets Installed¶
When users install the package via pip install SCPI-Instrument-Control, they get:
Code:
siglent/- Complete package with all modulesexamples/- Example scripts to get started
Documentation:
README.md- Main documentationCHANGELOG.md- Version historydocs/images/- GUI screenshotsdocs/SDS800XHD_Series_ProgrammingGuide_EN11G.pdf- Scope manual
Not Installed:
tests/- Test suite (for development only)scripts/- Development utilitiesdocs/development/- Build and deployment documentation
Directory Purposes¶
siglent/¶
The main package containing all the production code. This is what gets imported when users run import scpi_control.
Key modules:
oscilloscope.py- MainOscilloscopeclasschannel.py- Channel configurationtrigger.py- Trigger settingswaveform.py- Waveform data handlingmeasurement.py- Measurement functionsgui/- PyQt6 GUI applicationconnection/- Connection backends (socket, mock)protocol_decoders/- I2C, SPI, UART decoders
tests/¶
Automated test suite using pytest. Run with pytest tests/ from the project root.
Test categories:
- Import tests - Verify all modules can be imported
- GUI initialization tests - Catch AttributeError and widget creation issues
- Protocol decoder tests - Verify decoder functionality
- Math operations tests - Test waveform math functions
- Live view tests - Test real-time plotting
See tests/README.md for testing instructions.
scripts/¶
Development and debugging utilities. Not installed with the package.
Scripts:
run_debug.py- Launch GUI with debug loggingrun_debug.bat- Windows convenience launchercapture_screenshots.py- Automated screenshot capture for docs
See scripts/README.md for details.
docs/¶
Project documentation, split into user-facing and developer-facing content.
User Documentation (installed):
images/- GUI screenshots for READMESDS800XHD_Series_ProgrammingGuide_EN11G.pdf- Oscilloscope reference
Developer Documentation (not installed):
development/PYPI_DEPLOYMENT.md- PyPI deployment guidedevelopment/PROJECT_STRUCTURE.md- This fileSCREENSHOT_GUIDE.md- Screenshot capture guide
examples/¶
Example scripts demonstrating package features. These are installed with the package so users can easily get started.
Examples:
basic_usage.py- Connect and capture waveformsmeasurements.py- Automated measurementslive_plot.py- Real-time waveform displaybatch_capture.py- Capture multiple waveforms- And more...
Build Artifacts¶
dist/¶
Contains built packages created by python -m build:
.tar.gz- Source distribution.whl- Wheel (binary) distribution
These are uploaded to PyPI for distribution.
Siglent_Oscilloscope.egg-info/¶
Metadata directory created during build. Git ignored.
Version Control¶
.gitignore¶
Excludes:
- Python cache files (
__pycache__,*.pyc) - Virtual environments (
.venv/,venv/) - Build artifacts (
dist/,build/,*.egg-info) - IDE files (
.vscode/,.idea/) - Test outputs (
.pytest_cache/,.coverage) - Development data files (
*.log,*.dat,*.csv)
.git/¶
Git repository data. The main branch is main.
Package Configuration¶
pyproject.toml¶
Modern Python package metadata and build configuration:
- Package name, version, description
- Dependencies (core and optional
[gui]extras) - Entry points (
siglent-guicommand) - Build system (setuptools)
MANIFEST.in¶
Controls what files are included in source distributions:
- Include: README, CHANGELOG, LICENSE, docs, examples
- Exclude: tests, scripts, development docs, build artifacts
Development Workflow¶
- Make changes to code in
siglent/ - Add tests in
tests/ - Run tests:
pytest tests/ - Update docs in
docs/andREADME.md - Update
CHANGELOG.mdwith changes - Build package:
python -m build - Check package:
twine check dist/* - Test install:
- Bash/WSL:
pip install dist/*.whl - PowerShell: run
python -m pip install --upgrade pipfirst, thenpython -m pip install (Get-ChildItem dist\*.whl)so globbing resolves the wheel path - cmd.exe:
for %f in (dist\*.whl) do python -m pip install --upgrade pip "%f" - Deploy to PyPI:
twine upload dist/*
See docs/development/PYPI_DEPLOYMENT.md for detailed instructions.
Migration from Old Structure¶
The project was reorganized in v0.2.0 to follow Python packaging best practices:
Changes:
- Created
tests/directory for all test files - Created
scripts/directory for development utilities - Consolidated all docs into
docs/directory - Moved build/deployment docs to
docs/development/ - Updated MANIFEST.in to exclude development-only files
- Updated .gitignore for cleaner repository
This structure matches the conventions used by most PyPI packages and makes it clear what's for users vs. developers.