Python Package Structure¶
Basic Structure¶
A typical Qualia package (core or plugin) has the following structure:
qualia-package/
├── conf/ # Configuration files
│ ├── dataset1/ # Organized by dataset
│ │ └── model_conf.toml
│ └── dataset2/
│ └── model_conf.toml
├── docs/ # Documentation
│ ├── conf.py
│ ├── index.rst
│ └── Makefile
├── src/
│ └── qualia_package_name/
│ ├── assets/ # Non-Python files
│ ├── dataaugmentation/ # Data augmentation modules
│ │ └── pytorch/
│ ├── datamodel/ # Dataset structures
│ ├── dataset/ # Dataset loaders
│ ├── deployment/ # Target deployment modules
│ │ ├── keras/
│ │ ├── qualia_codegen/
│ │ └── tflite/
│ ├── evaluation/ # On-target evaluation
│ │ ├── host/
│ │ └── target/
│ ├── experimenttracking/ # Experiment tracking modules
│ ├── learningframework/ # Learning framework modules
│ ├── learningmodel/ # Model definitions
│ │ ├── keras/
│ │ └── pytorch/
│ │ └── layers/
│ ├── postprocessing/ # Model post-processing
│ ├── preprocessing/ # Data preprocessing
│ ├── utils/ # Utility functions
│ ├── __init__.py
│ ├── main.py # CLI entry point
│ ├── py.typed # Type hints marker
│ └── typing.py # Type definitions
├── tests/ # Test files
│ └── functional/
│ ├── end_to_end/
│ └── training/
├── LICENSE
├── pyproject.toml # Project metadata and dependencies
└── README.md
Directory Descriptions¶
Top-level Directories¶
conf/
: Contains TOML configuration files organized by dataset and experimentdocs/
: Documentation files and build configurationsrc/
: Source code directory containing the main packagetests/
: Test files organized by type (functional, unit, etc.)
Source Package Structure (src/qualia_package_name/
)¶
Core Modules¶
assets/
Non-Python files needed for package installation
Must contain
__init__.py
(can be empty)Template files, project files, etc.
datamodel/
Data structures for storing dataset information
Common data representations
Dataset-specific models
dataset/
Dataset loader modules
Referenced in
[dataset]
configuration sectionsHandles data import and initial formatting
learningframework/
Framework-specific implementations (PyTorch, Keras, etc.)
Referenced in
[learningframework]
configurationHandles training loop and model interaction
learningmodel/
Model architecture definitions
Organized by framework (pytorch/, keras/)
Custom layers and components
Referenced in
[model_template]
and[[model]]
sections
Processing Modules¶
preprocessing/
Data preprocessing modules
Used during
preprocess_data
actionReferenced in
[[preprocessing]]
sections
dataaugmentation/
Data augmentation implementations
Referenced in
[[data_augmentation]]
sectionsFramework-specific augmentation methods
postprocessing/
Model postprocessing modules
Model converter modules
Referenced in
[[postprocessing]]
and[deploy]
sections
Deployment Modules¶
deployment/
Target deployment modules
Used during
prepare_deploy
anddeploy_and_evaluate
Framework-specific deployment handlers
Referenced in
[deploy]
sections
evaluation/
On-target evaluation modules
Used during
deploy_and_evaluate
Host and target-specific evaluations
Referenced in
[deploy]
sections
experimenttracking/
Experiment logging and tracking
Referenced in
[experimenttracking]
sectionFramework-specific tracking implementations
Utility Files¶
utils/
Common utility functions
File handling, logging, process management
Helper functions used across modules
Required Files
main.py
: CLI entry point (if CLI is provided)py.typed
: Empty file marking package as type-hintedtyping.py
: Common type definitions__init__.py
: Required in all directories for proper importing
Notes¶
All directories must contain
__init__.py
files (Python 3.9 compatibility)Plugins may implement any subset of these directories based on features
Directory structure matches configuration file sections
Type hints are mandatory unless explicitly marked as unavailable