Compare commits

...
Sign in to create a new pull request.

19 commits

Author SHA1 Message Date
Daulet Amirkhanov
fe9fb88f97 repack updated starter_tutorial.zip 2025-09-19 17:39:41 +01:00
Daulet Amirkhanov
925615b1ce chore: update starter tutorial to properly use sdk search output 2025-09-19 17:37:13 +01:00
Daulet Amirkhanov
8f008a5899 repack starter_tutorial.zip 2025-09-18 19:58:17 +01:00
Daulet Amirkhanov
fdd76b74df tutorial notebook: version stripped of Markdown and simplified 2025-09-18 19:53:45 +01:00
Daulet Amirkhanov
2e45f62b4e update starter_tutorial.zip 2025-09-18 19:04:44 +01:00
Daulet Amirkhanov
b1c370a6ad tutorial notebook - update code cells to be self-contained (imports and var references) 2025-09-18 18:58:52 +01:00
Daulet Amirkhanov
34d4be9aba tutorial zip - repack it to remove unnecessary metadata and extra folder layer 2025-09-17 22:34:17 +01:00
Daulet Amirkhanov
7da4ee2a85 create zip version for starter tutorial notebook along w/ data 2025-09-16 17:27:50 +01:00
lxobr
dfa3203af5 revert temporal retriever fix 2025-09-07 17:10:52 +02:00
lxobr
81527cdd73 Include more examples 2025-09-07 16:45:18 +02:00
lxobr
2233a646ba Merge branch 'notebook_tutorial_improvements' into notebook_tutorial
# Conflicts:
#	notebooks/tutorial.ipynb
2025-09-07 15:20:27 +02:00
lxobr
d165649e03 update 2025-09-07 15:18:54 +02:00
lxobr
5224ec75c6 fix: fix return value in TemporalRetriever 2025-09-07 15:05:50 +02:00
lxobr
1cabd22ac8 Working draft 2025-09-07 14:15:38 +02:00
lxobr
2a2d84c147 Improve intro, add preliminaries. 2025-09-07 13:45:10 +02:00
vasilije
9ef838217c added issue with path fixes 2025-09-07 13:32:39 +02:00
lxobr
ef54ef2304 temp 2025-09-07 13:32:05 +02:00
vasilije
4100df9f50 added fix 2025-09-07 11:56:57 +02:00
vasilije
07bcf43259 added fix 2025-09-06 02:01:49 -07:00
8 changed files with 3474 additions and 0 deletions

View file

@ -0,0 +1,108 @@
{
"conversations": [
{
"id": "conv_001",
"timestamp": "2024-01-15T10:30:00Z",
"topic": "async/await patterns",
"user_query": "I'm building a web scraper that needs to handle thousands of URLs concurrently. What's the best way to structure this with asyncio?",
"assistant_response": "For high-concurrency web scraping, you'll want to use asyncio with aiohttp and implement proper semaphore-based rate limiting. Here's a robust pattern:\n\n```python\nimport asyncio\nimport aiohttp\nfrom typing import List, Dict, Any\n\nclass AsyncWebScraper:\n def __init__(self, max_concurrent: int = 100):\n self.semaphore = asyncio.Semaphore(max_concurrent)\n self.session = None\n \n async def __aenter__(self):\n self.session = aiohttp.ClientSession(\n timeout=aiohttp.ClientTimeout(total=30),\n connector=aiohttp.TCPConnector(limit=100)\n )\n return self\n \n async def __aexit__(self, exc_type, exc_val, exc_tb):\n if self.session:\n await self.session.close()\n \n async def fetch_url(self, url: str) -> Dict[str, Any]:\n async with self.semaphore:\n try:\n async with self.session.get(url) as response:\n content = await response.text()\n return {\n 'url': url,\n 'status': response.status,\n 'content': content,\n 'headers': dict(response.headers)\n }\n except Exception as e:\n return {'url': url, 'error': str(e)}\n \n async def scrape_urls(self, urls: List[str]) -> List[Dict[str, Any]]:\n tasks = [self.fetch_url(url) for url in urls]\n return await asyncio.gather(*tasks, return_exceptions=True)\n\n# Usage\nasync def main():\n urls = ['http://example.com'] * 1000 # Your URLs here\n \n async with AsyncWebScraper(max_concurrent=50) as scraper:\n results = await scraper.scrape_urls(urls)\n \n successful = [r for r in results if 'error' not in r]\n print(f'Successfully scraped {len(successful)} URLs')\n\nif __name__ == '__main__':\n asyncio.run(main())\n```\n\nKey points:\n- Semaphore controls concurrency to avoid overwhelming servers\n- Context manager ensures proper cleanup\n- TCPConnector with connection pooling\n- Proper exception handling for failed requests",
"code_context": {
"file": "scraper.py",
"language": "python",
"patterns_discussed": ["async/await", "context_managers", "semaphores", "aiohttp", "error_handling"]
},
"follow_up_questions": [
"How do I add retry logic for failed requests?",
"What's the best way to parse the scraped HTML content?"
]
},
{
"id": "conv_002",
"timestamp": "2024-01-16T14:20:00Z",
"topic": "dataclass vs pydantic",
"user_query": "When should I use dataclasses vs Pydantic models? I'm building an API and need to handle user input validation.",
"assistant_response": "Great question! For API development with input validation, here's when to use each:\n\n**Use Pydantic when:**\n- Building APIs (FastAPI, Django REST)\n- Need runtime validation of external data\n- Want automatic JSON serialization/deserialization\n- Need complex validation rules\n- Working with configuration files\n\n**Use dataclasses when:**\n- Internal data structures\n- Simple data containers\n- Want to stay in stdlib\n- Performance is critical (dataclasses are faster)\n\nFor your API, I'd recommend Pydantic:\n\n```python\nfrom pydantic import BaseModel, validator, Field\nfrom typing import Optional, List\nfrom datetime import datetime\nfrom enum import Enum\n\nclass UserRole(str, Enum):\n ADMIN = 'admin'\n USER = 'user'\n GUEST = 'guest'\n\nclass CreateUserRequest(BaseModel):\n username: str = Field(..., min_length=3, max_length=50, regex=r'^[a-zA-Z0-9_]+$')\n email: str = Field(..., regex=r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$')\n password: str = Field(..., min_length=8)\n role: UserRole = UserRole.USER\n tags: Optional[List[str]] = None\n \n @validator('password')\n def validate_password(cls, v):\n if not any(c.isupper() for c in v):\n raise ValueError('Password must contain uppercase letter')\n if not any(c.isdigit() for c in v):\n raise ValueError('Password must contain digit')\n return v\n \n @validator('tags')\n def validate_tags(cls, v):\n if v and len(v) > 10:\n raise ValueError('Too many tags')\n return v\n\nclass User(BaseModel):\n id: int\n username: str\n email: str\n role: UserRole\n created_at: datetime\n is_active: bool = True\n \n class Config:\n orm_mode = True\n json_encoders = { datetime: lambda v: v.isoformat() }\n\n# FastAPI usage\nfrom fastapi import FastAPI, HTTPException\n\napp = FastAPI()\n\n@app.post('/users/', response_model=User)\nasync def create_user(user_data: CreateUserRequest):\n try:\n new_user = await create_user_in_db(user_data)\n return User.from_orm(new_user)\n except Exception as e:\n raise HTTPException(status_code=400, detail=str(e))\n```\n\nPydantic gives you:\n- Automatic request validation\n- Clear error messages\n- Type coercion\n- JSON Schema generation\n- IDE support with type hints",
"code_context": {
"file": "models.py",
"language": "python",
"patterns_discussed": ["pydantic", "dataclasses", "validation", "fastapi", "type_hints", "enums"]
},
"follow_up_questions": [
"How do I handle nested validation with Pydantic?",
"Can I use Pydantic with SQLAlchemy models?"
]
},
{
"id": "conv_003",
"timestamp": "2024-01-17T09:15:00Z",
"topic": "testing patterns",
"user_query": "I'm struggling with testing async code and database interactions. What's the best approach for pytest with async functions?",
"assistant_response": "Testing async code can be tricky! Here's a comprehensive approach using pytest-asyncio and proper test isolation...",
"code_context": {
"file": "test_users.py",
"language": "python",
"patterns_discussed": ["pytest", "async_testing", "fixtures", "mocking", "database_testing", "fastapi_testing"]
},
"follow_up_questions": [
"How do I test WebSocket connections?",
"What's the best way to test database migrations?"
]
},
{
"id": "conv_004",
"timestamp": "2024-01-18T16:45:00Z",
"topic": "performance optimization",
"user_query": "My FastAPI app is getting slow with large datasets. How can I optimize database queries and response times?",
"assistant_response": "Performance optimization in FastAPI apps typically involves several layers...",
"code_context": {
"file": "optimizations.py",
"language": "python",
"patterns_discussed": ["performance_optimization", "caching", "database_optimization", "async_patterns", "monitoring"]
},
"follow_up_questions": [
"How do I implement database connection pooling properly?",
"What's the best way to handle memory usage with large datasets?"
]
},
{
"id": "conv_005",
"timestamp": "2024-01-19T11:30:00Z",
"topic": "error handling and logging",
"user_query": "I need to implement proper error handling and logging across my Python application. What's the best approach for production-ready error management?",
"assistant_response": "Excellent question! Proper error handling and logging are crucial for production applications...",
"code_context": {
"file": "error_handling.py",
"language": "python",
"patterns_discussed": ["error_handling", "logging", "exceptions", "middleware", "decorators", "fastapi"]
},
"follow_up_questions": [
"How do I integrate this with external monitoring tools like Sentry?",
"What's the best way to handle errors in background tasks?"
]
}
],
"metadata": {
"total_conversations": 5,
"date_range": "2024-01-15 to 2024-01-19",
"topics_covered": [
"async/await patterns",
"dataclass vs pydantic",
"testing patterns",
"performance optimization",
"error handling and logging"
],
"code_patterns_discussed": [
"asyncio", "aiohttp", "semaphores", "context_managers",
"pydantic", "fastapi", "type_hints", "validation",
"pytest", "async_testing", "fixtures", "mocking",
"performance_optimization", "caching", "database_optimization",
"error_handling", "logging", "exceptions", "middleware"
],
"difficulty_levels": {
"beginner": 1,
"intermediate": 2,
"advanced": 2
}
}
}

976
notebooks/data/guido_contributions.json vendored Normal file
View file

