yt-study 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. yt_study-0.1.1/.env.example +16 -0
  2. yt_study-0.1.1/.github/workflows/ci.yml +34 -0
  3. yt_study-0.1.1/.github/workflows/release.yml +39 -0
  4. yt_study-0.1.1/.gitignore +11 -0
  5. yt_study-0.1.1/.python-version +1 -0
  6. yt_study-0.1.1/LICENSE +21 -0
  7. yt_study-0.1.1/PKG-INFO +180 -0
  8. yt_study-0.1.1/README.md +151 -0
  9. yt_study-0.1.1/pyproject.toml +74 -0
  10. yt_study-0.1.1/src/yt_study/__init__.py +3 -0
  11. yt_study-0.1.1/src/yt_study/cli.py +187 -0
  12. yt_study-0.1.1/src/yt_study/config.py +100 -0
  13. yt_study-0.1.1/src/yt_study/llm/__init__.py +1 -0
  14. yt_study-0.1.1/src/yt_study/llm/generator.py +294 -0
  15. yt_study-0.1.1/src/yt_study/llm/providers.py +107 -0
  16. yt_study-0.1.1/src/yt_study/pipeline/__init__.py +1 -0
  17. yt_study-0.1.1/src/yt_study/pipeline/orchestrator.py +307 -0
  18. yt_study-0.1.1/src/yt_study/prompts/__init__.py +1 -0
  19. yt_study-0.1.1/src/yt_study/prompts/chapter_notes.py +56 -0
  20. yt_study-0.1.1/src/yt_study/prompts/study_notes.py +81 -0
  21. yt_study-0.1.1/src/yt_study/setup_wizard.py +340 -0
  22. yt_study-0.1.1/src/yt_study/youtube/__init__.py +1 -0
  23. yt_study-0.1.1/src/yt_study/youtube/metadata.py +130 -0
  24. yt_study-0.1.1/src/yt_study/youtube/parser.py +94 -0
  25. yt_study-0.1.1/src/yt_study/youtube/playlist.py +60 -0
  26. yt_study-0.1.1/src/yt_study/youtube/transcript.py +186 -0
  27. yt_study-0.1.1/tests/__init__.py +1 -0
  28. yt_study-0.1.1/tests/conftest.py +15 -0
  29. yt_study-0.1.1/tests/test_llm/__init__.py +1 -0
  30. yt_study-0.1.1/tests/test_pipeline/__init__.py +1 -0
  31. yt_study-0.1.1/tests/test_youtube/__init__.py +1 -0
  32. yt_study-0.1.1/tests/test_youtube/test_parser.py +81 -0
  33. yt_study-0.1.1/uv.lock +2076 -0
