Skip to content

Commit 28b69ca

Browse files
authored
Merge pull request #1 from pyscal/copilot/add-knowledge-dictionary-package
Add knowledge_dictionary package structure with empty Python files
2 parents 073c353 + f164472 commit 28b69ca

File tree

5 files changed

+104
-1
lines changed

5 files changed

+104
-1
lines changed

README.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,68 @@
11
# knowledge_dictionary
2-
A python dictionary template for storing serialisable metadata
2+
3+
A Python dictionary template for storing serializable metadata.
4+
5+
## Installation
6+
7+
Install from source:
8+
9+
```bash
10+
pip install -e .
11+
```
12+
13+
## Usage
14+
15+
### Using Templates
16+
17+
Import and use predefined dictionary templates:
18+
19+
```python
20+
from knowledge_dictionary import KNOWLEDGE_TEMPLATE, MINIMAL_TEMPLATE, EXTENDED_TEMPLATE
21+
22+
# Use a template directly
23+
my_data = KNOWLEDGE_TEMPLATE.copy()
24+
my_data['metadata']['author'] = 'John Doe'
25+
my_data['content']['title'] = 'My Knowledge'
26+
```
27+
28+
### Using KnowledgeDict Class
29+
30+
Work with knowledge dictionaries using the KnowledgeDict class:
31+
32+
```python
33+
from knowledge_dictionary import KnowledgeDict
34+
35+
# Create a new knowledge dictionary
36+
kd = KnowledgeDict(template="knowledge")
37+
38+
# Set values using dot notation
39+
kd.set("metadata.author", "John Doe")
40+
kd.set("content.title", "My Knowledge")
41+
kd.set("content.description", "A collection of important information")
42+
43+
# Get values
44+
author = kd.get("metadata.author")
45+
title = kd.get("content.title")
46+
47+
# Convert to standard dictionary
48+
data = kd.to_dict()
49+
50+
# Serialize to JSON
51+
json_str = kd.to_json(indent=2)
52+
53+
# Save to file
54+
kd.save("my_knowledge.json")
55+
56+
# Load from file
57+
kd_loaded = KnowledgeDict.load("my_knowledge.json")
58+
```
59+
60+
## Available Templates
61+
62+
- **KNOWLEDGE_TEMPLATE**: Standard template with metadata, content, and schema sections
63+
- **MINIMAL_TEMPLATE**: Minimal template with just title, description, and data
64+
- **EXTENDED_TEMPLATE**: Extended template with additional provenance tracking
65+
66+
## License
67+
68+
MIT License

knowledge_dictionary/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

knowledge_dictionary/templates.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "knowledge-dictionary"
7+
version = "0.1.0"
8+
description = "A Python dictionary template for storing serializable metadata"
9+
readme = "README.md"
10+
requires-python = ">=3.7"
11+
license = {file = "LICENSE"}
12+
authors = [
13+
{name = "pyscal"},
14+
]
15+
classifiers = [
16+
"Development Status :: 3 - Alpha",
17+
"Intended Audience :: Developers",
18+
"License :: OSI Approved :: MIT License",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.7",
21+
"Programming Language :: Python :: 3.8",
22+
"Programming Language :: Python :: 3.9",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
]
27+
keywords = ["dictionary", "metadata", "serialization", "knowledge"]
28+
29+
[project.urls]
30+
"Homepage" = "https://github.com/pyscal/knowledge_dictionary"
31+
"Bug Tracker" = "https://github.com/pyscal/knowledge_dictionary/issues"
32+
33+
[tool.setuptools]
34+
packages = ["knowledge_dictionary"]

0 commit comments

Comments
 (0)