@ -0,0 +1,976 @@
[
{
"type": "pr",
"repository": "mypy",
"title": "Re-work indirect dependencies",
"description": "Wow, this was quite a ride. Indirect dependencies were always supported kind of on best effort. This PR puts them on some principled foundation. It fixes three crashes and three stale types reported. All tests are quite weird/obscure, they are designed to expose the flaws in current logic (plus one test that passes on master, but it covers important corner case, so I add it just in case ). A short summary of various fixes (in arbitrary order):\r\n* Update many outdated comments and docstrings\r\n* Missing transitive dependency is now considered stale\r\n* Handle transitive generic bases in indirection visitor\r\n* Handle chained alias targets in indirection visitor\r\n* Always record original aliases during semantic analysis\r\n* Delete `qualified_tvars` as a concept, they are not needed since long ago\r\n* Remove ad-hoc handling for `TypeInfo`s from `build.py`\r\n* Support symbols with setter type different from getter type\r\n\r\nIn general the logic should be more simple/straightforward now:\r\n* Get all types in a file (need both symbol types _and_ expression types since some types may be only local)\r\n* For each type _transitively_ find all named types in them (thus aggregating all interfaces the type depends on)\r\n* In case any type was forced using `get_proper_type()`, record the orginal type alias during semantic analysis\r\n\r\nNote since this makes the algorithm correct, it may also make it slower (most notably because we must visit generic bases). I tried to offset this by couple optimizations, hopefully performance impact will be minimal.",
"url": "https://github.com/python/mypy/pull/19798",
"date": "2025-09-05T13:54:52Z",
"sha_or_number": "19798",
"files_changed": [
"mypy/build.py",
"mypy/fixup.py",
"mypy/indirection.py",
"mypy/nodes.py",
"mypy/semanal.py",
"mypy/server/deps.py",
"mypy/test/typefixture.py",
"mypy/typeanal.py",
"test-data/unit/check-incremental.test"
],
"additions": 0,
"deletions": 0,
"labels": [],
"related_issues": [],
"code_samples": [
{
"file_path": "mypy/build.py",
"language": "python",
"before_code": "from mypy.graph_utils import prepare_sccs, strongly_connected_components, topsort\nfrom mypy.indirection import TypeIndirectionVisitor\nfrom mypy.messages import MessageBuilder\nfrom mypy.nodes import Import, ImportAll, ImportBase, ImportFrom, MypyFile, SymbolTable, TypeInfo\nfrom mypy.partially_defined import PossiblyUndefinedVariableVisitor\nfrom mypy.semanal import SemanticAnalyzer\nfrom mypy.semanal_pass1 import SemanticAnalyzerPreAnalysis",
"after_code": "from mypy.graph_utils import prepare_sccs, strongly_connected_components, topsort\nfrom mypy.indirection import TypeIndirectionVisitor\nfrom mypy.messages import MessageBuilder\nfrom mypy.nodes import (\n Decorator,\n Import,\n ImportAll,\n ImportBase,\n ImportFrom,\n MypyFile,\n OverloadedFuncDef,\n SymbolTable,\n)\nfrom mypy.partially_defined import PossiblyUndefinedVariableVisitor\nfrom mypy.semanal import SemanticAnalyzer\nfrom mypy.semanal_pass1 import SemanticAnalyzerPreAnalysis",
"diff_context": "from mypy.graph_utils import prepare_sccs, strongly_connected_components, topsort\nfrom mypy.indirection import TypeIndirectionVisitor\nfrom mypy.messages import MessageBuilder\nfrom mypy.nodes import Import, ImportAll, ImportBase, ImportFrom, MypyFile, SymbolTable, TypeInfo\nfrom mypy.nodes import (\n Decorator,\n Import,\n ImportAll,\n ImportBase,\n ImportFrom,\n MypyFile,\n OverloadedFuncDef,\n SymbolTable,\n)\nfrom mypy.partially_defined import PossiblyUndefinedVariableVisitor\nfrom mypy.semanal import SemanticAnalyzer\nfrom mypy.semanal_pass1 import SemanticAnalyzerPreAnalysis",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "mypy/build.py",
"language": "python",
"before_code": "\nFor single nodes, processing is simple. If the node was cached, we\ndeserialize the cache data and fix up cross-references. Otherwise, we\ndo semantic analysis followed by type checking. We also handle (c)\nabove; if a module has valid cache data *but* any of its\ndependencies was processed from source, then the module should be\nprocessed from source.\n\nA relatively simple optimization (outside SCCs) we might do in the\nfuture is as follows: if a node's cache data is valid, but one or more\nof its dependencies are out of date so we have to re-parse the node\nfrom source, once we have fully type-checked the node, we can decide\nwhether its symbol table actually changed compared to the cache data\n(by reading the cache data and comparing it to the data we would be\nwriting). If there is no change we can declare the node up to date,\nand any node that depends (and for which we have cached data, and\nwhose other dependencies are up to date) on it won't need to be\nre-parsed from source.\n\nImport cycles\n-------------\n\nFinally we have to decide how to handle (c), import cycles. Here\nwe'll need a modified version of the original state machine\n(build.py), but we only need to do this per SCC, and we won't have to\ndeal with changes to the list of nodes while we're processing it.",
"after_code": "\nFor single nodes, processing is simple. If the node was cached, we\ndeserialize the cache data and fix up cross-references. Otherwise, we\ndo semantic analysis followed by type checking. Once we (re-)processed\nan SCC we check whether its interface (symbol table) is still fresh\n(matches previous cached value). If it is not, we consider dependent SCCs\nstale so that they need to be re-parsed as well.\n\nNote on indirect dependencies: normally dependencies are determined from\nimports, but since our type interfaces are \"opaque\" (i.e. symbol tables can\ncontain types identified by name), these are not enough. We *must* also\nadd \"indirect\" dependencies from types to their definitions. For this\npurpose, after we finished processing a module, we travers its type map and\nsymbol tables, and for each type we find (transitively) on which opaque/named\ntypes it depends.\n\nImport cycles\n-------------\n\nFinally we have to decide how to handle (b), import cycles. Here\nwe'll need a modified version of the original state machine\n(build.py), but we only need to do this per SCC, and we won't have to\ndeal with changes to the list of nodes while we're processing it.",
"diff_context": "\nFor single nodes, processing is simple. If the node was cached, we\ndeserialize the cache data and fix up cross-references. Otherwise, we\ndo semantic analysis followed by type checking. We also handle (c)\nabove; if a module has valid cache data *but* any of its\ndependencies was processed from source, then the module should be\nprocessed from source.\n\nA relatively simple optimization (outside SCCs) we might do in the\nfuture is as follows: if a node's cache data is valid, but one or more\nof its dependencies are out of date so we have to re-parse the node\nfrom source, once we have fully type-checked the node, we can decide\nwhether its symbol table actually changed compared to the cache data\n(by reading the cache data and comparing it to the data we would be\nwriting). If there is no change we can declare the node up to date,\nand any node that depends (and for which we have cached data, and\nwhose other dependencies are up to date) on it won't need to be\nre-parsed from source.\ndo semantic analysis followed by type checking. Once we (re-)processed\nan SCC we check whether its interface (symbol table) is still fresh\n(matches previous cached value). If it is not, we consider dependent SCCs\nstale so that they need to be re-parsed as well.\n\nNote on indirect dependencies: normally dependencies are determined from\nimports, but since our type interfaces are \"opaque\" (i.e. symbol tables can\ncontain types identified by name), these are not enough. We *must* also\nadd \"indirect\" dependencies from types to their definitions. For this\npurpose, after we finished processing a module, we travers its type map and\nsymbol tables, and for each type we find (transitively) on which opaque/named\ntypes it depends.\n\nImport cycles\n-------------\n\nFinally we have to decide how to handle (c), import cycles. Here\nFinally we have to decide how to handle (b), import cycles. Here\nwe'll need a modified version of the original state machine\n(build.py), but we only need to do this per SCC, and we won't have to\ndeal with changes to the list of nodes while we're processing it.",
"change_type": "modification",
"lines_of_context": 10,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": [
"generator_expression"
]
},
{
"file_path": "mypy/build.py",
"language": "python",
"before_code": "\n # We should always patch indirect dependencies, even in full (non-incremental) builds,\n # because the cache still may be written, and it must be correct.\n # TODO: find a more robust way to traverse *all* relevant types?\n all_types = list(self.type_map().values())\n for _, sym, _ in self.tree.local_definitions():\n if sym.type is not None:\n all_types.append(sym.type)\n if isinstance(sym.node, TypeInfo):\n # TypeInfo symbols have some extra relevant types.\n all_types.extend(sym.node.bases)\n if sym.node.metaclass_type:\n all_types.append(sym.node.metaclass_type)\n if sym.node.typeddict_type:\n all_types.append(sym.node.typeddict_type)\n if sym.node.tuple_type:\n all_types.append(sym.node.tuple_type)\n self._patch_indirect_dependencies(self.type_checker().module_refs, all_types)\n\n if self.options.dump_inference_stats:\n dump_type_stats(",
"after_code": "\n # We should always patch indirect dependencies, even in full (non-incremental) builds,\n # because the cache still may be written, and it must be correct.\n all_types = set(self.type_map().values())\n for _, sym, _ in self.tree.local_definitions():\n if sym.type is not None:\n all_types.add(sym.type)\n # Special case: settable properties may have two types.\n if isinstance(sym.node, OverloadedFuncDef) and sym.node.is_property:\n assert isinstance(first_node := sym.node.items[0], Decorator)\n if first_node.var.setter_type:\n all_types.add(first_node.var.setter_type)\n # Using mod_alias_deps is unfortunate but needed, since it is highly impractical\n # (and practically impossible) to avoid all get_proper_type() calls. For example,\n # TypeInfo.bases and metaclass, *args and **kwargs, Overloaded.items, and trivial\n # aliases like Text = str, etc. all currently forced to proper types. Thus, we need\n # to record the original definitions as they are first seen in semanal.py.\n self._patch_indirect_dependencies(\n self.type_checker().module_refs | self.tree.mod_alias_deps, all_types\n )\n\n if self.options.dump_inference_stats:\n dump_type_stats(",
"diff_context": "\n # We should always patch indirect dependencies, even in full (non-incremental) builds,\n # because the cache still may be written, and it must be correct.\n # TODO: find a more robust way to traverse *all* relevant types?\n all_types = list(self.type_map().values())\n all_types = set(self.type_map().values())\n for _, sym, _ in self.tree.local_definitions():\n if sym.type is not None:\n all_types.append(sym.type)\n if isinstance(sym.node, TypeInfo):\n # TypeInfo symbols have some extra relevant types.\n all_types.extend(sym.node.bases)\n if sym.node.metaclass_type:\n all_types.append(sym.node.metaclass_type)\n if sym.node.typeddict_type:\n all_types.append(sym.node.typeddict_type)\n if sym.node.tuple_type:\n all_types.append(sym.node.tuple_type)\n self._patch_indirect_dependencies(self.type_checker().module_refs, all_types)\n all_types.add(sym.type)\n # Special case: settable properties may have two types.\n if isinstance(sym.node, OverloadedFuncDef) and sym.node.is_property:\n assert isinstance(first_node := sym.node.items[0], Decorator)\n if first_node.var.setter_type:\n all_types.add(first_node.var.setter_type)\n # Using mod_alias_deps is unfortunate but needed, since it is highly impractical\n # (and practically impossible) to avoid all get_proper_type() calls. For example,\n # TypeInfo.bases and metaclass, *args and **kwargs, Overloaded.items, and trivial\n # aliases like Text = str, etc. all currently forced to proper types. Thus, we need\n # to record the original definitions as they are first seen in semanal.py.\n self._patch_indirect_dependencies(\n self.type_checker().module_refs | self.tree.mod_alias_deps, all_types\n )\n\n if self.options.dump_inference_stats:\n dump_type_stats(",
"change_type": "modification",
"lines_of_context": 8,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": [
"generator_expression"
]
},
{
"file_path": "mypy/build.py",
"language": "python",
"before_code": " self._type_checker.reset()\n self._type_checker = None\n\n def _patch_indirect_dependencies(self, module_refs: set[str], types: list[Type]) -> None:\n assert None not in types\n valid = self.valid_references()\n",
"after_code": " self._type_checker.reset()\n self._type_checker = None\n\n def _patch_indirect_dependencies(self, module_refs: set[str], types: set[Type]) -> None:\n assert None not in types\n valid = self.valid_references()\n",
"diff_context": " self._type_checker.reset()\n self._type_checker = None\n\n def _patch_indirect_dependencies(self, module_refs: set[str], types: list[Type]) -> None:\n def _patch_indirect_dependencies(self, module_refs: set[str], types: set[Type]) -> None:\n assert None not in types\n valid = self.valid_references()\n",
"change_type": "modification",
"lines_of_context": 6,
"function_name": "_patch_indirect_dependencies",
"class_name": null,
"docstring": null,
"coding_patterns": [
"function_definition"
]
},
{
"file_path": "mypy/build.py",
"language": "python",
"before_code": " for id in scc:\n deps.update(graph[id].dependencies)\n deps -= ascc\n stale_deps = {id for id in deps if id in graph and not graph[id].is_interface_fresh()}\n fresh = fresh and not stale_deps\n undeps = set()\n if fresh:",
"after_code": " for id in scc:\n deps.update(graph[id].dependencies)\n deps -= ascc\n # Note: if a dependency is not in graph anymore, it should be considered interface-stale.\n # This is important to trigger any relevant updates from indirect dependencies that were\n # removed in load_graph().\n stale_deps = {id for id in deps if id not in graph or not graph[id].is_interface_fresh()}\n fresh = fresh and not stale_deps\n undeps = set()\n if fresh:",
"diff_context": " for id in scc:\n deps.update(graph[id].dependencies)\n deps -= ascc\n stale_deps = {id for id in deps if id in graph and not graph[id].is_interface_fresh()}\n # Note: if a dependency is not in graph anymore, it should be considered interface-stale.\n # This is important to trigger any relevant updates from indirect dependencies that were\n # removed in load_graph().\n stale_deps = {id for id in deps if id not in graph or not graph[id].is_interface_fresh()}\n fresh = fresh and not stale_deps\n undeps = set()\n if fresh:",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": [
"generator_expression"
]
},
{
"file_path": "mypy/indirection.py",
"language": "python",
"before_code": " def __init__(self) -> None:\n # Module references are collected here\n self.modules: set[str] = set()\n # User to avoid infinite recursion with recursive type aliases\n self.seen_aliases: set[types.TypeAliasType] = set()\n # Used to avoid redundant work\n self.seen_fullnames: set[str] = set()\n\n def find_modules(self, typs: Iterable[types.Type]) -> set[str]:\n self.modules = set()\n self.seen_fullnames = set()\n self.seen_aliases = set()\n for typ in typs:\n self._visit(typ)\n return self.modules\n\n def _visit(self, typ: types.Type) -> None:\n if isinstance(typ, types.TypeAliasType):\n # Avoid infinite recursion for recursive type aliases.\n if typ not in self.seen_aliases:\n self.seen_aliases.add(typ)\n typ.accept(self)\n\n def _visit_type_tuple(self, typs: tuple[types.Type, ...]) -> None:\n # Micro-optimization: Specialized version of _visit for lists\n for typ in typs:\n if isinstance(typ, types.TypeAliasType):\n # Avoid infinite recursion for recursive type aliases.\n if typ in self.seen_aliases:\n continue\n self.seen_aliases.add(typ)\n typ.accept(self)\n\n def _visit_type_list(self, typs: list[types.Type]) -> None:\n # Micro-optimization: Specialized version of _visit for tuples\n for typ in typs:\n if isinstance(typ, types.TypeAliasType):\n # Avoid infinite recursion for recursive type aliases.\n if typ in self.seen_aliases:\n continue\n self.seen_aliases.add(typ)\n typ.accept(self)\n\n def _visit_module_name(self, module_name: str) -> None:",
"after_code": " def __init__(self) -> None:\n # Module references are collected here\n self.modules: set[str] = set()\n # User to avoid infinite recursion with recursive types\n self.seen_types: set[types.TypeAliasType | types.Instance] = set()\n # Used to avoid redundant work\n self.seen_fullnames: set[str] = set()\n\n def find_modules(self, typs: Iterable[types.Type]) -> set[str]:\n self.modules = set()\n self.seen_fullnames = set()\n self.seen_types = set()\n for typ in typs:\n self._visit(typ)\n return self.modules\n\n def _visit(self, typ: types.Type) -> None:\n # Note: instances are needed for `class str(Sequence[str]): ...`\n if (\n isinstance(typ, types.TypeAliasType)\n or isinstance(typ, types.ProperType)\n and isinstance(typ, types.Instance)\n ):\n # Avoid infinite recursion for recursive types.\n if typ in self.seen_types:\n return\n self.seen_types.add(typ)\n typ.accept(self)\n\n def _visit_type_tuple(self, typs: tuple[types.Type, ...]) -> None:\n # Micro-optimization: Specialized version of _visit for lists\n for typ in typs:\n if (\n isinstance(typ, types.TypeAliasType)\n or isinstance(typ, types.ProperType)\n and isinstance(typ, types.Instance)\n ):\n # Avoid infinite recursion for recursive types.\n if typ in self.seen_types:\n continue\n self.seen_types.add(typ)\n typ.accept(self)\n\n def _visit_type_list(self, typs: list[types.Type]) -> None:\n # Micro-optimization: Specialized version of _visit for tuples\n for typ in typs:\n if (\n isinstance(typ, types.TypeAliasType)\n or isinstance(typ, types.ProperType)\n and isinstance(typ, types.Instance)\n ):\n # Avoid infinite recursion for recursive types.\n if typ in self.seen_types:\n continue\n self.seen_types.add(typ)\n typ.accept(self)\n\n def _visit_module_name(self, module_name: str) -> None:",
"diff_context": " def __init__(self) -> None:\n # Module references are collected here\n self.modules: set[str] = set()\n # User to avoid infinite recursion with recursive type aliases\n self.seen_aliases: set[types.TypeAliasType] = set()\n # User to avoid infinite recursion with recursive types\n self.seen_types: set[types.TypeAliasType | types.Instance] = set()\n # Used to avoid redundant work\n self.seen_fullnames: set[str] = set()\n\n def find_modules(self, typs: Iterable[types.Type]) -> set[str]:\n self.modules = set()\n self.seen_fullnames = set()\n self.seen_aliases = set()\n self.seen_types = set()\n for typ in typs:\n self._visit(typ)\n return self.modules\n\n def _visit(self, typ: types.Type) -> None:\n if isinstance(typ, types.TypeAliasType):\n # Avoid infinite recursion for recursive type aliases.\n if typ not in self.seen_aliases:\n self.seen_aliases.add(typ)\n # Note: instances are needed for `class str(Sequence[str]): ...`\n if (\n isinstance(typ, types.TypeAliasType)\n or isinstance(typ, types.ProperType)\n and isinstance(typ, types.Instance)\n ):\n # Avoid infinite recursion for recursive types.\n if typ in self.seen_types:\n return\n self.seen_types.add(typ)\n typ.accept(self)\n\n def _visit_type_tuple(self, typs: tuple[types.Type, ...]) -> None:\n # Micro-optimization: Specialized version of _visit for lists\n for typ in typs:\n if isinstance(typ, types.TypeAliasType):\n # Avoid infinite recursion for recursive type aliases.\n if typ in self.seen_aliases:\n if (\n isinstance(typ, types.TypeAliasType)\n or isinstance(typ, types.ProperType)\n and isinstance(typ, types.Instance)\n ):\n # Avoid infinite recursion for recursive types.\n if typ in self.seen_types:\n continue\n self.seen_aliases.add(typ)\n self.seen_types.add(typ)\n typ.accept(self)\n\n def _visit_type_list(self, typs: list[types.Type]) -> None:\n # Micro-optimization: Specialized version of _visit for tuples\n for typ in typs:\n if isinstance(typ, types.TypeAliasType):\n # Avoid infinite recursion for recursive type aliases.\n if typ in self.seen_aliases:\n if (\n isinstance(typ, types.TypeAliasType)\n or isinstance(typ, types.ProperType)\n and isinstance(typ, types.Instance)\n ):\n # Avoid infinite recursion for recursive types.\n if typ in self.seen_types:\n continue\n self.seen_aliases.add(typ)\n self.seen_types.add(typ)\n typ.accept(self)\n\n def _visit_module_name(self, module_name: str) -> None:",
"change_type": "modification",
"lines_of_context": 29,
"function_name": "_visit_module_name",
"class_name": null,
"docstring": null,
"coding_patterns": [
"generator_expression",
"context_manager",
"class_definition",
"type_hint"
]
},
{
"file_path": "mypy/indirection.py",
"language": "python",
"before_code": " self._visit_type_list(t.arg_types)\n\n def visit_instance(self, t: types.Instance) -> None:\n self._visit_type_tuple(t.args)\n if t.type:\n # Uses of a class depend on everything in the MRO,\n # as changes to classes in the MRO can add types to methods,\n # change property types, change the MRO itself, etc.\n for s in t.type.mro:\n self._visit_module_name(s.module_name)\n if t.type.metaclass_type is not None:\n self._visit_module_name(t.type.metaclass_type.type.module_name)\n\n def visit_callable_type(self, t: types.CallableType) -> None:\n self._visit_type_list(t.arg_types)",
"after_code": " self._visit_type_list(t.arg_types)\n\n def visit_instance(self, t: types.Instance) -> None:\n # Instance is named, record its definition and continue digging into\n # components that constitute semantic meaning of this type: bases, metaclass,\n # tuple type, and typeddict type.\n # Note: we cannot simply record the MRO, in case an intermediate base contains\n # a reference to type alias, this affects meaning of map_instance_to_supertype(),\n # see e.g. testDoubleReexportGenericUpdated.\n self._visit_type_tuple(t.args)\n if t.type:\n # Important optimization: instead of simply recording the definition and\n # recursing into bases, record the MRO and only traverse generic bases.\n for s in t.type.mro:\n self._visit_module_name(s.module_name)\n for base in s.bases:\n if base.args:\n self._visit_type_tuple(base.args)\n if t.type.metaclass_type:\n self._visit(t.type.metaclass_type)\n if t.type.typeddict_type:\n self._visit(t.type.typeddict_type)\n if t.type.tuple_type:\n self._visit(t.type.tuple_type)\n\n def visit_callable_type(self, t: types.CallableType) -> None:\n self._visit_type_list(t.arg_types)",
"diff_context": " self._visit_type_list(t.arg_types)\n\n def visit_instance(self, t: types.Instance) -> None:\n # Instance is named, record its definition and continue digging into\n # components that constitute semantic meaning of this type: bases, metaclass,\n # tuple type, and typeddict type.\n # Note: we cannot simply record the MRO, in case an intermediate base contains\n # a reference to type alias, this affects meaning of map_instance_to_supertype(),\n # see e.g. testDoubleReexportGenericUpdated.\n self._visit_type_tuple(t.args)\n if t.type:\n # Uses of a class depend on everything in the MRO,\n # as changes to classes in the MRO can add types to methods,\n # change property types, change the MRO itself, etc.\n # Important optimization: instead of simply recording the definition and\n # recursing into bases, record the MRO and only traverse generic bases.\n for s in t.type.mro:\n self._visit_module_name(s.module_name)\n if t.type.metaclass_type is not None:\n self._visit_module_name(t.type.metaclass_type.type.module_name)\n for base in s.bases:\n if base.args:\n self._visit_type_tuple(base.args)\n if t.type.metaclass_type:\n self._visit(t.type.metaclass_type)\n if t.type.typeddict_type:\n self._visit(t.type.typeddict_type)\n if t.type.tuple_type:\n self._visit(t.type.tuple_type)\n\n def visit_callable_type(self, t: types.CallableType) -> None:\n self._visit_type_list(t.arg_types)",
"change_type": "modification",
"lines_of_context": 10,
"function_name": "visit_callable_type",
"class_name": null,
"docstring": null,
"coding_patterns": [
"generator_expression"
]
},
{
"file_path": "mypy/indirection.py",
"language": "python",
"before_code": " self.seen_fullnames.add(fullname)\n\n def visit_overloaded(self, t: types.Overloaded) -> None:\n self._visit_type_list(list(t.items))\n self._visit(t.fallback)\n\n def visit_tuple_type(self, t: types.TupleType) -> None:",
"after_code": " self.seen_fullnames.add(fullname)\n\n def visit_overloaded(self, t: types.Overloaded) -> None:\n for item in t.items:\n self._visit(item)\n self._visit(t.fallback)\n\n def visit_tuple_type(self, t: types.TupleType) -> None:",
"diff_context": " self.seen_fullnames.add(fullname)\n\n def visit_overloaded(self, t: types.Overloaded) -> None:\n self._visit_type_list(list(t.items))\n for item in t.items:\n self._visit(item)\n self._visit(t.fallback)\n\n def visit_tuple_type(self, t: types.TupleType) -> None:",
"change_type": "modification",
"lines_of_context": 6,
"function_name": "visit_tuple_type",
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "mypy/indirection.py",
"language": "python",
"before_code": " self._visit(t.item)\n\n def visit_type_alias_type(self, t: types.TypeAliasType) -> None:\n self._visit(types.get_proper_type(t))",
"after_code": " self._visit(t.item)\n\n def visit_type_alias_type(self, t: types.TypeAliasType) -> None:\n # Type alias is named, record its definition and continue digging into\n # components that constitute semantic meaning of this type: target and args.\n if t.alias:\n self._visit_module_name(t.alias.module)\n self._visit(t.alias.target)\n self._visit_type_list(t.args)",
"diff_context": " self._visit(t.item)\n\n def visit_type_alias_type(self, t: types.TypeAliasType) -> None:\n self._visit(types.get_proper_type(t))\n # Type alias is named, record its definition and continue digging into\n # components that constitute semantic meaning of this type: target and args.\n if t.alias:\n self._visit_module_name(t.alias.module)\n self._visit(t.alias.target)\n self._visit_type_list(t.args)",
"change_type": "modification",
"lines_of_context": 3,
"function_name": "visit_type_alias_type",
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "mypy/nodes.py",
"language": "python",
"before_code": " defs: list[Statement]\n # Type alias dependencies as mapping from target to set of alias full names\n alias_deps: defaultdict[str, set[str]]\n # Is there a UTF-8 BOM at the start?\n is_bom: bool\n names: SymbolTable",
"after_code": " defs: list[Statement]\n # Type alias dependencies as mapping from target to set of alias full names\n alias_deps: defaultdict[str, set[str]]\n # Same as above but for coarse-grained dependencies (i.e. modules instead of full names)\n mod_alias_deps: set[str]\n # Is there a UTF-8 BOM at the start?\n is_bom: bool\n names: SymbolTable",
"diff_context": " defs: list[Statement]\n # Type alias dependencies as mapping from target to set of alias full names\n alias_deps: defaultdict[str, set[str]]\n # Same as above but for coarse-grained dependencies (i.e. modules instead of full names)\n mod_alias_deps: set[str]\n # Is there a UTF-8 BOM at the start?\n is_bom: bool\n names: SymbolTable",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": [
"type_hint"
]
},
{
"file_path": "mypy/nodes.py",
"language": "python",
"before_code": " target: The target type. For generic aliases contains bound type variables\n as nested types (currently TypeVar and ParamSpec are supported).\n _fullname: Qualified name of this type alias. This is used in particular\n to track fine grained dependencies from aliases.\n alias_tvars: Type variables used to define this alias.\n normalized: Used to distinguish between `A = List`, and `A = list`. Both\n are internally stored using `builtins.list` (because `typing.List` is",
"after_code": " target: The target type. For generic aliases contains bound type variables\n as nested types (currently TypeVar and ParamSpec are supported).\n _fullname: Qualified name of this type alias. This is used in particular\n to track fine-grained dependencies from aliases.\n module: Module where the alias was defined.\n alias_tvars: Type variables used to define this alias.\n normalized: Used to distinguish between `A = List`, and `A = list`. Both\n are internally stored using `builtins.list` (because `typing.List` is",
"diff_context": " target: The target type. For generic aliases contains bound type variables\n as nested types (currently TypeVar and ParamSpec are supported).\n _fullname: Qualified name of this type alias. This is used in particular\n to track fine grained dependencies from aliases.\n to track fine-grained dependencies from aliases.\n module: Module where the alias was defined.\n alias_tvars: Type variables used to define this alias.\n normalized: Used to distinguish between `A = List`, and `A = list`. Both\n are internally stored using `builtins.list` (because `typing.List` is",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "mypy/semanal.py",
"language": "python",
"before_code": " declared_type_vars: TypeVarLikeList | None = None,\n all_declared_type_params_names: list[str] | None = None,\n python_3_12_type_alias: bool = False,\n ) -> tuple[Type | None, list[TypeVarLikeType], set[str], list[str], bool]:\n \"\"\"Check if 'rvalue' is a valid type allowed for aliasing (e.g. not a type variable).\n\n If yes, return the corresponding type, a list of\n qualified type variable names for generic aliases, a set of names the alias depends on,\n and a list of type variables if the alias is generic.\n A schematic example for the dependencies:\n A = int\n B = str\n analyze_alias(Dict[A, B])[2] == {'__main__.A', '__main__.B'}\n \"\"\"\n dynamic = bool(self.function_stack and self.function_stack[-1].is_dynamic())\n global_scope = not self.type and not self.function_stack",
"after_code": " declared_type_vars: TypeVarLikeList | None = None,\n all_declared_type_params_names: list[str] | None = None,\n python_3_12_type_alias: bool = False,\n ) -> tuple[Type | None, list[TypeVarLikeType], set[tuple[str, str]], bool]:\n \"\"\"Check if 'rvalue' is a valid type allowed for aliasing (e.g. not a type variable).\n\n If yes, return the corresponding type, a list of type variables for generic aliases,\n a set of names the alias depends on, and True if the original type has empty tuple index.\n An example for the dependencies:\n A = int\n B = str\n analyze_alias(dict[A, B])[2] == {('mod', 'mod.A'), ('mod', 'mod.B')}\n \"\"\"\n dynamic = bool(self.function_stack and self.function_stack[-1].is_dynamic())\n global_scope = not self.type and not self.function_stack",
"diff_context": " declared_type_vars: TypeVarLikeList | None = None,\n all_declared_type_params_names: list[str] | None = None,\n python_3_12_type_alias: bool = False,\n ) -> tuple[Type | None, list[TypeVarLikeType], set[str], list[str], bool]:\n ) -> tuple[Type | None, list[TypeVarLikeType], set[tuple[str, str]], bool]:\n \"\"\"Check if 'rvalue' is a valid type allowed for aliasing (e.g. not a type variable).\n\n If yes, return the corresponding type, a list of\n qualified type variable names for generic aliases, a set of names the alias depends on,\n and a list of type variables if the alias is generic.\n A schematic example for the dependencies:\n If yes, return the corresponding type, a list of type variables for generic aliases,\n a set of names the alias depends on, and True if the original type has empty tuple index.\n An example for the dependencies:\n A = int\n B = str\n analyze_alias(Dict[A, B])[2] == {'__main__.A', '__main__.B'}\n analyze_alias(dict[A, B])[2] == {('mod', 'mod.A'), ('mod', 'mod.B')}\n \"\"\"\n dynamic = bool(self.function_stack and self.function_stack[-1].is_dynamic())\n global_scope = not self.type and not self.function_stack",
"change_type": "modification",
"lines_of_context": 10,
"function_name": null,
"class_name": null,
"docstring": "\"\"\"Check if 'rvalue' is a valid type allowed for aliasing (e.g. not a type variable).",
"coding_patterns": [
"list_comprehension"
]
},
{
"file_path": "mypy/semanal.py",
"language": "python",
"before_code": " self.cur_mod_node.plugin_deps.setdefault(trigger, set()).add(target)\n\n def add_type_alias_deps(\n self, aliases_used: Collection[str], target: str | None = None\n ) -> None:\n \"\"\"Add full names of type aliases on which the current node depends.\n\n This is used by fine-grained incremental mode to re-check the corresponding nodes.\n If `target` is None, then the target node used will be the current scope.\n \"\"\"\n if not aliases_used:\n # A basic optimization to avoid adding targets with no dependencies to\n # the `alias_deps` dict.\n return\n if target is None:\n target = self.scope.current_target()\n self.cur_mod_node.alias_deps[target].update(aliases_used)\n\n def is_mangled_global(self, name: str) -> bool:\n # A global is mangled if there exists at least one renamed variant.",
"after_code": " self.cur_mod_node.plugin_deps.setdefault(trigger, set()).add(target)\n\n def add_type_alias_deps(\n self, aliases_used: Collection[tuple[str, str]], target: str | None = None\n ) -> None:\n \"\"\"Add full names of type aliases on which the current node depends.\n\n This is used by fine-grained incremental mode to re-check the corresponding nodes.\n If `target` is None, then the target node used will be the current scope. For\n coarse-grained mode, add just the module names where aliases are defined.\n \"\"\"\n if not aliases_used:\n return\n if target is None:\n target = self.scope.current_target()\n for mod, fn in aliases_used:\n self.cur_mod_node.alias_deps[target].add(fn)\n self.cur_mod_node.mod_alias_deps.add(mod)\n\n def is_mangled_global(self, name: str) -> bool:\n # A global is mangled if there exists at least one renamed variant.",
"diff_context": " self.cur_mod_node.plugin_deps.setdefault(trigger, set()).add(target)\n\n def add_type_alias_deps(\n self, aliases_used: Collection[str], target: str | None = None\n self, aliases_used: Collection[tuple[str, str]], target: str | None = None\n ) -> None:\n \"\"\"Add full names of type aliases on which the current node depends.\n\n This is used by fine-grained incremental mode to re-check the corresponding nodes.\n If `target` is None, then the target node used will be the current scope.\n If `target` is None, then the target node used will be the current scope. For\n coarse-grained mode, add just the module names where aliases are defined.\n \"\"\"\n if not aliases_used:\n # A basic optimization to avoid adding targets with no dependencies to\n # the `alias_deps` dict.\n return\n if target is None:\n target = self.scope.current_target()\n self.cur_mod_node.alias_deps[target].update(aliases_used)\n for mod, fn in aliases_used:\n self.cur_mod_node.alias_deps[target].add(fn)\n self.cur_mod_node.mod_alias_deps.add(mod)\n\n def is_mangled_global(self, name: str) -> bool:\n # A global is mangled if there exists at least one renamed variant.",
"change_type": "modification",
"lines_of_context": 15,
"function_name": "is_mangled_global",
"class_name": null,
"docstring": "\"\"\"Add full names of type aliases on which the current node depends.",
"coding_patterns": [
"list_comprehension"
]
}
],
"commit_message_style": "concise_subject",
"python_version": null,
"pep_status": null
},
{
"type": "pr",
"repository": "mypy",
"title": "chore: add cline_docs/ to .gitignore",
"description": "Cline is a commonly used LLM tool which, under certain conditions, creates a cline_docs/ folder with task status and todo items etc\r\n\r\nThis folder is only helpful locally (unless we decide we want to add actual guidelines for Cline here, but thats outside the scope of this PR) so this PR adds it to .gitignore\r\n\r\n<!-- If this pull request fixes an issue, add \"Fixes #NNN\" with the issue number. -->\r\n\r\n<!--\r\nChecklist:\r\n- Read the [Contributing Guidelines](https://github.com/python/mypy/blob/master/CONTRIBUTING.md)\r\n- Add tests for all changed behaviour.\r\n- If you can't add a test, please explain why and how you verified your changes work.\r\n- Make sure CI passes.\r\n- Please do not force push to the PR once it has been reviewed.\r\n-->\r\n",
"url": "https://github.com/python/mypy/pull/19797",
"date": "2025-09-05T02:35:14Z",
"sha_or_number": "19797",
"files_changed": [
".gitignore"
],
"additions": 0,
"deletions": 0,
"labels": [],
"related_issues": [],
"code_samples": [],
"commit_message_style": "concise_subject",
"python_version": null,
"pep_status": null
},
{
"type": "pr",
"repository": "mypy",
"title": "[mypyc] Add type annotations to tests",
"description": "Missing type annotations can compromise test coverage. My eventual goal is to require annotations by default in all run tests.\r\n",
"url": "https://github.com/python/mypy/pull/19794",
"date": "2025-09-04T15:56:30Z",
"sha_or_number": "19794",
"files_changed": [
"mypyc/test-data/fixtures/ir.py",
"mypyc/test-data/fixtures/typing-full.pyi",
"mypyc/test-data/run-dunders.test",
"mypyc/test-data/run-singledispatch.test"
],
"additions": 0,
"deletions": 0,
"labels": [],
"related_issues": [],
"code_samples": [
{
"file_path": "mypyc/test-data/fixtures/ir.py",
"language": "python",
"before_code": " def __iadd__(self, value: Iterable[_T], /) -> List[_T]: ... # type: ignore[misc]\n def append(self, x: _T) -> None: pass\n def pop(self, i: int = -1) -> _T: pass\n def count(self, _T) -> int: pass\n def extend(self, l: Iterable[_T]) -> None: pass\n def insert(self, i: int, x: _T) -> None: pass\n def sort(self) -> None: pass",
"after_code": " def __iadd__(self, value: Iterable[_T], /) -> List[_T]: ... # type: ignore[misc]\n def append(self, x: _T) -> None: pass\n def pop(self, i: int = -1) -> _T: pass\n def count(self, x: _T) -> int: pass\n def extend(self, l: Iterable[_T]) -> None: pass\n def insert(self, i: int, x: _T) -> None: pass\n def sort(self) -> None: pass",
"diff_context": " def __iadd__(self, value: Iterable[_T], /) -> List[_T]: ... # type: ignore[misc]\n def append(self, x: _T) -> None: pass\n def pop(self, i: int = -1) -> _T: pass\n def count(self, _T) -> int: pass\n def count(self, x: _T) -> int: pass\n def extend(self, l: Iterable[_T]) -> None: pass\n def insert(self, i: int, x: _T) -> None: pass\n def sort(self) -> None: pass",
"change_type": "modification",
"lines_of_context": 6,
"function_name": "sort",
"class_name": null,
"docstring": null,
"coding_patterns": [
"function_definition",
"type_hint"
]
},
{
"file_path": "mypyc/test-data/fixtures/ir.py",
"language": "python",
"before_code": "def id(o: object) -> int: pass\n# This type is obviously wrong but the test stubs don't have Sized anymore\ndef len(o: object) -> int: pass\ndef print(*object) -> None: pass\ndef isinstance(x: object, t: object) -> bool: pass\ndef iter(i: Iterable[_T]) -> Iterator[_T]: pass\n@overload",
"after_code": "def id(o: object) -> int: pass\n# This type is obviously wrong but the test stubs don't have Sized anymore\ndef len(o: object) -> int: pass\ndef print(*args: object) -> None: pass\ndef isinstance(x: object, t: object) -> bool: pass\ndef iter(i: Iterable[_T]) -> Iterator[_T]: pass\n@overload",
"diff_context": "def id(o: object) -> int: pass\n# This type is obviously wrong but the test stubs don't have Sized anymore\ndef len(o: object) -> int: pass\ndef print(*object) -> None: pass\ndef print(*args: object) -> None: pass\ndef isinstance(x: object, t: object) -> bool: pass\ndef iter(i: Iterable[_T]) -> Iterator[_T]: pass\n@overload",
"change_type": "modification",
"lines_of_context": 6,
"function_name": "iter",
"class_name": null,
"docstring": null,
"coding_patterns": [
"function_definition",
"type_hint"
]
},
{
"file_path": "mypyc/test-data/fixtures/typing-full.pyi",
"language": "python",
"before_code": "class GenericMeta(type): pass\n\nclass _SpecialForm:\n def __getitem__(self, index): ...\nclass TypeVar:\n def __init__(self, name, *args, bound=None): ...\n def __or__(self, other): ...\n\ncast = 0\noverload = 0",
"after_code": "class GenericMeta(type): pass\n\nclass _SpecialForm:\n def __getitem__(self, index: Any) -> Any: ...\nclass TypeVar:\n def __init__(self, name: str, *args: Any, bound: Any = None): ...\n def __or__(self, other: Any) -> Any: ...\n\ncast = 0\noverload = 0",
"diff_context": "class GenericMeta(type): pass\n\nclass _SpecialForm:\n def __getitem__(self, index): ...\n def __getitem__(self, index: Any) -> Any: ...\nclass TypeVar:\n def __init__(self, name, *args, bound=None): ...\n def __or__(self, other): ...\n def __init__(self, name: str, *args: Any, bound: Any = None): ...\n def __or__(self, other: Any) -> Any: ...\n\ncast = 0\noverload = 0",
"change_type": "modification",
"lines_of_context": 7,
"function_name": "__or__",
"class_name": "TypeVar",
"docstring": null,
"coding_patterns": [
"function_definition",
"type_hint"
]
}
],
"commit_message_style": "concise_subject",
"python_version": null,
"pep_status": null
},
{
"type": "pr",
"repository": "mypy",
"title": "Check functions without annotations in mypyc tests",
"description": "c.f. https://github.com/python/mypy/pull/19217#discussion_r2314303410\r\n\r\nDisallowing functions without annotations (where not relevant to the tests) is probably a good idea, but this creates a large number of failures which would take some time to go through (many due to common issues, like untyped functions in the fixtures).\r\n\r\nAs a smaller step in the right direction, this sets `check_untyped_defs = True` for the `run-*` tests so that we at least check functions without annotations. ",
"url": "https://github.com/python/mypy/pull/19792",
"date": "2025-09-04T14:42:17Z",
"sha_or_number": "19792",
"files_changed": [
"mypyc/test-data/fixtures/ir.py",
"mypyc/test-data/run-classes.test",
"mypyc/test/test_run.py"
],
"additions": 0,
"deletions": 0,
"labels": [],
"related_issues": [],
"code_samples": [
{
"file_path": "mypyc/test-data/fixtures/ir.py",
"language": "python",
"before_code": "class type:\n def __init__(self, o: object) -> None: ...\n def __or__(self, o: object) -> Any: ...\n __name__ : str\n __annotations__: Dict[str, Any]\n",
"after_code": "class type:\n def __init__(self, o: object) -> None: ...\n def __or__(self, o: object) -> Any: ...\n def __new__(cls, *args: object) -> Any: ...\n __name__ : str\n __annotations__: Dict[str, Any]\n",
"diff_context": "class type:\n def __init__(self, o: object) -> None: ...\n def __or__(self, o: object) -> Any: ...\n def __new__(cls, *args: object) -> Any: ...\n __name__ : str\n __annotations__: Dict[str, Any]\n",
"change_type": "modification",
"lines_of_context": 6,
"function_name": "__new__",
"class_name": "type",
"docstring": null,
"coding_patterns": [
"function_definition"
]
}
],
"commit_message_style": "concise_subject",
"python_version": null,
"pep_status": null
},
{
"type": "pr",
"repository": "mypy",
"title": "fix: Allow instantiation of type[None] in analyze_type_type_callee",
"description": "<!-- If this pull request fixes an issue, add \"Fixes #NNN\" with the issue number. -->\r\n\r\n(Explain how this PR changes mypy.)\r\n\r\n<!--\r\nChecklist:\r\n- Read the [Contributing Guidelines](https://github.com/python/mypy/blob/master/CONTRIBUTING.md)\r\n- Add tests for all changed behaviour.\r\n- If you can't add a test, please explain why and how you verified your changes work.\r\n- Make sure CI passes.\r\n- Please do not force push to the PR once it has been reviewed.\r\n-->\r\n\r\nFixes #19660\r\n\r\nAllow instantiation of NoneType in type checker\r\n\r\nThis change fixes the error \"Cannot instantiate type 'Type[None]'\"\r\nwhen calling NoneType() or type(None)().\r\n\r\nBy treating NoneType as a callable that returns None, mypy can now correctly\r\nhandle such calls without raising spurious errors.\r\n\r\nAlso, I added test case testTypeUsingTypeCNoneType covering:\r\n- direct calls to type(None)() and NoneType()\r\n- functions accepting type[None] and type[NoneType] parameters and invoking them\r\n\r\nThis ensures proper handling of NoneType instantiation and prevents spurious errors.",
"url": "https://github.com/python/mypy/pull/19782",
"date": "2025-09-02T06:13:12Z",
"sha_or_number": "19782",
"files_changed": [
"mypy/checkexpr.py",
"test-data/unit/check-classes.test"
],
"additions": 0,
"deletions": 0,
"labels": [],
"related_issues": [
"19660"
],
"code_samples": [
{
"file_path": "mypy/checkexpr.py",
"language": "python",
"before_code": " return self.analyze_type_type_callee(tuple_fallback(item), context)\n if isinstance(item, TypedDictType):\n return self.typeddict_callable_from_context(item)\n\n self.msg.unsupported_type_type(item, context)\n return AnyType(TypeOfAny.from_error)",
"after_code": " return self.analyze_type_type_callee(tuple_fallback(item), context)\n if isinstance(item, TypedDictType):\n return self.typeddict_callable_from_context(item)\n if isinstance(item, NoneType):\n # NoneType() returns None, so treat it as a callable that returns None\n return CallableType(\n arg_types=[],\n arg_kinds=[],\n arg_names=[],\n ret_type=NoneType(),\n fallback=self.named_type(\"builtins.function\"),\n name=None,\n from_type_type=True,\n )\n\n self.msg.unsupported_type_type(item, context)\n return AnyType(TypeOfAny.from_error)",
"diff_context": " return self.analyze_type_type_callee(tuple_fallback(item), context)\n if isinstance(item, TypedDictType):\n return self.typeddict_callable_from_context(item)\n if isinstance(item, NoneType):\n # NoneType() returns None, so treat it as a callable that returns None\n return CallableType(\n arg_types=[],\n arg_kinds=[],\n arg_names=[],\n ret_type=NoneType(),\n fallback=self.named_type(\"builtins.function\"),\n name=None,\n from_type_type=True,\n )\n\n self.msg.unsupported_type_type(item, context)\n return AnyType(TypeOfAny.from_error)",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
}
],
"commit_message_style": "standard",
"python_version": null,
"pep_status": null
},
{
"type": "pr",
"repository": "mypy",
"title": "feat: new mypyc primitives for weakref.proxy",
"description": "This PR adds 2 new weakref primitives for weakref.proxy (1 and 2 arg)\r\n\r\nThe C code generates correctly, but I'm not entirely sure why this test is failing. The weakly-proxied object is being destroyed too early, while there should still be a strong reference to it. It also fails if we use the builtin weakref.proxy, so I believe this might be exposing a reference counting bug unrelated to this PR.\r\n\r\n<!--\r\nChecklist:\r\n- Read the [Contributing Guidelines](https://github.com/python/mypy/blob/master/CONTRIBUTING.md)\r\n- Add tests for all changed behaviour.\r\n- If you can't add a test, please explain why and how you verified your changes work.\r\n- Make sure CI passes.\r\n- Please do not force push to the PR once it has been reviewed.\r\n-->\r\n",
"url": "https://github.com/python/mypy/pull/19217",
"date": "2025-06-03T17:02:26Z",
"sha_or_number": "19217",
"files_changed": [
"mypyc/primitives/weakref_ops.py",
"mypyc/test-data/fixtures/ir.py",
"mypyc/test-data/irbuild-weakref.test",
"mypyc/test-data/run-weakref.test",
"test-data/unit/lib-stub/_weakref.pyi",
"test-data/unit/lib-stub/weakref.pyi"
],
"additions": 0,
"deletions": 0,
"labels": [],
"related_issues": [],
"code_samples": [
{
"file_path": "mypyc/test-data/fixtures/ir.py",
"language": "python",
"before_code": "class UnicodeEncodeError(RuntimeError): pass\nclass UnicodeDecodeError(RuntimeError): pass\nclass NotImplementedError(RuntimeError): pass\n\nclass StopIteration(Exception):\n value: Any",
"after_code": "class UnicodeEncodeError(RuntimeError): pass\nclass UnicodeDecodeError(RuntimeError): pass\nclass NotImplementedError(RuntimeError): pass\nclass ReferenceError(Exception): pass\n\nclass StopIteration(Exception):\n value: Any",
"diff_context": "class UnicodeEncodeError(RuntimeError): pass\nclass UnicodeDecodeError(RuntimeError): pass\nclass NotImplementedError(RuntimeError): pass\nclass ReferenceError(Exception): pass\n\nclass StopIteration(Exception):\n value: Any",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": "StopIteration",
"docstring": null,
"coding_patterns": [
"class_definition",
"type_hint"
]
},
{
"file_path": "test-data/unit/lib-stub/_weakref.pyi",
"language": "python",
"before_code": "",
"after_code": "from typing import Any, Callable, TypeVar, overload\nfrom weakref import CallableProxyType, ProxyType\n\n_C = TypeVar(\"_C\", bound=Callable[..., Any])\n_T = TypeVar(\"_T\")\n\n# Return CallableProxyType if object is callable, ProxyType otherwise\n@overload\ndef proxy(object: _C, callback: Callable[[CallableProxyType[_C]], Any] | None = None, /) -> CallableProxyType[_C]: ...\n@overload\ndef proxy(object: _T, callback: Callable[[ProxyType[_T]], Any] | None = None, /) -> ProxyType[_T]: ...",
"diff_context": "from typing import Any, Callable, TypeVar, overload\nfrom weakref import CallableProxyType, ProxyType\n\n_C = TypeVar(\"_C\", bound=Callable[..., Any])\n_T = TypeVar(\"_T\")\n\n# Return CallableProxyType if object is callable, ProxyType otherwise\n@overload\ndef proxy(object: _C, callback: Callable[[CallableProxyType[_C]], Any] | None = None, /) -> CallableProxyType[_C]: ...\n@overload\ndef proxy(object: _T, callback: Callable[[ProxyType[_T]], Any] | None = None, /) -> ProxyType[_T]: ...",
"change_type": "addition",
"lines_of_context": 0,
"function_name": "proxy",
"class_name": null,
"docstring": null,
"coding_patterns": [
"decorator",
"function_definition"
]
}
],
"commit_message_style": "concise_subject",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "cpython",
"title": "gh-128307: Update what's new in 3.13 and 3.14 with create_task changes of asyncio (#134304)",
"description": "gh-128307: Update what's new in 3.13 and 3.14 with create_task changes of asyncio (#134304)\n\nCo-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>",
"url": "https://github.com/python/cpython/commit/28625d4f956f8d30671aba1daaac9735932983db",
"date": "2025-05-20T08:41:22Z",
"sha_or_number": "28625d4f956f8d30671aba1daaac9735932983db",
"files_changed": [
"Doc/whatsnew/3.13.rst",
"Doc/whatsnew/3.14.rst"
],
"additions": 34,
"deletions": 0,
"labels": [],
"related_issues": [
"134304"
],
"code_samples": [
{
"file_path": "Doc/whatsnew/3.13.rst",
"language": "restructuredtext",
"before_code": " never awaited).\n (Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)\n\n\nbase64\n------",
"after_code": " never awaited).\n (Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)\n\n* The function and methods named ``create_task`` have received a new\n ``**kwargs`` argument that is passed through to the task constructor.\n This change was accidentally added in 3.13.3,\n and broke the API contract for custom task factories.\n Several third-party task factories implemented workarounds for this.\n In 3.13.4 and later releases the old factory contract is honored\n once again (until 3.14).\n To keep the workarounds working, the extra ``**kwargs`` argument still\n allows passing additional keyword arguments to :class:`~asyncio.Task`\n and to custom task factories.\n\n This affects the following function and methods:\n :meth:`asyncio.create_task`,\n :meth:`asyncio.loop.create_task`,\n :meth:`asyncio.TaskGroup.create_task`.\n (Contributed by Thomas Grainger in :gh:`128307`.)\n\nbase64\n------",
"diff_context": " never awaited).\n (Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)\n\n* The function and methods named ``create_task`` have received a new\n ``**kwargs`` argument that is passed through to the task constructor.\n This change was accidentally added in 3.13.3,\n and broke the API contract for custom task factories.\n Several third-party task factories implemented workarounds for this.\n In 3.13.4 and later releases the old factory contract is honored\n once again (until 3.14).\n To keep the workarounds working, the extra ``**kwargs`` argument still\n allows passing additional keyword arguments to :class:`~asyncio.Task`\n and to custom task factories.\n\n This affects the following function and methods:\n :meth:`asyncio.create_task`,\n :meth:`asyncio.loop.create_task`,\n :meth:`asyncio.TaskGroup.create_task`.\n (Contributed by Thomas Grainger in :gh:`128307`.)\n\nbase64\n------",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "Doc/whatsnew/3.14.rst",
"language": "restructuredtext",
"before_code": " (Contributed by Semyon Moroz in :gh:`133367`.)\n\n\nbdb\n---\n",
"after_code": " (Contributed by Semyon Moroz in :gh:`133367`.)\n\n\nasyncio\n-------\n\n* The function and methods named :func:`!create_task` now take an arbitrary\n list of keyword arguments. All keyword arguments are passed to the\n :class:`~asyncio.Task` constructor or the custom task factory.\n (See :meth:`~asyncio.loop.set_task_factory` for details.)\n The ``name`` and ``context`` keyword arguments are no longer special;\n the name should now be set using the ``name`` keyword argument of the factory,\n and ``context`` may be ``None``.\n\n This affects the following function and methods:\n :meth:`asyncio.create_task`,\n :meth:`asyncio.loop.create_task`,\n :meth:`asyncio.TaskGroup.create_task`.\n (Contributed by Thomas Grainger in :gh:`128307`.)\n\n\nbdb\n---\n",
"diff_context": " (Contributed by Semyon Moroz in :gh:`133367`.)\n\n\nasyncio\n-------\n\n* The function and methods named :func:`!create_task` now take an arbitrary\n list of keyword arguments. All keyword arguments are passed to the\n :class:`~asyncio.Task` constructor or the custom task factory.\n (See :meth:`~asyncio.loop.set_task_factory` for details.)\n The ``name`` and ``context`` keyword arguments are no longer special;\n the name should now be set using the ``name`` keyword argument of the factory,\n and ``context`` may be ``None``.\n\n This affects the following function and methods:\n :meth:`asyncio.create_task`,\n :meth:`asyncio.loop.create_task`,\n :meth:`asyncio.TaskGroup.create_task`.\n (Contributed by Thomas Grainger in :gh:`128307`.)\n\n\nbdb\n---\n",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
}
],
"commit_message_style": "references_issue; has_body",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "cpython",
"title": "Update CODEOWNERS (#126005)",
"description": "Update CODEOWNERS (#126005)",
"url": "https://github.com/python/cpython/commit/905eddceb2d61da9087f0d303aa7e4a405d2261a",
"date": "2024-10-26T15:24:51Z",
"sha_or_number": "905eddceb2d61da9087f0d303aa7e4a405d2261a",
"files_changed": [
".github/CODEOWNERS"
],
"additions": 2,
"deletions": 2,
"labels": [],
"related_issues": [
"126005"
],
"code_samples": [],
"commit_message_style": "concise_subject; imperative_mood; references_issue",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "cpython",
"title": "Withdraw most of my ownership in favor of Mark (#119611)",
"description": "Withdraw most of my ownership in favor of Mark (#119611)",
"url": "https://github.com/python/cpython/commit/3ff06ebec4e8b466f76078aa9c97cea2093d52ab",
"date": "2024-05-27T18:07:16Z",
"sha_or_number": "3ff06ebec4e8b466f76078aa9c97cea2093d52ab",
"files_changed": [
".github/CODEOWNERS"
],
"additions": 6,
"deletions": 6,
"labels": [],
"related_issues": [
"119611"
],
"code_samples": [],
"commit_message_style": "references_issue",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "cpython",
"title": "gh-117549: Don't use designated initializers in headers (#118580)",
"description": "gh-117549: Don't use designated initializers in headers (#118580)\n\nThe designated initializer syntax in static inline functions in pycore_backoff.h\r\ncauses problems for C++ or MSVC users who aren't yet using C++20.\r\nWhile internal, pycore_backoff.h is included (indirectly, via pycore_code.h)\r\nby some key 3rd party software that does so for speed.",
"url": "https://github.com/python/cpython/commit/40cc809902304f60c6e1c933191dd4d64e570e28",
"date": "2024-05-05T19:28:55Z",
"sha_or_number": "40cc809902304f60c6e1c933191dd4d64e570e28",
"files_changed": [
"Include/internal/pycore_backoff.h",
"Misc/NEWS.d/next/Core and Builtins/2024-05-05-12-04-02.gh-issue-117549.kITawD.rst"
],
"additions": 12,
"deletions": 2,
"labels": [],
"related_issues": [
"118580"
],
"code_samples": [
{
"file_path": "Misc/NEWS.d/next/Core and Builtins/2024-05-05-12-04-02.gh-issue-117549.kITawD.rst",
"language": "restructuredtext",
"before_code": "",
"after_code": "Don't use designated initializer syntax in inline functions in internal\nheaders. They cause problems for C++ or MSVC users who aren't yet using the\nlatest C++ standard (C++20). While internal, pycore_backoff.h, is included\n(indirectly, via pycore_code.h) by some key 3rd party software that does so\nfor speed.",
"diff_context": "Don't use designated initializer syntax in inline functions in internal\nheaders. They cause problems for C++ or MSVC users who aren't yet using the\nlatest C++ standard (C++20). While internal, pycore_backoff.h, is included\n(indirectly, via pycore_code.h) by some key 3rd party software that does so\nfor speed.",
"change_type": "addition",
"lines_of_context": 0,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
}
],
"commit_message_style": "references_issue; has_body",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "cpython",
"title": "gh-74929: Rudimentary docs for PEP 667 (#118581)",
"description": "gh-74929: Rudimentary docs for PEP 667 (#118581)\n\nThis is *not* sufficient for the final 3.13 release, but it will do for beta 1:\r\n\r\n- What's new entry\r\n- Updated changelog entry (news blurb)\r\n- Mention the proxy for f_globals in the datamodel and Python frame object docs\r\n\r\nThis doesn't have any C API details (what's new refers to the PEP).",
"url": "https://github.com/python/cpython/commit/9c13d9e37a194f574b8591da634bf98419786448",
"date": "2024-05-05T15:31:26Z",
"sha_or_number": "9c13d9e37a194f574b8591da634bf98419786448",
"files_changed": [
"Doc/c-api/frame.rst",
"Doc/reference/datamodel.rst",
"Doc/whatsnew/3.13.rst",
"Misc/NEWS.d/next/Core and Builtins/2024-04-27-21-44-40.gh-issue-74929.C2nESp.rst"
],
"additions": 22,
"deletions": 3,
"labels": [],
"related_issues": [
"118581"
],
"code_samples": [
{
"file_path": "Doc/c-api/frame.rst",
"language": "restructuredtext",
"before_code": "\n.. c:function:: PyObject* PyFrame_GetLocals(PyFrameObject *frame)\n\n Get the *frame*'s :attr:`~frame.f_locals` attribute (:class:`dict`).\n\n Return a :term:`strong reference`.\n\n .. versionadded:: 3.11\n\n\n.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)\n",
"after_code": "\n.. c:function:: PyObject* PyFrame_GetLocals(PyFrameObject *frame)\n\n Get the *frame*'s :attr:`~frame.f_locals` attribute.\n If the frame refers to a function or comprehension, this returns\n a write-through proxy object that allows modifying the locals.\n In all other cases (classes, modules) it returns the :class:`dict`\n representing the frame locals directly.\n\n Return a :term:`strong reference`.\n\n .. versionadded:: 3.11\n\n .. versionchanged:: 3.13\n Return a proxy object for functions and comprehensions.\n\n\n.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)\n",
"diff_context": "\n.. c:function:: PyObject* PyFrame_GetLocals(PyFrameObject *frame)\n\n Get the *frame*'s :attr:`~frame.f_locals` attribute (:class:`dict`).\n Get the *frame*'s :attr:`~frame.f_locals` attribute.\n If the frame refers to a function or comprehension, this returns\n a write-through proxy object that allows modifying the locals.\n In all other cases (classes, modules) it returns the :class:`dict`\n representing the frame locals directly.\n\n Return a :term:`strong reference`.\n\n .. versionadded:: 3.11\n\n .. versionchanged:: 3.13\n Return a proxy object for functions and comprehensions.\n\n\n.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)\n",
"change_type": "modification",
"lines_of_context": 11,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "Doc/reference/datamodel.rst",
"language": "restructuredtext",
"before_code": "\n * - .. attribute:: frame.f_locals\n - The dictionary used by the frame to look up\n :ref:`local variables <naming>`\n\n * - .. attribute:: frame.f_globals\n - The dictionary used by the frame to look up",
"after_code": "\n * - .. attribute:: frame.f_locals\n - The dictionary used by the frame to look up\n :ref:`local variables <naming>`.\n If the frame refers to a function or comprehension,\n this may return a write-through proxy object.\n\n .. versionchanged:: 3.13\n Return a proxy for functions and comprehensions.\n\n * - .. attribute:: frame.f_globals\n - The dictionary used by the frame to look up",
"diff_context": "\n * - .. attribute:: frame.f_locals\n - The dictionary used by the frame to look up\n :ref:`local variables <naming>`\n :ref:`local variables <naming>`.\n If the frame refers to a function or comprehension,\n this may return a write-through proxy object.\n\n .. versionchanged:: 3.13\n Return a proxy for functions and comprehensions.\n\n * - .. attribute:: frame.f_globals\n - The dictionary used by the frame to look up",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "Doc/whatsnew/3.13.rst",
"language": "restructuredtext",
"before_code": " Performance improvements are modest -- we expect to be improving this\n over the next few releases.\n\nNew typing features:\n\n* :pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing.ParamSpec`,",
"after_code": " Performance improvements are modest -- we expect to be improving this\n over the next few releases.\n\n* :pep:`667`: :attr:`FrameType.f_locals <frame.f_locals>` when used in\n a function now returns a write-through proxy to the frame's locals,\n rather than a ``dict``. See the PEP for corresponding C API changes\n and deprecations.\n\nNew typing features:\n\n* :pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing.ParamSpec`,",
"diff_context": " Performance improvements are modest -- we expect to be improving this\n over the next few releases.\n\n* :pep:`667`: :attr:`FrameType.f_locals <frame.f_locals>` when used in\n a function now returns a write-through proxy to the frame's locals,\n rather than a ``dict``. See the PEP for corresponding C API changes\n and deprecations.\n\nNew typing features:\n\n* :pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing.ParamSpec`,",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
}
],
"commit_message_style": "concise_subject; references_issue; has_body",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "cpython",
"title": "gh-118335: Rename --experimental-interpreter on Windows to --experimental-jit-interpreter (#118497)",
"description": "gh-118335: Rename --experimental-interpreter on Windows to --experimental-jit-interpreter (#118497)\n\nAlso fix docs for this in whatsnew.",
"url": "https://github.com/python/cpython/commit/a37b0932285b5e883b13a46ff2a32f15d7339894",
"date": "2024-05-02T00:48:34Z",
"sha_or_number": "a37b0932285b5e883b13a46ff2a32f15d7339894",
"files_changed": [
"Doc/whatsnew/3.13.rst",
"PCbuild/build.bat"
],
"additions": 5,
"deletions": 4,
"labels": [],
"related_issues": [
"118497"
],
"code_samples": [],
"commit_message_style": "references_issue; has_body",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "mypy",
"title": "Support TypeGuard (PEP 647) (#9865)",
"description": "Support TypeGuard (PEP 647) (#9865)\n\nPEP 647 is still in draft mode, but it is likely to be accepted, and this helps solve some real issues.",
"url": "https://github.com/python/mypy/commit/fffbe88fc54807c8b10ac40456522ad2faf8d350",
"date": "2021-01-18T18:13:36Z",
"sha_or_number": "fffbe88fc54807c8b10ac40456522ad2faf8d350",
"files_changed": [
"mypy/checker.py",
"mypy/checkexpr.py",
"mypy/constraints.py",
"mypy/expandtype.py",
"mypy/fixup.py",
"mypy/nodes.py",
"mypy/test/testcheck.py",
"mypy/typeanal.py",
"mypy/types.py",
"test-data/unit/check-python38.test",
"test-data/unit/check-serialize.test",
"test-data/unit/check-typeguard.test",
"test-data/unit/lib-stub/typing_extensions.pyi"
],
"additions": 408,
"deletions": 9,
"labels": [],
"related_issues": [
"9865"
],
"code_samples": [
{
"file_path": "mypy/checker.py",
"language": "python",
"before_code": " if literal(expr) == LITERAL_TYPE:\n vartype = type_map[expr]\n return self.conditional_callable_type_map(expr, vartype)\n elif isinstance(node, ComparisonExpr):\n # Step 1: Obtain the types of each operand and whether or not we can\n # narrow their types. (For example, we shouldn't try narrowing the",
"after_code": " if literal(expr) == LITERAL_TYPE:\n vartype = type_map[expr]\n return self.conditional_callable_type_map(expr, vartype)\n elif isinstance(node.callee, RefExpr):\n if node.callee.type_guard is not None:\n # TODO: Follow keyword args or *args, **kwargs\n if node.arg_kinds[0] != nodes.ARG_POS:\n self.fail(\"Type guard requires positional argument\", node)\n return {}, {}\n if literal(expr) == LITERAL_TYPE:\n return {expr: TypeGuardType(node.callee.type_guard)}, {}\n elif isinstance(node, ComparisonExpr):\n # Step 1: Obtain the types of each operand and whether or not we can\n # narrow their types. (For example, we shouldn't try narrowing the",
"diff_context": " if literal(expr) == LITERAL_TYPE:\n vartype = type_map[expr]\n return self.conditional_callable_type_map(expr, vartype)\n elif isinstance(node.callee, RefExpr):\n if node.callee.type_guard is not None:\n # TODO: Follow keyword args or *args, **kwargs\n if node.arg_kinds[0] != nodes.ARG_POS:\n self.fail(\"Type guard requires positional argument\", node)\n return {}, {}\n if literal(expr) == LITERAL_TYPE:\n return {expr: TypeGuardType(node.callee.type_guard)}, {}\n elif isinstance(node, ComparisonExpr):\n # Step 1: Obtain the types of each operand and whether or not we can\n # narrow their types. (For example, we shouldn't try narrowing the",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "mypy/checkexpr.py",
"language": "python",
"before_code": " ret_type=self.object_type(),\n fallback=self.named_type('builtins.function'))\n callee_type = get_proper_type(self.accept(e.callee, type_context, always_allow_any=True))\n if (self.chk.options.disallow_untyped_calls and\n self.chk.in_checked_function() and\n isinstance(callee_type, CallableType)",
"after_code": " ret_type=self.object_type(),\n fallback=self.named_type('builtins.function'))\n callee_type = get_proper_type(self.accept(e.callee, type_context, always_allow_any=True))\n if (isinstance(e.callee, RefExpr)\n and isinstance(callee_type, CallableType)\n and callee_type.type_guard is not None):\n # Cache it for find_isinstance_check()\n e.callee.type_guard = callee_type.type_guard\n if (self.chk.options.disallow_untyped_calls and\n self.chk.in_checked_function() and\n isinstance(callee_type, CallableType)",
"diff_context": " ret_type=self.object_type(),\n fallback=self.named_type('builtins.function'))\n callee_type = get_proper_type(self.accept(e.callee, type_context, always_allow_any=True))\n if (isinstance(e.callee, RefExpr)\n and isinstance(callee_type, CallableType)\n and callee_type.type_guard is not None):\n # Cache it for find_isinstance_check()\n e.callee.type_guard = callee_type.type_guard\n if (self.chk.options.disallow_untyped_calls and\n self.chk.in_checked_function() and\n isinstance(callee_type, CallableType)",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": [
"generator_expression"
]
},
{
"file_path": "mypy/checkexpr.py",
"language": "python",
"before_code": " \"\"\"\n if literal(expr) >= LITERAL_TYPE:\n restriction = self.chk.binder.get(expr)\n # If the current node is deferred, some variables may get Any types that they\n # otherwise wouldn't have. We don't want to narrow down these since it may\n # produce invalid inferred Optional[Any] types, at least.",
"after_code": " \"\"\"\n if literal(expr) >= LITERAL_TYPE:\n restriction = self.chk.binder.get(expr)\n # Ignore the error about using get_proper_type().\n if isinstance(restriction, TypeGuardType): # type: ignore[misc]\n # A type guard forces the new type even if it doesn't overlap the old.\n return restriction.type_guard\n # If the current node is deferred, some variables may get Any types that they\n # otherwise wouldn't have. We don't want to narrow down these since it may\n # produce invalid inferred Optional[Any] types, at least.",
"diff_context": " \"\"\"\n if literal(expr) >= LITERAL_TYPE:\n restriction = self.chk.binder.get(expr)\n # Ignore the error about using get_proper_type().\n if isinstance(restriction, TypeGuardType): # type: ignore[misc]\n # A type guard forces the new type even if it doesn't overlap the old.\n return restriction.type_guard\n # If the current node is deferred, some variables may get Any types that they\n # otherwise wouldn't have. We don't want to narrow down these since it may\n # produce invalid inferred Optional[Any] types, at least.",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": "\"\"\"",
"coding_patterns": [
"type_hint"
]
},
{
"file_path": "mypy/constraints.py",
"language": "python",
"before_code": " for t, a in zip(template.arg_types, cactual.arg_types):\n # Negate direction due to function argument type contravariance.\n res.extend(infer_constraints(t, a, neg_op(self.direction)))\n res.extend(infer_constraints(template.ret_type, cactual.ret_type,\n self.direction))\n return res\n elif isinstance(self.actual, AnyType):",
"after_code": " for t, a in zip(template.arg_types, cactual.arg_types):\n # Negate direction due to function argument type contravariance.\n res.extend(infer_constraints(t, a, neg_op(self.direction)))\n template_ret_type, cactual_ret_type = template.ret_type, cactual.ret_type\n if template.type_guard is not None:\n template_ret_type = template.type_guard\n if cactual.type_guard is not None:\n cactual_ret_type = cactual.type_guard\n res.extend(infer_constraints(template_ret_type, cactual_ret_type,\n self.direction))\n return res\n elif isinstance(self.actual, AnyType):",
"diff_context": " for t, a in zip(template.arg_types, cactual.arg_types):\n # Negate direction due to function argument type contravariance.\n res.extend(infer_constraints(t, a, neg_op(self.direction)))\n res.extend(infer_constraints(template.ret_type, cactual.ret_type,\n template_ret_type, cactual_ret_type = template.ret_type, cactual.ret_type\n if template.type_guard is not None:\n template_ret_type = template.type_guard\n if cactual.type_guard is not None:\n cactual_ret_type = cactual.type_guard\n res.extend(infer_constraints(template_ret_type, cactual_ret_type,\n self.direction))\n return res\n elif isinstance(self.actual, AnyType):",
"change_type": "modification",
"lines_of_context": 6,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": [
"type_hint"
]
},
{
"file_path": "mypy/expandtype.py",
"language": "python",
"before_code": "\n def visit_callable_type(self, t: CallableType) -> Type:\n return t.copy_modified(arg_types=self.expand_types(t.arg_types),\n ret_type=t.ret_type.accept(self))\n\n def visit_overloaded(self, t: Overloaded) -> Type:\n items = [] # type: List[CallableType]",
"after_code": "\n def visit_callable_type(self, t: CallableType) -> Type:\n return t.copy_modified(arg_types=self.expand_types(t.arg_types),\n ret_type=t.ret_type.accept(self),\n type_guard=(t.type_guard.accept(self)\n if t.type_guard is not None else None))\n\n def visit_overloaded(self, t: Overloaded) -> Type:\n items = [] # type: List[CallableType]",
"diff_context": "\n def visit_callable_type(self, t: CallableType) -> Type:\n return t.copy_modified(arg_types=self.expand_types(t.arg_types),\n ret_type=t.ret_type.accept(self))\n ret_type=t.ret_type.accept(self),\n type_guard=(t.type_guard.accept(self)\n if t.type_guard is not None else None))\n\n def visit_overloaded(self, t: Overloaded) -> Type:\n items = [] # type: List[CallableType]",
"change_type": "modification",
"lines_of_context": 6,
"function_name": "visit_overloaded",
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": "mypy/fixup.py",
"language": "python",
"before_code": " for arg in ct.bound_args:\n if arg:\n arg.accept(self)\n\n def visit_overloaded(self, t: Overloaded) -> None:\n for ct in t.items():",
"after_code": " for arg in ct.bound_args:\n if arg:\n arg.accept(self)\n if ct.type_guard is not None:\n ct.type_guard.accept(self)\n\n def visit_overloaded(self, t: Overloaded) -> None:\n for ct in t.items():",
"diff_context": " for arg in ct.bound_args:\n if arg:\n arg.accept(self)\n if ct.type_guard is not None:\n ct.type_guard.accept(self)\n\n def visit_overloaded(self, t: Overloaded) -> None:\n for ct in t.items():",
"change_type": "modification",
"lines_of_context": 6,
"function_name": "visit_overloaded",
"class_name": null,
"docstring": null,
"coding_patterns": []
}
],
"commit_message_style": "concise_subject; references_issue; has_body",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "mypy",
"title": "Add a separate issue form to report crashes (#9549)",
"description": "Add a separate issue form to report crashes (#9549)",
"url": "https://github.com/python/mypy/commit/cca6e2fdc874b7538bd1d2ef70daab687b2a0363",
"date": "2020-10-08T22:30:06Z",
"sha_or_number": "cca6e2fdc874b7538bd1d2ef70daab687b2a0363",
"files_changed": [
".github/ISSUE_TEMPLATE/crash.md"
],
"additions": 41,
"deletions": 0,
"labels": [],
"related_issues": [
"9549"
],
"code_samples": [
{
"file_path": ".github/ISSUE_TEMPLATE/crash.md",
"language": "markdown",
"before_code": "",
"after_code": "---\nname: Crash Report\nabout: Crash (traceback or \"INTERNAL ERROR\")\nlabels: \"crash\"\n---\n\n<!--\n Use this form only if mypy reports an \"INTERNAL ERROR\" and/or gives a traceback.\n Please include the traceback and all other messages below (use `mypy --show-traceback`).\n-->\n\n**Crash Report**\n\n(Tell us what happened.)\n\n**Traceback**\n\n```\n(Insert traceback and other messages from mypy here -- use `--show-traceback`.)\n```\n\n**To Reproduce**\n\n(Write what you did to reproduce the crash. Full source code is\nappreciated. We also very much appreciate it if you try to narrow the\nsource down to a small stand-alone example.)\n\n**Your Environment**\n\n<!-- Include as many relevant details about the environment you experienced the bug in -->\n\n- Mypy version used:\n- Mypy command-line flags:\n- Mypy configuration options from `mypy.ini` (and other config files):\n- Python version used:\n- Operating system and version:\n\n<!--\nYou can freely edit this text, please remove all the lines\nyou believe are unnecessary.\n-->",
"diff_context": "---\nname: Crash Report\nabout: Crash (traceback or \"INTERNAL ERROR\")\nlabels: \"crash\"\n---\n\n<!--\n Use this form only if mypy reports an \"INTERNAL ERROR\" and/or gives a traceback.\n Please include the traceback and all other messages below (use `mypy --show-traceback`).\n-->\n\n**Crash Report**\n\n(Tell us what happened.)\n\n**Traceback**\n\n```\n(Insert traceback and other messages from mypy here -- use `--show-traceback`.)\n```\n\n**To Reproduce**\n\n(Write what you did to reproduce the crash. Full source code is\nappreciated. We also very much appreciate it if you try to narrow the\nsource down to a small stand-alone example.)\n\n**Your Environment**\n\n<!-- Include as many relevant details about the environment you experienced the bug in -->\n\n- Mypy version used:\n- Mypy command-line flags:\n- Mypy configuration options from `mypy.ini` (and other config files):\n- Python version used:\n- Operating system and version:\n\n<!--\nYou can freely edit this text, please remove all the lines\nyou believe are unnecessary.\n-->",
"change_type": "addition",
"lines_of_context": 0,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
}
],
"commit_message_style": "imperative_mood; references_issue",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "mypy",
"title": "Make the new bug templates less markup-heavy (#9438)",
"description": "Make the new bug templates less markup-heavy (#9438)\n\n- Remove emoji\r\n- Instead of `## H2 headings` just use `**bold**`\r\n- Add link to docs\r\n- Add suggestion for new users not to file a bug",
"url": "https://github.com/python/mypy/commit/6f07cb6a2e02446b909846f99817f674675e826e",
"date": "2020-09-11T18:35:59Z",
"sha_or_number": "6f07cb6a2e02446b909846f99817f674675e826e",
"files_changed": [
".github/ISSUE_TEMPLATE/bug.md",
".github/ISSUE_TEMPLATE/documentation.md",
".github/ISSUE_TEMPLATE/feature.md",
".github/ISSUE_TEMPLATE/question.md"
],
"additions": 24,
"deletions": 18,
"labels": [],
"related_issues": [
"9438"
],
"code_samples": [
{
"file_path": ".github/ISSUE_TEMPLATE/bug.md",
"language": "markdown",
"before_code": "---\nname: 🐛 Bug Report\nabout: Submit a bug report\nlabels: \"bug\"\n---\n\n<!--\nNote: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited\nfor this report: https://github.com/python/typeshed/issues\n-->\n\n## 🐛 Bug Report\n\n(A clear and concise description of what the bug is.)\n\n## To Reproduce\n\n(Write your steps here:)\n\n1. Step 1...\n1. Step 2...\n1. Step 3...\n\n## Expected Behavior\n\n<!--\n How did you expect your project to behave?",
"after_code": "---\nname: Bug Report\nabout: Submit a bug report\nlabels: \"bug\"\n---\n\n<!--\n If you're new to mypy and you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form\n instead.\n-->\n\n**Bug Report**\n\n<!--\nNote: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited\nfor this report: https://github.com/python/typeshed/issues\n-->\n\n(A clear and concise description of what the bug is.)\n\n**To Reproduce**\n\n(Write your steps here:)\n\n1. Step 1...\n2. Step 2...\n3. Step 3...\n\n**Expected Behavior**\n\n<!--\n How did you expect your project to behave?",
"diff_context": "---\nname: 🐛 Bug Report\nname: Bug Report\nabout: Submit a bug report\nlabels: \"bug\"\n---\n\n<!--\n If you're new to mypy and you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form\n instead.\n-->\n\n**Bug Report**\n\n<!--\nNote: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited\nfor this report: https://github.com/python/typeshed/issues\n-->\n\n## 🐛 Bug Report\n\n(A clear and concise description of what the bug is.)\n\n## To Reproduce\n**To Reproduce**\n\n(Write your steps here:)\n\n1. Step 1...\n1. Step 2...\n1. Step 3...\n2. Step 2...\n3. Step 3...\n\n## Expected Behavior\n**Expected Behavior**\n\n<!--\n How did you expect your project to behave?",
"change_type": "modification",
"lines_of_context": 20,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
}
],
"commit_message_style": "references_issue; has_body",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "mypy",
"title": "Add MYPY_CONFIG_FILE_DIR to environment when config file is read (2nd try) (#9414)",
"description": "Add MYPY_CONFIG_FILE_DIR to environment when config file is read (2nd try) (#9414)\n\n(This fixes the mistake I introduced in the previous version.)\r\n\r\nResubmit of #9403.\r\n\r\nFixes #7968.\r\n\r\nCo-authored-by: aghast <aghast@aghast.dev>",
"url": "https://github.com/python/mypy/commit/9d038469d80e36057c77e0a8a18831f829778f9d",
"date": "2020-09-04T20:55:14Z",
"sha_or_number": "9d038469d80e36057c77e0a8a18831f829778f9d",
"files_changed": [
"mypy/config_parser.py",
"mypy/test/testcmdline.py",
"test-data/unit/envvars.test"
],
"additions": 15,
"deletions": 0,
"labels": [],
"related_issues": [
"9403",
"7968",
"9414"
],
"code_samples": [],
"commit_message_style": "imperative_mood; references_issue; has_body",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "mypy",
"title": "Revert \"Add MYPY_CONFIG_FILE_DIR to environment when config file is read (#9403)\"",
"description": "Revert \"Add MYPY_CONFIG_FILE_DIR to environment when config file is read (#9403)\"\n\nReason: This broke CI.\n\nThis reverts commit 652aca96609c876c47ca7eaa68d67ac1e36f4215.",
"url": "https://github.com/python/mypy/commit/57d3473ae906fe945953b874d3dcb66efb2710ca",
"date": "2020-09-04T02:45:27Z",
"sha_or_number": "57d3473ae906fe945953b874d3dcb66efb2710ca",
"files_changed": [
"mypy/config_parser.py",
"mypy/test/testcmdline.py",
"test-data/unit/envvars.test"
],
"additions": 0,
"deletions": 15,
"labels": [],
"related_issues": [
"9403"
],
"code_samples": [],
"commit_message_style": "references_issue; has_body",
"python_version": null,
"pep_status": null
},
{
"type": "commit",
"repository": "mypy",
"title": "Revert issue template (#9345) -- it doesn't work",
"description": "Revert issue template (#9345) -- it doesn't work\n\nThis reverts commit 18c84e0f6906cfb315c367aa35550a4727cb57f8.",
"url": "https://github.com/python/mypy/commit/42a522089c6b418727e143c181128e902acf0908",
"date": "2020-08-27T22:21:28Z",
"sha_or_number": "42a522089c6b418727e143c181128e902acf0908",
"files_changed": [
".github/ISSUE_TEMPLATE/bug.md",
".github/ISSUE_TEMPLATE/documentation.md",
".github/ISSUE_TEMPLATE/feature.md",
".github/ISSUE_TEMPLATE/question.md",
".github/PULL_REQUEST_TEMPLATE.md",
"ISSUE_TEMPLATE.md"
],
"additions": 20,
"deletions": 110,
"labels": [],
"related_issues": [
"9345"
],
"code_samples": [
{
"file_path": ".github/ISSUE_TEMPLATE/bug.md",
"language": "markdown",
"before_code": "---\nname: 🐛 Bug Report\nlabels: \"bug\"\n---\n\n<!--\nNote: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited\nfor this report: https://github.com/python/typeshed/issues\n-->\n\n## 🐛 Bug Report\n\n(A clear and concise description of what the bug is.)\n\n## To Reproduce\n\n(Write your steps here:)\n\n1. Step 1...\n1. Step 2...\n1. Step 3...\n\n## Expected Behavior\n\n<!--\n How did you expect your project to behave?\n Its fine if youre not sure your understanding is correct.\n Write down what you thought would happen. If you just expected no errors, you can delete this section.\n-->\n\n(Write what you thought would happen.)\n\n## Actual Behavior\n\n<!--\n Did something go wrong?\n Is something broken, or not behaving as you expected?\n-->\n\n(Write what happened.)\n\n## Your Environment\n\n<!-- Include as many relevant details about the environment you experienced the bug in -->\n\n- Mypy version used:\n- Mypy command-line flags:\n- Mypy configuration options from `mypy.ini` (and other config files):\n- Python version used:\n- Operating system and version:\n\n<!--\nYou can freely edit this text, please remove all the lines\nyou believe are unnecessary.\n-->",
"after_code": "",
"diff_context": "---\nname: 🐛 Bug Report\nlabels: \"bug\"\n---\n\n<!--\nNote: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited\nfor this report: https://github.com/python/typeshed/issues\n-->\n\n## 🐛 Bug Report\n\n(A clear and concise description of what the bug is.)\n\n## To Reproduce\n\n(Write your steps here:)\n\n1. Step 1...\n1. Step 2...\n1. Step 3...\n\n## Expected Behavior\n\n<!--\n How did you expect your project to behave?\n Its fine if youre not sure your understanding is correct.\n Write down what you thought would happen. If you just expected no errors, you can delete this section.\n-->\n\n(Write what you thought would happen.)\n\n## Actual Behavior\n\n<!--\n Did something go wrong?\n Is something broken, or not behaving as you expected?\n-->\n\n(Write what happened.)\n\n## Your Environment\n\n<!-- Include as many relevant details about the environment you experienced the bug in -->\n\n- Mypy version used:\n- Mypy command-line flags:\n- Mypy configuration options from `mypy.ini` (and other config files):\n- Python version used:\n- Operating system and version:\n\n<!--\nYou can freely edit this text, please remove all the lines\nyou believe are unnecessary.\n-->",
"change_type": "deletion",
"lines_of_context": 0,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": ".github/ISSUE_TEMPLATE/feature.md",
"language": "markdown",
"before_code": "---\nname: 🚀 Feature\nlabels: \"feature\"\n---\n\n## 🚀 Feature\n\n(A clear and concise description of your feature proposal.)\n\n## Pitch\n\n(Please explain why this feature should be implemented and how it would be used. Add examples, if applicable.)",
"after_code": "",
"diff_context": "---\nname: 🚀 Feature\nlabels: \"feature\"\n---\n\n## 🚀 Feature\n\n(A clear and concise description of your feature proposal.)\n\n## Pitch\n\n(Please explain why this feature should be implemented and how it would be used. Add examples, if applicable.)",
"change_type": "deletion",
"lines_of_context": 0,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
},
{
"file_path": ".github/PULL_REQUEST_TEMPLATE.md",
"language": "markdown",
"before_code": "### Have you read the [Contributing Guidelines](https://github.com/python/mypy/blob/master/CONTRIBUTING.md)?\n\n(Once you have, delete this section. If you leave it in, your PR may be closed without action.)\n\n### Description\n\n<!--\nIf this pull request closes or fixes an issue, write Closes #NNN\" or \"Fixes #NNN\" in that exact\nformat.\n-->\n\n(Explain how this PR changes mypy.)\n\n## Test Plan\n\n<!--\nIf this is a documentation change, rebuild the docs (link to instructions) and review the changed pages for markup errors.\nIf this is a code change, include new tests (link to the testing docs). Be sure to run the tests locally and fix any errors before submitting the PR (more instructions).\nIf this change cannot be tested by the CI, please explain how to verify it manually.\n-->\n\n(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)",
"after_code": "",
"diff_context": "### Have you read the [Contributing Guidelines](https://github.com/python/mypy/blob/master/CONTRIBUTING.md)?\n\n(Once you have, delete this section. If you leave it in, your PR may be closed without action.)\n\n### Description\n\n<!--\nIf this pull request closes or fixes an issue, write Closes #NNN\" or \"Fixes #NNN\" in that exact\nformat.\n-->\n\n(Explain how this PR changes mypy.)\n\n## Test Plan\n\n<!--\nIf this is a documentation change, rebuild the docs (link to instructions) and review the changed pages for markup errors.\nIf this is a code change, include new tests (link to the testing docs). Be sure to run the tests locally and fix any errors before submitting the PR (more instructions).\nIf this change cannot be tested by the CI, please explain how to verify it manually.\n-->\n\n(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)",
"change_type": "deletion",
"lines_of_context": 0,
"function_name": null,
"class_name": null,
"docstring": null,
"coding_patterns": []
}
],
"commit_message_style": "concise_subject; references_issue; has_body",
"python_version": null,
"pep_status": null
}
]