@@ -0,0 +1,16 @@
1
+ # Environment Variables Template
2
+ # Copy this to .env and fill in your API keys
3
+
4
+ # Required: At least one LLM API key (Gemini is the default provider)
5
+ GEMINI_API_KEY=your_gemini_key_here
6
+
7
+ # Optional: Other LLM Providers
8
+ # OPENAI_API_KEY=your_openai_key_here
9
+ # ANTHROPIC_API_KEY=your_anthropic_key_here
10
+ # GROQ_API_KEY=your_groq_key_here
11
+ # XAI_API_KEY=your_xai_key_here
12
+ # MISTRAL_API_KEY=your_mistral_key_here
13
+
14
+ # Custom API Endpoints (if using custom providers)
15
+ # CUSTOM_API_BASE=https://your-custom-endpoint.com/v1
16
+ # CUSTOM_API_KEY=your_custom_key_here
@@ -0,0 +1,34 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v2
21
+ with:
22
+ enable-cache: true
23
+ cache-dependency-glob: "uv.lock"
24
+
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ run: uv python install ${{ matrix.python-version }}
27
+
28
+ - name: Install dependencies
29
+ run: |
30
+ uv sync --all-extras --dev
31
+
32
+ - name: Run tests
33
+ run: |
34
+ uv run pytest
@@ -0,0 +1,39 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ build-n-publish:
10
+ name: Build and publish to PyPI
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: write # For creating GitHub Release
14
+ id-token: write # For PyPI OIDC (optional, using token for now)
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v2
21
+
22
+ - name: Set up Python
23
+ run: uv python install 3.10
24
+
25
+ - name: Build package
26
+ run: |
27
+ uv build
28
+
29
+ - name: Publish to PyPI
30
+ uses: pypa/gh-action-pypi-publish@release/v1
31
+ with:
32
+ user: __token__
33
+ password: ${{ secrets.PYPI_API_TOKEN }}
34
+
35
+ - name: Create GitHub Release
36
+ uses: softprops/action-gh-release@v1
37
+ if: startsWith(github.ref, 'refs/tags/')
38
+ with:
39
+ generate_release_notes: true
@@ -0,0 +1,11 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+ .env
@@ -0,0 +1 @@
1
+ 3.13
yt_study-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yt-study contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: yt-study
3
+ Version: 0.1.1
4
+ Summary: Convert YouTube videos into AI-powered study notes with chapter support
5
+ Author-email: whoisjayd <email@example.com>
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Keywords: ai,education,llm,notes,study,transcript,youtube
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Education
11
+ Classifier: Intended Audience :: End Users/Desktop
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Education
19
+ Classifier: Topic :: Multimedia :: Video
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: aiohttp>=3.11.11
22
+ Requires-Dist: litellm>=1.81.1
23
+ Requires-Dist: pytubefix>=10.3.6
24
+ Requires-Dist: rich>=13.9.4
25
+ Requires-Dist: tiktoken>=0.8.0
26
+ Requires-Dist: typer>=0.21.1
27
+ Requires-Dist: youtube-transcript-api>=1.2.3
28
+ Description-Content-Type: text/markdown
29
+
30
+ # 🎓 yt-study
31
+
32
+ [![PyPI version](https://badge.fury.io/py/yt-study.svg)](https://badge.fury.io/py/yt-study)
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
34
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
35
+ [![CI Status](https://github.com/whoisjayd/yt-study/actions/workflows/ci.yml/badge.svg)](https://github.com/whoisjayd/yt-study/actions)
36
+
37
+ > **Convert YouTube videos and playlists into comprehensive, academic-grade study notes using AI.**
38
+
39
+ `yt-study` is a powerful CLI tool that transforms educational video content into structured, high-quality study materials. It supports massive videos (10h+), playlists, and multiple languages, using state-of-the-art LLMs.
40
+
41
+ ---
42
+
43
+ ## ✨ Features
44
+
45
+ - **🧠 Multi-Model Support**: Works with Gemini 1.5/2.0, GPT-4o, Claude 3.5, Groq, and more via LiteLLM.
46
+ - **📚 Chapter-Aware**: Automatically detects chapters in long videos (>1hr) and creates separate, detailed notes for each.
47
+ - **🧩 Smart Chunking**: Robustly handles transcripts of any length (even 20k+ tokens) without losing context.
48
+ - **🌍 Auto-Translation**: Processes videos in any language (e.g., Hindi, Spanish) and generates notes in **English**.
49
+ - **💻 SQL & Code Preservation**: Specifically tuned to preserve code blocks, SQL schemas, and technical syntax.
50
+ - **⚡ Async Pipeline**: Process playlists concurrently for maximum speed.
51
+
52
+ ---
53
+
54
+ ## 🚀 Quick Start
55
+
56
+ ### 1. Installation
57
+
58
+ ```bash
59
+ pip install yt-study
60
+ ```
61
+
62
+ ### 2. Setup (One-time)
63
+
64
+ Run the interactive wizard to configure your preferred LLM and API keys:
65
+
66
+ ```bash
67
+ yt-study setup
68
+ ```
69
+
70
+ ### 3. Generate Notes
71
+
72
+ **Single Video:**
73
+ ```bash
74
+ yt-study process "https://youtube.com/watch?v=VIDEO_ID"
75
+ ```
76
+
77
+ **Entire Playlist:**
78
+ ```bash
79
+ yt-study process "https://youtube.com/playlist?list=PLAYLIST_ID"
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 🛠 CLI Reference
85
+
86
+ **Primary Command:**
87
+ `yt-study [COMMAND] [OPTIONS]`
88
+
89
+ | Command | Description | Usage Example |
90
+ | :--- | :--- | :--- |
91
+ | **`process`** | Generate notes from URL | `yt-study process "URL"` |
92
+ | **`setup`** | Configure API keys & model | `yt-study setup` |
93
+ | **`config-path`** | Show config file location | `yt-study config-path` |
94
+ | **`version`** | Show version info | `yt-study version` |
95
+
96
+ ### **`process` Options**
97
+
98
+ | Option | Description |
99
+ | :--- | :--- |
100
+ | `--model <name>` / `-m` | Override default model (e.g. `gpt-4o`) |
101
+ | `--language <code>` / `-l` | Preferred transcript language (default: `en`). Can be used multiple times. |
102
+ | `--output <path>` / `-o` | Custom output directory |
103
+ | `--help` | Show help message |
104
+
105
+ **Example with options:**
106
+ ```bash
107
+ yt-study process "URL" --model anthropic/claude-3-5-sonnet-20241022 --output ./my-course-notes
108
+ ```
109
+
110
+ ---
111
+
112
+ ## 📂 Output Structure
113
+
114
+ Organized automatically for easy navigation.
115
+
116
+ **📺 Single Video**
117
+ ```
118
+ output/
119
+ └── Video Title/
120
+ └── Video Title.md # Comprehensive notes
121
+ ```
122
+
123
+ **📖 Long Video (Chaptered)**
124
+ ```
125
+ output/
126
+ └── Complete DBMS Course/
127
+ ├── 01_Introduction.md
128
+ ├── 02_ER_Diagrams.md
129
+ └── 03_Normalization.md
130
+ ```
131
+
132
+ **📑 Playlist**
133
+ ```
134
+ output/
135
+ └── Playlist Name/
136
+ ├── Video 1.md
137
+ ├── Video 2.md
138
+ └── Video 3.md
139
+ ```
140
+
141
+ ---
142
+
143
+ ## ⚙️ Configuration
144
+
145
+ Config is stored in `~/.yt-study/config.env`.
146
+
147
+ **Supported Providers:**
148
+ - **Google Gemini** (Recommended for free tier)
149
+ - **OpenAI**
150
+ - **Anthropic**
151
+ - **Groq**
152
+ - **Mistral**
153
+ - **xAI (Grok)**
154
+
155
+ To re-run setup:
156
+ ```bash
157
+ yt-study setup --force
158
+ ```
159
+
160
+ ---
161
+
162
+ ## 👨‍💻 Development
163
+
164
+ Requirements: Python 3.10+
165
+
166
+ ```bash
167
+ # Clone repo
168
+ git clone https://github.com/whoisjayd/yt-study.git
169
+ cd yt-study
170
+
171
+ # Install dependencies (using uv is recommended)
172
+ pip install uv
173
+ uv sync
174
+
175
+ # Run tests
176
+ uv run pytest
177
+
178
+ # Run locally
179
+ uv run yt-study --help
180
+ ```
@@ -0,0 +1,151 @@
1
+ # 🎓 yt-study
2
+
3
+ [![PyPI version](https://badge.fury.io/py/yt-study.svg)](https://badge.fury.io/py/yt-study)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
6
+ [![CI Status](https://github.com/whoisjayd/yt-study/actions/workflows/ci.yml/badge.svg)](https://github.com/whoisjayd/yt-study/actions)
7
+
8
+ > **Convert YouTube videos and playlists into comprehensive, academic-grade study notes using AI.**
9
+
10
+ `yt-study` is a powerful CLI tool that transforms educational video content into structured, high-quality study materials. It supports massive videos (10h+), playlists, and multiple languages, using state-of-the-art LLMs.
11
+
12
+ ---
13
+
14
+ ## ✨ Features
15
+
16
+ - **🧠 Multi-Model Support**: Works with Gemini 1.5/2.0, GPT-4o, Claude 3.5, Groq, and more via LiteLLM.
17
+ - **📚 Chapter-Aware**: Automatically detects chapters in long videos (>1hr) and creates separate, detailed notes for each.
18
+ - **🧩 Smart Chunking**: Robustly handles transcripts of any length (even 20k+ tokens) without losing context.
19
+ - **🌍 Auto-Translation**: Processes videos in any language (e.g., Hindi, Spanish) and generates notes in **English**.
20
+ - **💻 SQL & Code Preservation**: Specifically tuned to preserve code blocks, SQL schemas, and technical syntax.
21
+ - **⚡ Async Pipeline**: Process playlists concurrently for maximum speed.
22
+
23
+ ---
24
+
25
+ ## 🚀 Quick Start
26
+
27
+ ### 1. Installation
28
+
29
+ ```bash
30
+ pip install yt-study
31
+ ```
32
+
33
+ ### 2. Setup (One-time)
34
+
35
+ Run the interactive wizard to configure your preferred LLM and API keys:
36
+
37
+ ```bash
38
+ yt-study setup
39
+ ```
40
+
41
+ ### 3. Generate Notes
42
+
43
+ **Single Video:**
44
+ ```bash
45
+ yt-study process "https://youtube.com/watch?v=VIDEO_ID"
46
+ ```
47
+
48
+ **Entire Playlist:**
49
+ ```bash
50
+ yt-study process "https://youtube.com/playlist?list=PLAYLIST_ID"
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 🛠 CLI Reference
56
+
57
+ **Primary Command:**
58
+ `yt-study [COMMAND] [OPTIONS]`
59
+
60
+ | Command | Description | Usage Example |
61
+ | :--- | :--- | :--- |
62
+ | **`process`** | Generate notes from URL | `yt-study process "URL"` |
63
+ | **`setup`** | Configure API keys & model | `yt-study setup` |
64
+ | **`config-path`** | Show config file location | `yt-study config-path` |
65
+ | **`version`** | Show version info | `yt-study version` |
66
+
67
+ ### **`process` Options**
68
+
69
+ | Option | Description |
70
+ | :--- | :--- |
71
+ | `--model <name>` / `-m` | Override default model (e.g. `gpt-4o`) |
72
+ | `--language <code>` / `-l` | Preferred transcript language (default: `en`). Can be used multiple times. |
73
+ | `--output <path>` / `-o` | Custom output directory |
74
+ | `--help` | Show help message |
75
+
76
+ **Example with options:**
77
+ ```bash
78
+ yt-study process "URL" --model anthropic/claude-3-5-sonnet-20241022 --output ./my-course-notes
79
+ ```
80
+
81
+ ---
82
+
83
+ ## 📂 Output Structure
84
+
85
+ Organized automatically for easy navigation.
86
+
87
+ **📺 Single Video**
88
+ ```
89
+ output/
90
+ └── Video Title/
91
+ └── Video Title.md # Comprehensive notes
92
+ ```
93
+
94
+ **📖 Long Video (Chaptered)**
95
+ ```
96
+ output/
97
+ └── Complete DBMS Course/
98
+ ├── 01_Introduction.md
99
+ ├── 02_ER_Diagrams.md
100
+ └── 03_Normalization.md
101
+ ```
102
+
103
+ **📑 Playlist**
104
+ ```
105
+ output/
106
+ └── Playlist Name/
107
+ ├── Video 1.md
108
+ ├── Video 2.md
109
+ └── Video 3.md
110
+ ```
111
+
112
+ ---
113
+
114
+ ## ⚙️ Configuration
115
+
116
+ Config is stored in `~/.yt-study/config.env`.
117
+
118
+ **Supported Providers:**
119
+ - **Google Gemini** (Recommended for free tier)
120
+ - **OpenAI**
121
+ - **Anthropic**
122
+ - **Groq**
123
+ - **Mistral**
124
+ - **xAI (Grok)**
125
+
126
+ To re-run setup:
127
+ ```bash
128
+ yt-study setup --force
129
+ ```
130
+
131
+ ---
132
+
133
+ ## 👨‍💻 Development
134
+
135
+ Requirements: Python 3.10+
136
+
137
+ ```bash
138
+ # Clone repo
139
+ git clone https://github.com/whoisjayd/yt-study.git
140
+ cd yt-study
141
+
142
+ # Install dependencies (using uv is recommended)
143
+ pip install uv
144
+ uv sync
145
+
146
+ # Run tests
147
+ uv run pytest
148
+
149
+ # Run locally
150
+ uv run yt-study --help
151
+ ```
@@ -0,0 +1,74 @@
1
+ [project]
2
+ name = "yt-study"
3
+ version = "0.1.1"
4
+ description = "Convert YouTube videos into AI-powered study notes with chapter support"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = {text = "MIT"}
8
+ authors = [
9
+ {name = "whoisjayd", email = "email@example.com"}
10
+ ]
11
+ keywords = ["youtube", "study", "notes", "ai", "llm", "education", "transcript"]
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Education",
15
+ "Intended Audience :: End Users/Desktop",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Education",
23
+ "Topic :: Multimedia :: Video",
24
+ ]
25
+ dependencies = [
26
+ "youtube-transcript-api>=1.2.3",
27
+ "pytubefix>=10.3.6",
28
+ "litellm>=1.81.1",
29
+ "typer>=0.21.1",
30
+ "rich>=13.9.4",
31
+ "aiohttp>=3.11.11",
32
+ "tiktoken>=0.8.0",
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+
37
+ [dependency-groups]
38
+ dev = [
39
+ "pytest>=9.0.0",
40
+ "pytest-cov>=6.0.0",
41
+ "pytest-asyncio>=1.3.0",
42
+ "pytest-mock>=3.14.0",
43
+ ]
44
+
45
+ [project.scripts]
46
+ yt-study = "yt_study.cli:app"
47
+
48
+ [build-system]
49
+ requires = ["hatchling"]
50
+ build-backend = "hatchling.build"
51
+
52
+ [tool.pytest.ini_options]
53
+ asyncio_mode = "auto"
54
+ asyncio_default_fixture_loop_scope = "function"
55
+ testpaths = ["tests"]
56
+ python_files = "test_*.py"
57
+ python_classes = "Test*"
58
+ python_functions = "test_*"
59
+
60
+ [tool.coverage.run]
61
+ source = ["src/yt_study"]
62
+ omit = ["*/tests/*", "*/__pycache__/*"]
63
+ concurrency = ["thread", "gevent"]
64
+
65
+ [tool.coverage.report]
66
+ exclude_lines = [
67
+ "pragma: no cover",
68
+ "def __repr__",
69
+ "raise AssertionError",
70
+ "raise NotImplementedError",
71
+ "if __name__ == .__main__.:",
72
+ "if TYPE_CHECKING:",
73
+ "async def",
74
+ ]
@@ -0,0 +1,3 @@
1
+ """YouTube Study Material Pipeline - Main package."""
2
+
3
+ __version__ = "0.1.0"