This is a major release introducing custom schema support, improved visualization controls, and important fixes.
β¨ New Features
π¨ Custom Schema Support (GQL-Inspired)
Define your own graph structures using JSON schema files! This powerful new feature allows you to:
- Custom node and edge labels - No longer limited to
Person/knows - 25+ property types - String, Int, Float, Boolean, Date, DateTime, Email, UUID, and more
- Type constraints - Set
min,max,precisionfor numeric types; date ranges for dates - Enum values - Define fixed sets of allowed values
- Symmetric edge properties - Ensure AβB and BβA share consistent values
- Computed node properties - Calculate values from graph structure (e.g.,
degree)
# Use a custom schema
knows -n 100 -e 200 --schema my_schema.jsonπ Full documentation: SCHEMA.md
π 14 Ready-to-Use Example Schemas
New schema-examples/ directory with templates for various domains:
| Simple Examples | Real-World Examples |
|---|---|
π₯ simple_friendship_schema.json |
π’ employee_schema.json |
β
simple_task_schema.json |
π ecommerce_schema.json |
π simple_webpage_schema.json |
π citation_network_schema.json |
π¬ simple_message_schema.json |
π¬ movie_database_schema.json |
π transportation_schema.json |
|
π° financial_schema.json |
|
π₯οΈ infrastructure_schema.json |
|
π§ knowledge_graph_schema.json |
|
π± social_network_schema.json |
π Large Graph Visualization Controls
New options for handling large graphs in visual outputs (svg, png, jpg, pdf, -d):
-l N,--limit N- Maximum nodes to display (default: 50)--no-limit- Show full graph without truncation--hide-info- Hide node count indicator from output
# Display up to 100 nodes
knows -n 500 -e 1000 -f svg -l 100 > graph.svg
# Show all nodes (may be slow for large graphs)
knows -n 200 -e 400 -f png --no-limit graph.pngVisualizations now use BFS-based subgraph extraction centered on the most connected nodes, with improved spring layout spacing.
π Breaking Changes
π― friendCount Now Reflects Actual Connections
friendCount property was previously generated as a random number (1-1000), which didn't match the actual graph topology. Now friendCount is computed as the actual node degree (number of unique connections) after graph generation. This ensures the property accurately represents the node's connectivity in the graph.
π Python 3.10+ Required
Dropped support for Python 3.9 (end of life). Minimum required version is now Python 3.10.
π¦ Updated Dependencies
| Package | Old Version | New Version |
|---|---|---|
networkx |
β₯3.2.0 | β₯3.4.0 |
matplotlib |
β₯3.8.4 | β₯3.10.0 |
scipy |
β₯1.12.0 | β₯1.14.0 |
pytest |
β₯8.0.0 | β₯8.4.0 |
π New Dependency
jsonschemaβ₯4.22.0 (for schema validation)
π Other Changes
- π New documentation: Comprehensive SCHEMA.md with examples
- β
JSON Schema for validation: IDE autocompletion and validation support via
knows/schema.json - π§Ή Simplified codebase: Removed NetworkX version compatibility workarounds (now requires 3.4+)
- π§ͺ Expanded test suite: 737 new lines of tests for schema functionality
- π― Type hints: Improved type annotations throughout the codebase
- π CLI updates: New argument group for graphics output options
π₯ Install/Update
pip install knows --upgradeOr with Docker:
docker pull lszeremeta/knows:3.0.0π Full Changelog
Files Added
SCHEMA.md- Schema documentationknows/schema.py- Schema loading and validationknows/schema.json- JSON Schema for IDE validationtests/test_schema.py- Schema testsschema-examples/- 14 example schema files
Files Modified
knows/__init__.py- Version bumpknows/__main__.py- Schema and visualization options integrationknows/command_line_interface.py- New CLI argumentsknows/graph.py- Schema support, computed propertiesknows/graph_drawer.py- Subgraph extraction, layout improvementsknows/output_format.py- Visualization limit supportpyproject.toml- Version, dependencies, Python versionREADME.md- Updated documentation- All test files - Updated for new features
Full Changelog: v2.0.5...v3.0.0