79
notebooks/data/my_developer_rules.md vendored Normal file
View file

@ -0,0 +1,79 @@
Assistant Guidelines
These rules are absolutely imperative to adhere to. Comply with them precisely as they are outlined.
The agent must use sequential thinking MCP tool to work out problems.
Core Behavior Guidelines
Respond only to explicit requests. Do not add files, code, tests, or comments unless asked.
Follow instructions precisely. No assumptions or speculative additions.
Use provided context accurately.
Avoid extra output. No debugging logs or test harnesses unless requested.
Produce clean, optimized code when code is requested. Respect existing style.
Deliver complete, standalone solutions. No placeholders.
Limit file creation. Only create new files when necessary.
If you modify the model in a user's code, you must confirm with the user and never be sneaky. Always tell the user exactly what you are doing.
Communication & Delivery
9. Don't explain unless asked. Do not expose reasoning in outputs.
10. If unsure, say "I don't know." Avoid hallucinated content.
11. Maintain consistency across sessions. Refer to project memory and documentation.
12. Respect privacy and permissions. Never leak or infer secure data.
13. Prioritize targeted edits over full rewrites.
14. Optimize incrementally. Avoid unnecessary overhauls.
Spec.md Requirement
You must maintain a file named Spec.md. This file acts as the single source of truth for the project.
Rules:
Before starting any implementation, check if Spec.md already exists.
If it does not exist, create one using the template provided below.
Always update Spec.md before and after any major change.
Use the contents of Spec.md to guide logic, structure, and implementation decisions.
When updating a section, condense previous content to keep the document concise.
Spec.md Starter Template (Plain Text Format)
Title: Spec.md Project Specification
Section: Purpose
Describe the main goal of this feature, tool, or system.
Section: Core Functionality
List the key features, expected behaviors, and common use cases.
Section: Architecture Overview
Summarize the technical setup, frameworks used, and main modules or services.
Section: Input and Output Contracts
List all inputs and outputs in a table-like format:
Input: describe the input data, its format, and where it comes from.
Output: describe the output data, its format, and its destination.
Section: Edge Cases and Constraints
List known limitations, special scenarios, and fallback behaviors.
Section: File and Module Map
List all important files or modules and describe what each one is responsible for.
Section: Open Questions or TODOs
Create a checklist of unresolved decisions, logic that needs clarification, or tasks that are still pending.
Section: Last Updated
Include the most recent update date and who made the update.

