Improve intro, add preliminaries.

This commit is contained in:
lxobr 2025-09-07 13:45:10 +02:00
parent ef54ef2304
commit 2a2d84c147

View file

@ -4,10 +4,9 @@
"metadata": {},
"cell_type": "markdown",
"source": [
"# Turn expert developer Python knowhow into an AI Memory that will make your own code better. \n",
"# Using Cognee with Python Development Data\n",
"\n",
"\n",
"### Learning from Guido van Rossum, the creator of Python"
"Unite authoritative Python practice (Guido van Rossum's own contributions!), normative guidance (Zen/PEP8), and your lived context (rules + conversations) into one *AI memory* that produces answers that are relevant, explainable, and consistent."
],
"id": "6f22c8fe6d92cfcc"
},
@ -32,7 +31,7 @@
"metadata": {},
"cell_type": "markdown",
"source": [
"## Understanding the Cognee Ecosystem\n",
"## Cognee and its core operations\n",
"\n",
"Before we dive in, let's understand the key components we'll be working with:\n",
"\n",
@ -50,14 +49,15 @@
"metadata": {},
"cell_type": "markdown",
"source": [
"### Why This Approach Works\n",
"## Data used in this tutorial\n",
"\n",
"Traditional coding assistants lack context about your specific projects, rules, and past decisions. By building a knowledge graph of development history from Python's creator, we create an AI that understands:\n",
"Cognee can ingest many types of sources. In this tutorial, we use a small, concrete set of files that cover different perspectives:\n",
"\n",
"- Guido's coding patterns and Python design philosophy\n",
"- How language features evolved and why\n",
"- Best practices derived from decades of Python development\n",
"- Connections between different aspects of Python programming"
"- **`guido_contributions.json` — Authoritative exemplars.** Real PRs and commits from Guido van Rossum (mypy, CPython). These show how Pythons creator solved problems and provide concrete anchors for patterns.\n",
"- **`pep_style_guide.md` — Norms.** Encodes community style and typing conventions (PEP8 and related). Ensures that search results and inferred rules align with widely accepted standards.\n",
"- **`zen_principles.md` — Philosophy.** The Zen of Python. Grounds design tradeoffs (simplicity, explicitness, readability) beyond syntax or mechanics.\n",
"- **`my_developer_rules.md` — Local constraints.** Your house rules, conventions, and projectspecific requirements (scope, privacy, Spec.md). Keeps recommendations relevant to your actual workflow.\n",
"- **`copilot_conversations.json` — Personal history.** Transcripts of real assistant conversations, including your questions, code snippets, and discussion topics. Captures “how you code” and connects it to “how Guido codes.”"
],
"id": "6a7669fbb6a3e6c7"
},
@ -65,13 +65,34 @@
"metadata": {},
"cell_type": "markdown",
"source": [
"### Exploring Guido's Python Contributions\n",
"# Prelinimiaries\n",
"\n",
"We'll begin with a pre-loaded dataset containing Guido van Rossum's contributions to the Python ecosystem. This demonstrates how cognee structures and connects development activity from Python's creator.\n",
"\n",
"Take a moment to explore the repositories this user contributed to with the Graph Visualizaiton"
"Cognee relies heavily on async functions.\n",
"We need `nest_asyncio` so `await` works in this notebook."
],
"id": "93c9783037715026"
"id": "2a5dac2c6fdc7ca7"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T11:43:21.615213Z",
"start_time": "2025-09-07T11:43:21.600122Z"
}
},
"cell_type": "code",
"source": [
"import nest_asyncio\n",
"nest_asyncio.apply()"
],
"id": "20cb02b49e3c53e2",
"outputs": [],
"execution_count": 20
},
{
"metadata": {},
"cell_type": "markdown",
"source": "We will do a quick import check.",
"id": "45e1caaec20c9518"
},
{
"metadata": {
@ -129,6 +150,12 @@
],
"execution_count": 1
},
{
"metadata": {},
"cell_type": "markdown",
"source": "And just to be safe, we will make sure that the path contains the root directory, so Python can find everything it needs to run the notebook.",
"id": "76895c6570d1a4dc"
},
{
"metadata": {
"ExecuteTime": {
@ -165,6 +192,35 @@
],
"execution_count": 2
},
{
"metadata": {},
"cell_type": "markdown",
"source": "Finally, we will begin with a clean slate, by removing any previous Cognee data:",
"id": "af584b935cbdc8d"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"await cognee.prune.prune_data()\n",
"await cognee.prune.prune_system(metadata=True)"
],
"id": "dd47383aa9519465"
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"### Exploring Guido's Python Contributions\n",
"\n",
"We'll begin with a document that contains detailed PRs and commits from Guido van Rossum's work on mypy and CPython, showing real-world examples of Python's creator solving type system and language design challenges.\n",
"\n",
"We'll use Cognee's `add()` and `cognify()` functions to ingest this data and build a knowledge graph that connects Guido's development patterns with Python best practices."
],
"id": "93c9783037715026"
},
{
"metadata": {
"ExecuteTime": {