Quick guide for checking and testing code changes during development.
# Install in editable mode (one time)
pip install -e .With editable install, code changes are immediately available - no reinstall needed!
Edit any file in pydimension/ directory.
# Check Python syntax
python -m py_compile pydimension/your_module.py
# Or check entire package
python -c "import pydimension"# Fast test (~5 seconds)
python quick_test.pyThis verifies:
- ✅ Imports work
- ✅ Config files accessible
- ✅ Command-line tools available
# Test specific module
python -c "from pydimension.data_generation import DataGenerator; print('✅ OK')"
# Test command-line tool
pydimension-generate --help
# Test functionality
python -c "
from pydimension import DataGenerator, DataGenerationConfig
config = DataGenerationConfig.from_dict({
'DATA_GENERATION': {'enabled': True, 'N': 7, 'M': 10, 'ndim': 1, 'poly_order': 1, 'coefficients': [2.0, 1.0], 'random_seed': 32},
'OUTPUT': {'output_dir': 'test_output', 'data_dir': 'data', 'figures_dir': 'figures', 'results_dir': 'results'}
})
gen = DataGenerator(config)
gen.generate(verbose=False)
print('✅ Works')
"# 1. Syntax check
python -m py_compile pydimension/your_module.py
# 2. Import test
python -c "import pydimension; from pydimension import YourClass"
# 3. Quick test
python quick_test.py
# 4. Functional test (if changed core logic)
python run_pipeline.py --config pydimension/configs/config_synthetic.json| Change Type | Check Command | Time |
|---|---|---|
| Any code | python quick_test.py |
~5s |
| Import/export | python -c "import pydimension" |
~1s |
| CLI tool | pydimension-generate --help |
~1s |
| Functionality | python run_pipeline.py --config ... |
~30s |
| setup.py | pip install -e . --force-reinstall |
~10s |
# Test all main imports
python -c "
from pydimension import (
DataGenerator, DataPreprocessor, DimensionalAnalyzer,
ConstraintFilterer, OptimizationDiscoverer
)
print('✅ All imports OK')
"# Test all CLI tools
pydimension-generate --help
pydimension-preprocess --help
pydimension-analyze --help
pydimension-filter --help
pydimension-optimize --help# Verify package location
python -c "import pydimension; print(pydimension.__file__)"
# Check config files
python -c "
import pydimension
from pathlib import Path
config_dir = Path(pydimension.__file__).parent / 'configs'
print(f'Configs: {list(config_dir.glob(\"*.json\"))}')
"# Verify package works from anywhere
cd /tmp
python -c "import pydimension; print('✅ Accessible')"
cd /Users/xie/projects/PyDimensionOnly reinstall if you changed:
setup.py(package structure, entry points)- Package structure (added/removed modules)
- Entry points (CLI tool definitions)
pip install -e . --force-reinstallFor all other changes: Just test - no reinstall needed!
python quick_test.pypython test_package_installation.py# Test complete pipeline
python run_pipeline.py --config pydimension/configs/config_synthetic.json --plot# Check if editable install
pip show pydimension | grep Location
# Force reinstall if needed
pip install -e . --force-reinstall --no-cache-dir# Check syntax first
python -m py_compile pydimension/your_file.py
# Then test import
python -c "import pydimension.your_module"# Reinstall (entry points need reinstall)
pip install -e . --force-reinstall
pydimension-generate --help# After ANY code change:
python quick_test.py
# After changing setup.py:
pip install -e . --force-reinstall
python quick_test.py
# Before committing:
python quick_test.py && python run_pipeline.py --config pydimension/configs/config_synthetic.json- Always use editable install:
pip install -e . - Test immediately: Run
python quick_test.pyafter changes - Test before commit: Verify everything works
- Only reinstall when needed: setup.py, structure, or entry points
- Use quick tests: Don't run full pipeline for every small change
- TESTING.md - Detailed testing guide
- SETUP.md - Installation and setup
- USAGE.md - Usage examples
- README.md - Project overview