75
notebooks/data/pep_style_guide.md vendored Normal file
View file

@ -0,0 +1,75 @@
# PEP 8 Style Guide: Essentials
## Code Layout
- Indentation: 4 spaces per level
- Line length: 79 for code (88/100 acceptable by team), 72 for comments/docstrings
- Blank lines: 2 around top-level defs/classes, 1 between methods
```python
# Hanging indent for long calls
foo = long_function_name(
var_one, var_two,
var_three, var_four,
)
```
## Imports
- One import per line
- Group: stdlib, third-party, local
- Prefer absolute imports; avoid wildcard imports
```python
import os
import sys
from subprocess import Popen, PIPE
import requests
from myproject.models import User
```
## Whitespace
- No space inside brackets or before commas/semicolons
- Spaces around binary operators
```python
x = 1
hypot2 = x * x + y * y
```
## Naming
- snake_case: functions, variables
- PascalCase: classes
- SCREAMING_SNAKE_CASE: constants
## Comments & Docstrings
- Use complete sentences; keep up to date
- Triple-double quotes for public modules, classes, functions
```python
def f(x: int) -> int:
"""Return x doubled."""
return x * 2
```
## Type Hints
- Space after colon; arrow for returns
```python
def munge(s: str) -> str: ...
```
## Tooling
- Black, isort, Flake8 (or Ruff) to automate style
- Example pyproject.toml excerpt:
```toml
[tool.black]
line-length = 88
[tool.isort]
profile = "black"
```
## Common Violations
- E501: line too long -> break with parentheses
- E225: missing whitespace around operator
- E402: module import not at top of file

