-
Notifications
You must be signed in to change notification settings - Fork 0
creating notebooks
Mile Shi edited this page May 26, 2025
·
2 revisions
Learn how to create and manage interactive notebooks in the Intelligent IDE. This tutorial will guide you through the process of creating different types of notebooks, adding content, and collaborating with others.
Before starting this tutorial, ensure you have:
- ✅ Logged into the Intelligent IDE extension
- ✅ Joined a course or have course creation permissions
- ✅ Basic understanding of the VS Code interface
- ✅ Python or JavaScript knowledge (for code examples)
- Open VS Code with the Intelligent IDE extension installed
-
Press
Ctrl+Shift+P
(Windows/Linux) orCmd+Shift+P
(macOS) - Type "Intelligent IDE: Create New Notebook"
- Select the command from the dropdown
// The extension will prompt you for:
{
"notebook_name": "My First Notebook",
"course_id": "CS101",
"language": "python", // or "javascript", "markdown"
"template": "blank" // or "exercise", "assignment"
}
- Right-click in the file explorer
- Select "New Intelligent IDE Notebook"
- Choose your course and notebook settings
- Click "Create Notebook"
- Navigate to your course dashboard
- Click the "Create New Content" button
- Select "Interactive Notebook"
- Fill in the notebook details
Once created, you'll see the notebook interface:
{
"notebook_info": {
"name": "My First Notebook",
"course": "CS101 - Python Fundamentals",
"created_by": "You",
"created_at": "2024-01-15T10:00:00Z",
"language": "python",
"collaborators": [],
"status": "draft"
}
}
- Click the gear icon in the notebook toolbar
-
Set permissions:
- 📝 Edit Access: Who can modify the notebook
- 👁️ View Access: Who can read the notebook
- 🔄 Collaboration: Enable real-time editing
-
Choose execution environment:
- 🐍 Python 3.11 (default)
- 📊 Python with Data Science (includes pandas, numpy)
- 🌐 JavaScript/Node.js
- 🎯 Custom Environment
- Click the "+ Code" button in the toolbar
- Start typing your Python code:
# This is a Python code cell
import math
def calculate_circle_area(radius):
"""Calculate the area of a circle given its radius."""
return math.pi * radius ** 2
# Test the function
radius = 5
area = calculate_circle_area(radius)
print(f"The area of a circle with radius {radius} is {area:.2f}")
-
Execute the cell by pressing
Shift+Enter
or clicking the play button - View the output below the cell
// JavaScript code cell
function fibonacci(n) {
if (n <= 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
// Generate first 10 Fibonacci numbers
const fibSequence = [];
for (let i = 0; i < 10; i++) {
fibSequence.push(fibonacci(i));
}
console.log("Fibonacci sequence:", fibSequence);
- Click "+ Markdown" to add a markdown cell
- Write your documentation:
# Data Analysis Tutorial
## Introduction
This notebook demonstrates basic data analysis techniques using Python and pandas.
### Learning Objectives
- Load and explore datasets
- Perform basic statistical analysis
- Create visualizations
> **Note**: Make sure to install required libraries before running code cells.
### Prerequisites
- Basic Python knowledge
- Understanding of data structures
-
Headers: Use
#
,##
,###
for different levels -
Emphasis:
*italic*
and**bold**
text -
Lists: Use
-
or1.
for bullet and numbered lists -
Code: Use backticks for
inline code
-
Links:
[link text](url)
for hyperlinks
Output cells display results from code execution:
# This code will generate an output cell
import matplotlib.pyplot as plt
import numpy as np
# Generate sample data
x = np.linspace(0, 10, 100)
y = np.sin(x)
# Create plot
plt.figure(figsize=(10, 6))
plt.plot(x, y, 'b-', linewidth=2, label='sin(x)')
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.title('Sine Wave')
plt.legend()
plt.grid(True)
plt.show()
# The plot will appear in an output cell below
For educational content, create interactive exercises:
# Exercise Cell - Student completes this
def calculate_factorial(n):
"""
Calculate the factorial of a number.
Args:
n (int): Non-negative integer
Returns:
int: Factorial of n
"""
# TODO: Implement factorial calculation
# Hint: Use a loop or recursion
pass
# Test your implementation
assert calculate_factorial(5) == 120
assert calculate_factorial(0) == 1
print("All tests passed!")
{
"template": "blank",
"description": "Empty notebook for free-form content creation",
"default_cells": [
{
"type": "markdown",
"content": "# New Notebook\n\nAdd your content here..."
},
{
"type": "code",
"content": "# Your code here\nprint('Hello, World!')"
}
]
}
{
"template": "assignment",
"description": "Structured template for homework assignments",
"sections": [
"instructions",
"starter_code",
"exercises",
"submission_area"
]
}
# Data Science Notebook Template
# 1. Import Libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# 2. Load Data
# data = pd.read_csv('your_dataset.csv')
# 3. Explore Data
# data.head()
# data.info()
# data.describe()
# 4. Data Cleaning
# Handle missing values, outliers, etc.
# 5. Analysis
# Perform your analysis here
# 6. Visualization
# Create plots and charts
# 7. Conclusions
# Summarize your findings
- Open notebook settings
- Toggle "Enable Real-time Collaboration"
- Add collaborators by email or username
- Set permissions (view, edit, admin)
{
"collaboration_settings": {
"real_time_editing": true,
"collaborators": [
{
"user": "alice@university.edu",
"permission": "edit",
"joined_at": "2024-01-15T14:00:00Z"
},
{
"user": "bob@university.edu",
"permission": "view",
"joined_at": "2024-01-15T14:15:00Z"
}
]
}
}
- See live cursors of other users editing
- Chat in real-time using the integrated chat panel
- View edit history and track changes
- Resolve conflicts automatically with merge algorithms
- Click "Save Checkpoint" in the toolbar
- Add description: "Completed data loading section"
- View checkpoint history in the version panel
📋 Checkpoint History
🔄 **v1.3** - "Added visualization section" (2 hours ago)
🔄 **v1.2** - "Completed data cleaning" (4 hours ago)
🔄 **v1.1** - "Initial analysis code" (1 day ago)
🔄 **v1.0** - "Created notebook" (2 days ago)
- Create branches for experimental changes
- Merge branches back to main version
- Compare versions side-by-side
- Restore from any checkpoint
# Interactive widgets for exploration
import ipywidgets as widgets
from IPython.display import display
# Create slider widget
radius_slider = widgets.IntSlider(
value=5,
min=1,
max=20,
step=1,
description='Radius:'
)
# Function to update based on slider
def update_circle_area(radius):
area = math.pi * radius ** 2
print(f"Circle area with radius {radius}: {area:.2f}")
# Create interactive widget
widgets.interact(update_circle_area, radius=radius_slider)
# Custom interactive plots with Plotly
import plotly.graph_objects as go
import plotly.express as px
# Create interactive scatter plot
fig = px.scatter(
x=[1, 2, 3, 4, 5],
y=[2, 4, 1, 3, 5],
title="Interactive Scatter Plot",
hover_data=['Point 1', 'Point 2', 'Point 3', 'Point 4', 'Point 5']
)
fig.show()
# Connect to databases and APIs
import requests
import sqlite3
# API data fetching
def fetch_weather_data(city):
api_key = "your_api_key"
url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}"
response = requests.get(url)
return response.json()
# Database connections
conn = sqlite3.connect('course_data.db')
query = "SELECT * FROM student_scores WHERE course_id = 'CS101'"
df = pd.read_sql_query(query, conn)
- Click "Export" in the toolbar
- Select "PDF Report"
-
Choose export options:
- Include code cells
- Include output
- Include markdown
- Download the generated PDF
# Command line export (for advanced users)
intelligent-ide export notebook.ipynb --format html --include-code --include-output
- Connect your GitHub account
- Select repository and branch
- Choose export format (notebook, markdown, script)
- Push to repository
- Click "Share" button
-
Set permissions:
- 🔗 View only: Others can see but not edit
- ✏️ Edit access: Others can modify content
- 🎓 Student access: Restricted editing for assignments
- Copy link and share with others
<!-- Embed notebook in external website -->
<iframe
src="https://intelligent-ide.edu/embed/notebook/abc123"
width="100%"
height="600px"
frameborder="0">
</iframe>
# Good Notebook Structure
## 1. Introduction and Overview
- Purpose of the notebook
- Learning objectives
- Prerequisites
## 2. Setup and Imports
- Import necessary libraries
- Define constants and configurations
## 3. Main Content
- Organized into logical sections
- Clear headings and documentation
## 4. Exercises/Activities
- Interactive elements
- Practice problems
## 5. Conclusion
- Summary of key points
- Next steps or additional resources
- Keep cells focused: One concept per cell
- Use descriptive comments: Explain your code
- Separate concerns: Data loading, processing, visualization
- Consistent naming: Use clear variable names
# Documentation Guidelines
## Code Comments
- Explain **why**, not just **what**
- Use docstrings for functions
- Comment complex algorithms
## Markdown Cells
- Provide context and explanations
- Use headers for organization
- Include learning objectives
- Add relevant links and resources
- Communicate changes: Use descriptive checkpoint messages
- Respect others' work: Don't delete without discussion
- Use chat feature: Coordinate real-time editing
- Test before sharing: Ensure code runs correctly
# Example of well-documented collaborative code
def analyze_student_performance(scores_df):
"""
Analyze student performance data and generate insights.
Args:
scores_df (pandas.DataFrame): DataFrame with student scores
Returns:
dict: Analysis results including mean, median, and distribution
Author: Alice Chen
Last modified: 2024-01-15
Review: Bob Smith approved changes
"""
# Implementation here...
pass
# Check notebook service status
curl -X GET "/api/notebooks/health"
# Clear browser cache and refresh
# Or try incognito/private browsing mode
# Debug execution environment
import sys
print("Python version:", sys.version)
print("Available packages:", [pkg for pkg in sys.modules if not pkg.startswith('_')])
# Check memory usage
import psutil
print(f"Memory usage: {psutil.virtual_memory().percent}%")
- Refresh the notebook browser tab
- Check internet connection stability
- Save checkpoint and reload
- Contact instructor if issues persist
# Optimize notebook performance
# 1. Clear unused variables
del large_dataset
# 2. Use generators for large data
data_generator = (x for x in range(1000000))
# 3. Profile code execution
%timeit your_function()
# 4. Monitor memory usage
%memit your_function()
After completing this tutorial, you should be able to:
- ✅ Create different types of notebooks
- ✅ Add and manage various cell types
- ✅ Collaborate with others in real-time
- ✅ Export and share your work
- ✅ Follow best practices for notebook organization
- Working with Notebooks - Advanced notebook features
- Submitting Assignments - How to submit notebook assignments
- Using Q&A System - Getting help with your notebooks
Happy notebook creation! 🎉
🏠 Home
- Getting Started
- Installation Guide
- Authentication
- Course Management
- Collaborative Editing
- Assignments
- Notebook Features
- File Management
- Troubleshooting
- Setup & Development
- Architecture Overview
- Backend Development
- Frontend Development
- API Reference
- Contributing
- Deployment