Skip to content

Commit f493418

Browse files
committed
Update the code and fix out-of-date
1 parent 9a0d3cf commit f493418

File tree

8 files changed

+336
-59
lines changed

8 files changed

+336
-59
lines changed

.github/workflows/tests.yml

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,29 @@ jobs:
3232
- name: Install core dependencies
3333
run: |
3434
python -m pip install --upgrade pip
35-
pip install -r examples/requirements.txt
35+
pip install -r examples/requirements-core.txt
3636
37-
- name: Test example imports and basic functionality
37+
- name: Verify examples syntax
38+
run: |
39+
echo "🔍 Running syntax verification..."
40+
python verify_examples.py --quick
41+
42+
- name: Test essential imports
3843
env:
3944
MPLBACKEND: Agg # Use non-interactive matplotlib backend
4045
run: |
41-
# Test essential imports work
42-
python -c "import sys; sys.path.append('examples'); import utils.visualization; print('✅ Utils import successful')"
43-
44-
# Test key examples can run with minimal parameters
45-
echo "🧪 Testing Module 1 (Fundamentals)..."
46-
timeout 30s python examples/module1_fundamentals/01_classical_vs_quantum_bits.py --shots 5 || echo "⚠️ Module 1 timeout (expected for educational content)"
47-
48-
echo "🧪 Testing CLI interfaces..."
46+
echo "📦 Testing essential imports..."
47+
python -c "import sys; sys.path.append('examples'); import utils.visualization; print('✅ Visualization utils OK')"
48+
python -c "import sys; sys.path.append('examples'); import utils.quantum_helpers; print('✅ Quantum helpers OK')"
49+
python -c "import sys; sys.path.append('examples'); import utils.cli; print('✅ CLI utils OK')"
50+
echo "✅ All imports successful"
51+
52+
- name: Test CLI help interfaces
53+
run: |
54+
echo "🧪 Testing CLI help interfaces..."
4955
python examples/module1_fundamentals/01_classical_vs_quantum_bits.py --help > /dev/null
5056
python examples/module4_algorithms/01_deutsch_jozsa_algorithm.py --help > /dev/null
51-
52-
echo "✅ Core functionality verified"
57+
echo "✅ CLI interfaces working"
5358
5459
documentation:
5560
runs-on: ubuntu-latest
@@ -62,17 +67,45 @@ jobs:
6267
6368
# Check essential documentation exists
6469
test -f README.md && echo "✅ Main README found"
70+
test -f BEGINNERS_GUIDE.md && echo "✅ Beginner's Guide found"
6571
test -f examples/README.md && echo "✅ Examples README found"
72+
test -f verify_examples.py && echo "✅ Verification script found"
73+
test -f CHANGELOG.md && echo "✅ Changelog found"
6674
67-
# Count examples across modules
68-
total_examples=$(find examples/module*/ -maxdepth 1 -name "*.py" | wc -l)
75+
# Count examples across modules (excluding __init__.py and other non-example files)
76+
total_examples=$(find examples/module*/ -maxdepth 1 -name "*.py" -not -name "__*" | wc -l)
6977
echo "📊 Found $total_examples example files"
7078
71-
# Basic structure validation (flexible for educational content)
79+
# Validate example count (expecting 45 examples)
7280
if [ "$total_examples" -lt 40 ]; then
73-
echo "⚠️ Warning: Expected ~45 examples, found $total_examples"
81+
echo "❌ Error: Expected 45 examples, found only $total_examples"
82+
exit 1
83+
elif [ "$total_examples" -ge 45 ]; then
84+
echo "✅ Example count correct: $total_examples examples"
7485
else
75-
echo "✅ Example count looks good: $total_examples examples"
86+
echo "⚠️ Warning: Expected 45 examples, found $total_examples"
7687
fi
7788
7889
echo "✅ Documentation structure validated"
90+
91+
docker-build:
92+
runs-on: ubuntu-latest
93+
steps:
94+
- uses: actions/checkout@v5
95+
96+
- name: Set up Docker Buildx
97+
uses: docker/setup-buildx-action@v3
98+
99+
- name: Test Docker CPU build
100+
run: |
101+
echo "🐳 Testing Docker CPU build..."
102+
cd docker
103+
docker build --build-arg VARIANT=cpu -t qc101-test:cpu -f Dockerfile ..
104+
echo "✅ Docker CPU build successful"
105+
106+
- name: Run quick example in container
107+
run: |
108+
echo "🧪 Running example in Docker container..."
109+
docker run --rm qc101-test:cpu \
110+
python examples/module1_fundamentals/01_classical_vs_quantum_bits.py --shots 10
111+
echo "✅ Docker container execution successful"

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ quantum-computing-101/
285285
├── README.md # This file
286286
├── LICENSE # Apache 2.0 License
287287
├── CHANGELOG.md # Version history and updates
288-
├── QISKIT_2X_MIGRATION.md # Qiskit 2.x compatibility guide (NEW!)
289288
├── modules/ # Theoretical curriculum
290289
│ ├── Module1_Quantum_Fundamentals.md
291290
│ ├── Module2_Mathematical_Foundations.md
@@ -318,7 +317,6 @@ quantum-computing-101/
318317
│ │ └── gpu-amd.txt # AMD ROCm packages
319318
├── verify_examples.py # Quality assurance tool
320319
├── BEGINNERS_GUIDE.md # Complete learning pathway (Updated v2.0)
321-
├── QISKIT_2X_MIGRATION.md # Qiskit 2.x compatibility and headless setup
322320
└── docs/ # Additional documentation
323321
├── CONTRIBUTING.md # Contribution guidelines
324322
├── CODE_OF_CONDUCT.md # Community standards
@@ -393,16 +391,16 @@ python verify_examples.py --module module1_fundamentals
393391
### **When You Need Help:**
394392
- 🐛 **Technical Issues**: Run `python verify_examples.py` to diagnose problems
395393
- 📚 **Learning Questions**: Check the [Complete Beginner's Guide](BEGINNERS_GUIDE.md)
396-
- **Qiskit 2.x Issues**: See the [Qiskit 2.x Migration Guide](QISKIT_2X_MIGRATION.md)
397-
- 🐳 **Docker/Headless Problems**: Check matplotlib backend configuration in the migration guide
398-
- 💬 **Community Support**: Join quantum computing forums and communities
394+
- 📖 **Qiskit 2.x Compatibility**: All examples are designed for Qiskit 2.x (>= 1.0.0)
395+
- 🐳 **Docker/Headless Problems**: Examples use matplotlib 'Agg' backend for headless compatibility
396+
- 💬 **Community Support**: Join quantum computing forums and communities
399397
- 🔧 **Installation Problems**: Follow the setup instructions above
400398

401399
### **Useful Resources:**
402-
- **[Qiskit 2.x Migration Guide](QISKIT_2X_MIGRATION.md)** - Complete compatibility fixes documentation
403400
- **[Qiskit Textbook](https://qiskit.org/textbook/)** - Comprehensive quantum computing resource
404401
- **[IBM Quantum Experience](https://quantum-computing.ibm.com/)** - Run on real quantum computers
405402
- **[Quantum Computing Stack Exchange](https://quantumcomputing.stackexchange.com/)** - Q&A community
403+
- **[Qiskit Documentation](https://docs.quantum.ibm.com/)** - Official Qiskit 2.x documentation
406404

407405
## 📖 Citation
408406

docker/requirements/base.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
# Note: Do not add variant-specific packages here (use cpu.txt, gpu-nvidia.txt, gpu-amd.txt)
66

77
# Core quantum computing frameworks
8-
qiskit>=1.0.0
8+
# Note: Qiskit 2.x versioning starts at 1.0.0
9+
qiskit>=1.0.0,<3.0.0
910
# Note: qiskit-aer is installed separately in each variant (CPU/GPU) to avoid conflicts
10-
cirq>=1.2.0
11-
pennylane>=0.35.0
11+
cirq>=1.2.0,<2.0.0
12+
pennylane>=0.35.0,<1.0.0
1213

1314
# Scientific computing and visualization
14-
numpy>=1.26.0
15-
scipy>=1.12.0
16-
matplotlib>=3.8.0
17-
pandas>=2.2.0
18-
seaborn>=0.12.0
15+
numpy>=1.26.0,<2.0.0
16+
scipy>=1.12.0,<2.0.0
17+
matplotlib>=3.8.0,<4.0.0
18+
pandas>=2.2.0,<3.0.0
19+
seaborn>=0.12.0,<1.0.0
1920

2021
# Essential dependencies for circuit visualization
2122
pylatexenc>=2.10

examples/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Quantum Computing 101 - Complete Practical Examples Collection
22

3-
🎉 **FULLY IMPLEMENTED CURRICULUM** - All 40 examples across 8 modules are now complete and ready to use!
3+
🎉 **FULLY IMPLEMENTED CURRICULUM** - All 45 examples across 8 modules are now complete and ready to use!
44

5-
This directory contains comprehensive Python examples for hands-on learning with the Quantum Computing 101 curriculum. Each module has its corresponding examples folder with 5 ready-to-run scripts, totaling 24,547 lines of production-grade quantum computing code.
5+
This directory contains comprehensive Python examples for hands-on learning with the Quantum Computing 101 curriculum. Each module has its corresponding examples folder with production-ready scripts, totaling 24,547+ lines of quantum computing code.
66

77
## 🚀 Quick Start
88

@@ -44,17 +44,17 @@ python 01_classical_vs_quantum_bits.py --help
4444

4545
```
4646
examples/
47-
├── module1_fundamentals/ # ✅ 5/5 - Basic quantum concepts (1,703 LOC)
48-
├── module2_mathematics/ # ✅ 5/5 - Mathematical foundations (2,361 LOC)
49-
├── module3_programming/ # ✅ 5/5 - Advanced Qiskit programming (3,246 LOC)
50-
├── module4_algorithms/ # ✅ 5/5 - Core quantum algorithms (1,843 LOC)
51-
├── module5_error_correction/ # ✅ 5/5 - Noise and error handling (2,111 LOC)
52-
├── module6_machine_learning/ # ✅ 5/5 - Quantum ML applications (3,157 LOC)
53-
├── module7_hardware/ # ✅ 5/5 - Hardware and cloud platforms (4,394 LOC)
47+
├── module1_fundamentals/ # ✅ 8 examples - Basic quantum concepts (1,703 LOC)
48+
├── module2_mathematics/ # ✅ 5 examples - Mathematical foundations (2,361 LOC)
49+
├── module3_programming/ # ✅ 6 examples - Advanced Qiskit programming (3,246 LOC)
50+
├── module4_algorithms/ # ✅ 5 examples - Core quantum algorithms (1,843 LOC)
51+
├── module5_error_correction/ # ✅ 5 examples - Noise and error handling (2,111 LOC)
52+
├── module6_machine_learning/ # ✅ 5 examples - Quantum ML applications (3,157 LOC)
53+
├── module7_hardware/ # ✅ 5 examples - Hardware and cloud platforms (4,394 LOC)
5454
├── module8_applications/ # ✅ 5/5 - Industry use cases (5,346 LOC)
5555
└── utils/ # ✅ Shared utilities and helpers (387 LOC)
5656
57-
TOTAL: 40 examples, 24,547 lines of code, 100% complete!
57+
TOTAL: 45 examples, 24,547+ lines of code, 100% complete!
5858
```
5959

6060
## 🎯 Complete Learning Path - All Tiers Implemented
@@ -129,7 +129,7 @@ Most scripts produce educational visualizations including:
129129
- ✅ Replaced blocking `plt.show()` with `plt.savefig()` and `plt.close()`
130130
- ✅ All visualizations automatically save to files
131131

132-
**For detailed technical information, see**: `../QISKIT_2X_MIGRATION.md`
132+
**Technical Details**: All examples require Qiskit >= 1.0.0 and use headless matplotlib backend for Docker compatibility.
133133

134134
### Common Issues
135135

@@ -204,7 +204,7 @@ python example.py --verbose
204204

205205
## 🤝 Contributing
206206

207-
The Quantum Computing 101 examples collection is now **COMPLETE** with all 40 examples implemented! 🎉
207+
The Quantum Computing 101 examples collection is now **COMPLETE** with all 45 examples implemented! 🎉
208208

209209
### Ways to Contribute
210210
- **Bug Reports**: Found an issue? Please report it with details about your environment

examples/requirements-core.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
# For full features, use requirements.txt instead
66

77
# Core quantum computing framework
8-
qiskit>=1.0.0
9-
qiskit-aer>=0.14.0
8+
# Note: Qiskit 2.x versioning starts at 1.0.0
9+
qiskit>=1.0.0,<3.0.0
10+
qiskit-aer>=0.14.0,<1.0.0
1011

1112
# Scientific computing and visualization
12-
numpy>=1.26.0
13-
scipy>=1.12.0
14-
matplotlib>=3.8.0
13+
numpy>=1.26.0,<2.0.0
14+
scipy>=1.12.0,<2.0.0
15+
matplotlib>=3.8.0,<4.0.0
1516

1617
# Essential dependencies for circuit visualization
1718
pylatexenc>=2.10

examples/requirements.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
# Note: Some packages (Jupyter, cloud SDKs) intentionally overlap with Docker for flexibility
66

77
# Core quantum computing frameworks (required)
8-
qiskit>=1.0.0
9-
qiskit-aer>=0.14.0
10-
qiskit-ibm-runtime>=0.18.0
11-
qiskit-ibm-provider>=0.8.0
8+
# Note: Qiskit 2.x versioning starts at 1.0.0
9+
qiskit>=1.0.0,<3.0.0
10+
qiskit-aer>=0.14.0,<1.0.0
11+
qiskit-ibm-runtime>=0.18.0,<1.0.0
12+
qiskit-ibm-provider>=0.8.0,<1.0.0
1213

1314
# Alternative frameworks for multi-platform examples (optional but recommended)
14-
cirq>=1.2.0
15-
pennylane>=0.35.0
15+
cirq>=1.2.0,<2.0.0
16+
pennylane>=0.35.0,<1.0.0
1617

1718
# Scientific computing and visualization (required)
18-
numpy>=1.26.0
19-
scipy>=1.12.0
20-
matplotlib>=3.8.0
21-
pandas>=2.2.0
19+
numpy>=1.26.0,<2.0.0
20+
scipy>=1.12.0,<2.0.0
21+
matplotlib>=3.8.0,<4.0.0
22+
pandas>=2.2.0,<3.0.0
2223

2324
# Essential dependencies for circuit visualization
2425
pylatexenc>=2.10

examples/utils/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def main():
134134
print("\n🚀 Quantum Computing 101")
135135
print("=" * 30)
136136
print("📚 A comprehensive quantum computing education platform")
137-
print("🎯 40 production-ready examples across 8 modules")
137+
print("🎯 45 production-ready examples across 8 modules")
138138
print("📊 24,547+ lines of educational quantum computing code")
139139
print("🌍 Open source and community-driven")
140140
print("\n🔗 More info: https://github.com/AIComputing101/quantum-computing-101")

0 commit comments

Comments
 (0)