75
notebooks/data/zen_principles.md vendored Normal file
View file

@ -0,0 +1,75 @@
# The Zen of Python: Practical Guide
## Overview
The Zen of Python (Tim Peters, import this) captures Python's philosophy. Use these principles as a checklist during design, coding, and reviews.
## Key Principles With Guidance
### 1. Beautiful is better than ugly
Prefer descriptive names, clear structure, and consistent formatting.
### 2. Explicit is better than implicit
Be clear about behavior, imports, and types.
```python
from datetime import datetime, timedelta
def get_future_date(days_ahead: int) -> datetime:
return datetime.now() + timedelta(days=days_ahead)
```
### 3. Simple is better than complex
Choose straightforward solutions first.
### 4. Complex is better than complicated
When complexity is needed, organize it with clear abstractions.
### 5. Flat is better than nested
Use early returns to reduce indentation.
### 6. Sparse is better than dense
Give code room to breathe with whitespace.
### 7. Readability counts
Optimize for human readers; add docstrings for nontrivial code.
### 8. Special cases aren't special enough to break the rules
Stay consistent; exceptions should be rare and justified.
### 9. Although practicality beats purity
Prefer practical solutions that teams can maintain.
### 10. Errors should never pass silently
Handle exceptions explicitly; log with context.
### 11. Unless explicitly silenced
Silence only specific, acceptable errors and document why.
### 12. In the face of ambiguity, refuse the temptation to guess
Require explicit inputs and behavior.
### 13. There should be one obvious way to do it
Prefer standard library patterns and idioms.
### 14. Although that way may not be obvious at first
Learn Python idioms; embrace clarity over novelty.
### 15. Now is better than never; 16. Never is often better than right now
Iterate, but don't rush broken code.
### 17/18. Hard to explain is bad; easy to explain is good
Prefer designs you can explain simply.
### 19. Namespaces are one honking great idea
Use modules/packages to separate concerns; avoid wildcard imports.
## Modern Python Tie-ins
- Type hints reinforce explicitness
- Context managers enforce safe resource handling
- Dataclasses improve readability for data containers
## Quick Review Checklist
- Is it readable and explicit?
- Is this the simplest working solution?
- Are errors explicit and logged?
- Are modules/namespaces used appropriately?

BIN
notebooks/starter_tutorial.zip vendored Normal file

Binary file not shown.

1222
notebooks/tutorial.ipynb vendored Normal file

File diff suppressed because one or more lines are too long

939
notebooks/tutorial_stripped.ipynb vendored Normal file
View file

@ -0,0 +1,939 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "6f22c8fe6d92cfcc",
"metadata": {},
"source": [
"Using Cognee with Python Development Data\n",
"\n",
"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."
]
},
{
"cell_type": "markdown",
"id": "fe69acbf9ab1a22b",
"metadata": {},
"source": [
"What You'll Learn\n",
"\n",
"In this comprehensive tutorial, you'll discover how to transform scattered development data into an intelligent knowledge system that enhances your coding workflow. By the end, you'll have:\n",
"\n",
"- Connected disparate data sources (Guido's CPython contributions, mypy development, PEP discussions, your Python projects) into a unified AI memory graph\n",
"- Built an memory layer that understands Python design philosophy, best practice coding patterns, and your preferences and experience\n",
"- Learn how to use intelligent search capabilities that combine the diverse context\n",
"- Integrated everything with your coding environment through MCP (Model Context Protocol)\n",
"\n",
"This tutorial demonstrates the power of knowledge graphs and retrieval-augmented generation (RAG) for software development, showing you how to build systems that learn from Python's creator and improve your own Python development."
]
},
{
"cell_type": "markdown",
"id": "b03b59c064213dd4",
"metadata": {},
"source": [
"Cognee and its core operations\n",
"\n",
"Before we dive in, let's understand the core Cognee operations we'll be working with:\n",
"\n",
"- cognee.add() - Ingests raw data (files, text, APIs) into the system\n",
"- cognee.cognify() - Processes and structures data into a knowledge graph using AI\n",
"- cognee.search() - Queries the knowledge graph with natural language or Cypher\n",
"- cognee.memify() - Cognee's \"secret sauce\" that infers implicit connections and rules from your data"
]
},
{
"cell_type": "markdown",
"id": "6a7669fbb6a3e6c7",
"metadata": {},
"source": [
"Data used in this tutorial\n",
"\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_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.”"
]
},
{
"cell_type": "markdown",
"id": "93c9783037715026",
"metadata": {},
"source": [
"First data ingestion: 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."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8743ed520b4de37",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:39:53.511862Z",
"start_time": "2025-09-07T14:35:06.228778Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"User 666b4a6d-34ef-4221-aba2-68a64a7b1eaa has registered.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[1mEmbeddingRateLimiter initialized: enabled=False, requests_limit=60, interval_seconds=60\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.623496\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.624579\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.625619\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.646868\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRegistered loader: pypdf_loader\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.infrastructure.loaders.LoaderEngine\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.647515\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRegistered loader: text_loader\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.infrastructure.loaders.LoaderEngine\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.647982\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRegistered loader: image_loader\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.infrastructure.loaders.LoaderEngine\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.648557\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRegistered loader: audio_loader\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.infrastructure.loaders.LoaderEngine\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.649816\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRegistered loader: unstructured_loader\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.infrastructure.loaders.LoaderEngine\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.660104\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.660527\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.661133\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.685106\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.685571\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.685911\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.693221\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task started: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:09.721431\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:35:24.808308\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:10.235598\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:18.963698\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 202 nodes and 335 edges in 0.04 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:20.167605\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:20.168080\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:20.168371\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:20.185430\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:22.765687\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:22.767063\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:24.039208\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 203 nodes and 337 edges in 0.02 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:25.499226\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:25.500201\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:25.500492\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:25.514153\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:27.574764\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:27.576271\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:28.552555\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 204 nodes and 339 edges in 0.04 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:29.917238\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:29.917690\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:29.918038\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:29.931887\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:36:50.418281\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:37:31.380478\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:37:36.217182\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 332 nodes and 535 edges in 0.04 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:37:37.608817\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:37:37.610610\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:37:37.610882\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:37:37.623203\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:37:59.333307\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:38:30.317584\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:38:36.143492\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 415 nodes and 697 edges in 0.05 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:38:37.703572\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:38:37.704043\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:38:37.704434\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:38:37.705143\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:07.687322\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:41.229696\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:45.991597\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 513 nodes and 872 edges in 0.06 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.641833\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.642446\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.642764\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.646206\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task completed: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.646490\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.646738\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.647065\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.722293\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 513 nodes and 872 edges in 0.05 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:47.727445\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mGraph projection completed: 513 nodes, 872 edges in 0.05s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mCogneeGraph\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:48.085263\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mVector collection retrieval completed: Retrieved distances from 6 collections in 0.04s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.shared.logging_utils\u001b[0m]\u001b[0m\n"
]
}
],
"source": [
"await cognee.add(\n",
" \"file://data/guido_contributions.json\",\n",
" node_set=[\"guido_data\"]\n",
")\n",
"await cognee.cognify(temporal_cognify=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e5dde604",
"metadata": {},
"outputs": [],
"source": [
"# Now that we've added data, let's search\n",
"results = await cognee.search(\"Show me commits\")\n",
"print(results)"
]
},
{
"cell_type": "markdown",
"id": "10d582d02ead905e",
"metadata": {},
"source": [
"What's just happened?\n",
"The search() function uses natural language to query a knowledge graph containing Guido's development history.\n",
"Unlike traditional databases, Cognee understands the relationships between commits, language features, design decisions, and evolution over time.\n",
"\n",
"Cognee also allows you to visualize the graphs created:"
]
},
{
"cell_type": "markdown",
"id": "3418aa17bf35e3bb",
"metadata": {},
"source": [
"Why visualization matters: Knowledge graphs reveal hidden patterns in data. In this case, patterins in Guido's contributions to Python's development. The interactive visualization shows how different projects (CPython, mypy, PEPs), features, and time periods connect - insights that show Python's thoughtful evolution.\n",
"\n",
"Take a moment to explore the graph. Notice how:\n",
"\n",
"- CPython core development clusters around 2020\n",
"- Mypy contributions focus on fixtures and run classes\n",
"- PEP discussions mention Thomas Grainiger and Adam Turner\n",
"- Time-based connections show how ideas evolved into features"
]
},
{
"cell_type": "markdown",
"id": "5e8d9094a09ae05d",
"metadata": {},
"source": [
"Ingesting more data\n",
"\n",
"Now we'll add the remaining data and see how they connections emerge between Guido's contributions, Python best practices, and user conversations."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5315318324968f0f",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:40:48.589875Z",
"start_time": "2025-09-07T14:39:53.785054Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[2m2025-09-07T14:39:53.829241\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.829640\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.829940\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.843454\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.843823\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.844182\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.871709\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.872071\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.872367\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.882151\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.882510\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.882809\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.912204\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.912690\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.912959\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.923068\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.923361\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.923585\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.951487\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.951861\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.952214\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.967297\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `ingest_data`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.967650\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `resolve_data_directories`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.967914\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `576f15b1-6366-5079-b586-01bf92a45a1d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.992515\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.992977\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.993474\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.994416\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.994712\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.995079\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.995706\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.997019\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.997301\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.998158\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.998553\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:53.998864\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:54.013055\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task started: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:54.017852\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:54.022009\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task started: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:54.030806\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:54.036343\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task started: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:54.039116\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:54.039508\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task started: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:54.041717\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:55.849185\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:55.849799\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:56.665144\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 516 nodes and 875 edges in 0.07 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:58.458740\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:58.459243\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:58.459572\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:58.463783\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task completed: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:58.464114\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:58.464420\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:39:58.464859\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:04.250313\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:05.899016\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:08.508985\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:10.092969\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:12.744365\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 554 nodes and 922 edges in 0.06 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:14.420588\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:14.421023\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:14.421274\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:14.424860\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task completed: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:14.425243\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:14.425506\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:14.425824\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:32.133853\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:37.935452\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 647 nodes and 1090 edges in 0.07 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:39.961419\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:39.961913\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:39.962156\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:39.965642\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task completed: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:39.965922\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:39.966156\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:39.966623\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:41.064653\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:46.322105\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 784 nodes and 1335 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:48.573983\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_data_points`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:48.574420\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_knowledge_graph_from_events`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:48.574696\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `extract_events_and_timestamps`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:48.578174\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task completed: `extract_chunks_from_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:48.578472\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `check_permissions_on_dataset`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:48.578720\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `classify_documents`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:48.579015\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `be77ae78-61ae-5066-8df8-04ba903dbe6d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"{UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'): PipelineRunCompleted(status='PipelineRunCompleted', pipeline_run_id=UUID('1de1aac8-5256-5aa5-afd4-260a0e840b9b'), dataset_id=UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'), dataset_name='main_dataset', payload=None, data_ingestion_info=[{'run_info': PipelineRunCompleted(status='PipelineRunCompleted', pipeline_run_id=UUID('1de1aac8-5256-5aa5-afd4-260a0e840b9b'), dataset_id=UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'), dataset_name='main_dataset', payload=None, data_ingestion_info=None), 'data_id': UUID('36e0aee3-1c79-5ba5-976d-743b572435b9')}, {'run_info': PipelineRunAlreadyCompleted(status='PipelineRunAlreadyCompleted', pipeline_run_id=UUID('1de1aac8-5256-5aa5-afd4-260a0e840b9b'), dataset_id=UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'), dataset_name='main_dataset', payload=None, data_ingestion_info=None), 'data_id': UUID('5e252445-7af3-5852-97be-2871ee963f76')}, {'run_info': PipelineRunCompleted(status='PipelineRunCompleted', pipeline_run_id=UUID('1de1aac8-5256-5aa5-afd4-260a0e840b9b'), dataset_id=UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'), dataset_name='main_dataset', payload=None, data_ingestion_info=None), 'data_id': UUID('617bb29d-15c4-59a8-8597-7225d4bbe26f')}, {'run_info': PipelineRunCompleted(status='PipelineRunCompleted', pipeline_run_id=UUID('1de1aac8-5256-5aa5-afd4-260a0e840b9b'), dataset_id=UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'), dataset_name='main_dataset', payload=None, data_ingestion_info=None), 'data_id': UUID('8d8fa539-17f2-54b2-9bd8-a355c13de413')}, {'run_info': PipelineRunCompleted(status='PipelineRunCompleted', pipeline_run_id=UUID('1de1aac8-5256-5aa5-afd4-260a0e840b9b'), dataset_id=UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'), dataset_name='main_dataset', payload=None, data_ingestion_info=None), 'data_id': UUID('a95a6a59-2543-5e19-bed0-dd4b5c5f1440')}])}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"await cognee.add(\"file://data/copilot_conversations.json\", node_set=[\"developer_data\"])\n",
"await cognee.add(\"file://data/my_developer_rules.md\", node_set=[\"developer_data\"])\n",
"await cognee.add(\"file://data/zen_principles.md\", node_set=[\"principles_data\"])\n",
"await cognee.add(\"file://data/pep_style_guide.md\", node_set=[\"principles_data\"])\n",
"\n",
"await cognee.cognify(temporal_cognify=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "98b69c45db2fca3",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:40:51.305617Z",
"start_time": "2025-09-07T14:40:48.605622Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[2m2025-09-07T14:40:48.717540\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 784 nodes and 1335 edges in 0.10 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:48.723536\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mGraph projection completed: 784 nodes, 1335 edges in 0.11s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mCogneeGraph\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:49.150849\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mVector collection retrieval completed: Retrieved distances from 6 collections in 0.03s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.shared.logging_utils\u001b[0m]\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Preparing answer about type hinting challenges and mypy/Guido approach...']\n"
]
}
],
"source": [
"results = await cognee.search(\n",
" \"What Python type hinting challenges did I face, and how does Guido approach similar problems in mypy?\",\n",
" query_type=cognee.SearchType.GRAPH_COMPLETION\n",
")\n",
"print(results)"
]
},
{
"cell_type": "markdown",
"id": "6c49c4c252036fa1",
"metadata": {},
"source": [
"You'll see that cognee has connected your Python development challenges with Guido's approaches, revealing patterns like:\n",
"\n",
"- \"Type hint implementation failed due to circular imports - similar to issue Guido solved in mypy PR #1234\"\n",
"- \"Performance bottleneck in list comprehension matches pattern Guido optimized in CPython commit abc123\""
]
},
{
"cell_type": "markdown",
"id": "a1f4606bfed8fc45",
"metadata": {},
"source": [
"Memify\n",
"\n",
"Let's now introduce the memory functions. These algorithms run on top of your semantic layer, connecting the dots and improving the search.\n",
"\n",
"Memify is customizable and can use any transformation you'd like to write. But it also requires"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "20234960f7566b15",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:43:42.390990Z",
"start_time": "2025-09-07T14:40:51.321301Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[2m2025-09-07T14:40:51.426773\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 784 nodes and 1335 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:51.432999\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mGraph projection completed: 784 nodes, 1335 edges in 0.08s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mCogneeGraph\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:51.449998\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run started: `3538f0d3-f111-5205-abf4-4cfda343756d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:51.450407\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task started: `extract_subgraph_chunks`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:40:51.450742\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:05.331800\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 788 nodes and 1338 edges in 0.09 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:07.730018\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 788 nodes and 1341 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:09.998799\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:09.999234\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:10.014853\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 4 nodes and 3 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:17.347059\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 790 nodes and 1343 edges in 0.09 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:19.354567\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 790 nodes and 1345 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:20.830388\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:20.830845\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:20.845333\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 6 nodes and 5 edges for NodeSet in 0.00 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:29.525183\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 793 nodes and 1348 edges in 0.10 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:31.837942\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 793 nodes and 1351 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:34.371498\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:34.372003\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:34.386997\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 9 nodes and 8 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:52.110870\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 797 nodes and 1355 edges in 0.09 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:54.662998\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 797 nodes and 1359 edges in 0.10 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:56.536947\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:56.537543\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:41:56.555702\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 13 nodes and 12 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:12.887813\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 800 nodes and 1362 edges in 0.12 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:15.248448\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 800 nodes and 1365 edges in 0.09 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:17.221284\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:17.221925\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:17.243052\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 16 nodes and 15 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:27.286546\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 803 nodes and 1368 edges in 0.09 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:29.381832\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 803 nodes and 1371 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:31.321887\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:31.322839\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:31.336200\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 19 nodes and 18 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:39.575903\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 806 nodes and 1374 edges in 0.10 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:41.989514\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 806 nodes and 1377 edges in 0.41 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:43.962812\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:43.963271\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:43.978252\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 22 nodes and 21 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:53.367959\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 809 nodes and 1380 edges in 0.09 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:55.300671\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 809 nodes and 1383 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:57.099099\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:57.099708\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:42:57.117196\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 25 nodes and 24 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:19.642215\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 813 nodes and 1387 edges in 0.09 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:21.652556\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 813 nodes and 1391 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:23.874571\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:23.875096\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task started: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:23.889933\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 29 nodes and 28 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:38.330093\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 817 nodes and 1395 edges in 0.12 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:40.354659\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 817 nodes and 1399 edges in 0.08 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:42.377593\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mCoroutine task completed: `add_rule_associations`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:42.378288\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mAsync Generator task completed: `extract_subgraph_chunks`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_base\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:42.378593\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mPipeline run completed: `3538f0d3-f111-5205-abf4-4cfda343756d`\u001b[0m [\u001b[0m\u001b[1m\u001b[34mrun_tasks_with_telemetry()\u001b[0m]\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"{UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'): PipelineRunCompleted(status='PipelineRunCompleted', pipeline_run_id=UUID('cc37b094-c41d-54fc-b569-a40a3709d579'), dataset_id=UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'), dataset_name='main_dataset', payload=None, data_ingestion_info=[{'run_info': PipelineRunCompleted(status='PipelineRunCompleted', pipeline_run_id=UUID('cc37b094-c41d-54fc-b569-a40a3709d579'), dataset_id=UUID('06a9442f-fee9-51a8-a5b9-ea18d1b954b7'), dataset_name='main_dataset', payload=None, data_ingestion_info=None)}])}"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"await cognee.memify()"
]
},
{
"cell_type": "markdown",
"id": "58d3ccec16f67c24",
"metadata": {},
"source": [
"What memify() does for Python: This advanced function uses AI to:\n",
"\n",
"- Infer rule patterns from your code (e.g., \"When implementing iterators, always follow the protocol Guido established\")\n",
"- Connect design philosophy to practice (e.g., linking \"explicit is better than implicit\" to your type hinting decisions)\n"
]
},
{
"cell_type": "markdown",
"id": "a304033f9f0f5dcf",
"metadata": {},
"source": [
"Now let's see how the system has connected your Python development patterns with established best practices:\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "518fa9b17a604657",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:43:44.837614Z",
"start_time": "2025-09-07T14:43:42.465351Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[2m2025-09-07T14:43:42.570204\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 817 nodes and 1399 edges in 0.09 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:42.576838\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mGraph projection completed: 817 nodes, 1399 edges in 0.10s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mCogneeGraph\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:42.929319\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mVector collection retrieval completed: Retrieved distances from 6 collections in 0.03s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.shared.logging_utils\u001b[0m]\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Python Pattern Analysis: ['Preparing concise alignment analysis...']\n"
]
}
],
"source": [
"# Search for connections between your async patterns and Python philosophy\n",
"results = await cognee.search(\n",
" query_text= \"How does my AsyncWebScraper implementation align with Python's design principles?\",\n",
" query_type=cognee.SearchType.GRAPH_COMPLETION\n",
")\n",
"print(\"Python Pattern Analysis:\", results)"
]
},
{
"cell_type": "markdown",
"id": "2c77c1582ab9fc32",
"metadata": {},
"source": [
"Nodeset filtering\n",
"\n",
"Let's see how should variables be named\n",
"\n",
"Stay tuned for notesets, our way to filter exact nodeset details. Coming soon!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c64036c03abe41e7",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:43:49.542281Z",
"start_time": "2025-09-07T14:43:44.852455Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[2m2025-09-07T14:43:44.878134\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 5 nodes and 6 edges for NodeSet in 0.01 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:44.878868\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mGraph projection completed: 5 nodes, 6 edges in 0.01s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mCogneeGraph\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:45.578030\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mVector collection retrieval completed: Retrieved distances from 6 collections in 0.04s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.shared.logging_utils\u001b[0m]\u001b[0m\n"
]
}
],
"source": [
"results = await cognee.search(\n",
" query_text= \"How should variables be named?\",\n",
")"
]
},
{
"cell_type": "markdown",
"id": "c641b8b7e50dd2ae",
"metadata": {},
"source": [
"Temporal graphs\n",
"\n",
"As we used temporal_cognify option for each cognification, we can ask time related questions, for example:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "28e7d5a75e076b8f",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:43:55.278031Z",
"start_time": "2025-09-07T14:43:49.555704Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[2m2025-09-07T14:43:51.896018\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mNo timestamps identified based on the query, performing retrieval using triplet search on events and entities.\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.shared.logging_utils\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:52.009621\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 817 nodes and 1399 edges in 0.10 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:52.016085\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mGraph projection completed: 817 nodes, 1399 edges in 0.10s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mCogneeGraph\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:52.426193\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mVector collection retrieval completed: Retrieved distances from 6 collections in 0.03s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.shared.logging_utils\u001b[0m]\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"[\"Using the provided context, here is a brief summary of what we can learn from Guido's contributions in 2025:\"]"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"await cognee.search(\n",
" query_text = \"What can we learn from Guido's contributions in 2025?\",\n",
" query_type=cognee.SearchType.TEMPORAL\n",
")"
]
},
{
"cell_type": "markdown",
"id": "ec6cf074a6c272ab",
"metadata": {},
"source": [
"Feedback loops\n",
"\n",
"Note that when you search, you can enable storing of results:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "67dec85a658aad76",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:43:58.472950Z",
"start_time": "2025-09-07T14:43:55.288993Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\u001b[2m2025-09-07T14:43:55.438956\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRetrieved 817 nodes and 1399 edges in 0.10 seconds\u001b[0m [\u001b[0m\u001b[1m\u001b[34mNeo4jAdapter\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:55.456944\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mGraph projection completed: 817 nodes, 1399 edges in 0.12s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mCogneeGraph\u001b[0m]\u001b[0m\n",
"\n",
"\u001b[2m2025-09-07T14:43:55.823583\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mVector collection retrieval completed: Retrieved distances from 6 collections in 0.03s\u001b[0m [\u001b[0m\u001b[1m\u001b[34mcognee.shared.logging_utils\u001b[0m]\u001b[0m\n"
]
}
],
"source": [
"answer = await cognee.search(\n",
" query_type=cognee.SearchType.GRAPH_COMPLETION,\n",
" query_text=\"What is the most zen thing about Python?\",\n",
" save_interaction=True, # This enables feedback later\n",
")"
]
},
{
"cell_type": "markdown",
"id": "2f64d90e6dadaefb",
"metadata": {},
"source": [
"This enables giving feedback, that itself can also be stored in the graph and will be included in future searches:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "870149ea58fd109c",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-07T14:44:00.503091Z",
"start_time": "2025-09-07T14:43:58.480893Z"
}
},
"outputs": [],
"source": [
"feedback = await cognee.search(\n",
" query_type=cognee.SearchType.FEEDBACK,\n",
" query_text=\"Last result was useful, I like code that complies with best practices.\",\n",
" last_k=1,\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}