py-okf 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
py_okf-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Prabhay Gupta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
py_okf-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-okf
3
+ Version: 0.1.0
4
+ Summary: Python library for Open Knowledge Format (OKF) file generation and refresh
5
+ Author-email: Prabhay Gupta <coolprabhay90@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/prabhay759/py-okf
8
+ Project-URL: Repository, https://github.com/prabhay759/py-okf
9
+ Project-URL: Issues, https://github.com/prabhay759/py-okf/issues
10
+ Keywords: okf,documentation,ast,code-analysis,open-knowledge-format
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Documentation
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: PyYAML>=6.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
28
+ Requires-Dist: build>=1.0; extra == "dev"
29
+ Requires-Dist: twine>=5.0; extra == "dev"
30
+ Provides-Extra: watch
31
+ Requires-Dist: watchdog>=3.0; extra == "watch"
32
+ Dynamic: license-file
33
+
34
+ # py-okf
35
+
36
+ A Python library for generating and managing [Open Knowledge Format (OKF)](https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharing) files from Python projects.
37
+
38
+ OKF is a vendor-neutral markdown specification that lets AI agents and humans access curated knowledge without vendor lock-in — a directory of `.md` files with YAML frontmatter, one file per concept (module, class, API, dataset, etc.).
39
+
40
+ `py-okf` analyzes your Python codebase using the `ast` module and generates an `.okf/` bundle of markdown files describing your project's concepts.
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install py-okf
46
+ ```
47
+
48
+ ## CLI Usage
49
+
50
+ ```bash
51
+ # Generate OKF files for a Python project
52
+ okf generate /path/to/your/project
53
+
54
+ # Refresh stale OKF files (only regenerates files where source changed)
55
+ okf refresh /path/to/your/project
56
+
57
+ # Validate OKF files against the spec
58
+ okf validate /path/to/your/project
59
+
60
+ # Custom output directory
61
+ okf generate /path/to/your/project -o docs/okf
62
+
63
+ # Include private (underscore-prefixed) symbols
64
+ okf generate /path/to/your/project --include-private
65
+ ```
66
+
67
+ ## Python API
68
+
69
+ ```python
70
+ from pyokf import analyze_project, generate_module_concepts, OKFBundle
71
+ from pathlib import Path
72
+
73
+ # Analyze a project
74
+ modules = analyze_project(Path("./myproject"))
75
+
76
+ # Generate OKF concepts
77
+ bundle = OKFBundle(Path("./.okf"))
78
+ bundle.ensure_directory()
79
+ for module in modules:
80
+ concepts = generate_module_concepts(module)
81
+ bundle.write_all(concepts)
82
+
83
+ # Load and validate an existing bundle
84
+ bundle = OKFBundle(Path("./.okf")).load()
85
+ errors = bundle.validate_directory()
86
+ ```
87
+
88
+ ## Generated Output
89
+
90
+ Running `okf generate .` produces an `.okf/` directory with flat, dotted-name files:
91
+
92
+ ```
93
+ .okf/
94
+ ├── mypackage.md # module concept
95
+ ├── mypackage.Connection.md # class concept
96
+ └── mypackage.query.md # api concept (exported function)
97
+ ```
98
+
99
+ Each file contains YAML frontmatter followed by a markdown description:
100
+
101
+ ```markdown
102
+ ---
103
+ type: api
104
+ title: mypackage.query
105
+ description: Execute a SQL query against the active connection.
106
+ resource: ./mypackage/__init__.py
107
+ tags:
108
+ - python
109
+ - api
110
+ timestamp: '2026-06-22T10:00:00Z'
111
+ ---
112
+
113
+ # query
114
+
115
+ Execute a SQL query against the active connection.
116
+
117
+ ## Signature
118
+
119
+ def query(sql: str, params: Optional[list[str]] = None) -> list[dict]
120
+
121
+ ## Parameters
122
+
123
+ - **`sql`**: `str`
124
+ - **`params`**: `Optional[list[str]]` *(default: `None`)*
125
+
126
+ ## Returns
127
+
128
+ `list[dict]`
129
+ ```
130
+
131
+ ## Concept Types
132
+
133
+ | Type | Description |
134
+ |------|-------------|
135
+ | `module` | A Python module file |
136
+ | `class` | A class definition |
137
+ | `function` | A top-level function |
138
+ | `api` | A function listed in `__all__` (publicly exported) |
139
+
140
+ ## Requirements
141
+
142
+ - Python 3.10+
143
+ - PyYAML >= 6.0
py_okf-0.1.0/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # py-okf
2
+
3
+ A Python library for generating and managing [Open Knowledge Format (OKF)](https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharing) files from Python projects.
4
+
5
+ OKF is a vendor-neutral markdown specification that lets AI agents and humans access curated knowledge without vendor lock-in — a directory of `.md` files with YAML frontmatter, one file per concept (module, class, API, dataset, etc.).
6
+
7
+ `py-okf` analyzes your Python codebase using the `ast` module and generates an `.okf/` bundle of markdown files describing your project's concepts.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install py-okf
13
+ ```
14
+
15
+ ## CLI Usage
16
+
17
+ ```bash
18
+ # Generate OKF files for a Python project
19
+ okf generate /path/to/your/project
20
+
21
+ # Refresh stale OKF files (only regenerates files where source changed)
22
+ okf refresh /path/to/your/project
23
+
24
+ # Validate OKF files against the spec
25
+ okf validate /path/to/your/project
26
+
27
+ # Custom output directory
28
+ okf generate /path/to/your/project -o docs/okf
29
+
30
+ # Include private (underscore-prefixed) symbols
31
+ okf generate /path/to/your/project --include-private
32
+ ```
33
+
34
+ ## Python API
35
+
36
+ ```python
37
+ from pyokf import analyze_project, generate_module_concepts, OKFBundle
38
+ from pathlib import Path
39
+
40
+ # Analyze a project
41
+ modules = analyze_project(Path("./myproject"))
42
+
43
+ # Generate OKF concepts
44
+ bundle = OKFBundle(Path("./.okf"))
45
+ bundle.ensure_directory()
46
+ for module in modules:
47
+ concepts = generate_module_concepts(module)
48
+ bundle.write_all(concepts)
49
+
50
+ # Load and validate an existing bundle
51
+ bundle = OKFBundle(Path("./.okf")).load()
52
+ errors = bundle.validate_directory()
53
+ ```
54
+
55
+ ## Generated Output
56
+
57
+ Running `okf generate .` produces an `.okf/` directory with flat, dotted-name files:
58
+
59
+ ```
60
+ .okf/
61
+ ├── mypackage.md # module concept
62
+ ├── mypackage.Connection.md # class concept
63
+ └── mypackage.query.md # api concept (exported function)
64
+ ```
65
+
66
+ Each file contains YAML frontmatter followed by a markdown description:
67
+
68
+ ```markdown
69
+ ---
70
+ type: api
71
+ title: mypackage.query
72
+ description: Execute a SQL query against the active connection.
73
+ resource: ./mypackage/__init__.py
74
+ tags:
75
+ - python
76
+ - api
77
+ timestamp: '2026-06-22T10:00:00Z'
78
+ ---
79
+
80
+ # query
81
+
82
+ Execute a SQL query against the active connection.
83
+
84
+ ## Signature
85
+
86
+ def query(sql: str, params: Optional[list[str]] = None) -> list[dict]
87
+
88
+ ## Parameters
89
+
90
+ - **`sql`**: `str`
91
+ - **`params`**: `Optional[list[str]]` *(default: `None`)*
92
+
93
+ ## Returns
94
+
95
+ `list[dict]`
96
+ ```
97
+
98
+ ## Concept Types
99
+
100
+ | Type | Description |
101
+ |------|-------------|
102
+ | `module` | A Python module file |
103
+ | `class` | A class definition |
104
+ | `function` | A top-level function |
105
+ | `api` | A function listed in `__all__` (publicly exported) |
106
+
107
+ ## Requirements
108
+
109
+ - Python 3.10+
110
+ - PyYAML >= 6.0
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "py-okf"
7
+ version = "0.1.0"
8
+ description = "Python library for Open Knowledge Format (OKF) file generation and refresh"
9
+ readme = {file = "README.md", content-type = "text/markdown"}
10
+ requires-python = ">=3.10"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Prabhay Gupta", email = "coolprabhay90@gmail.com"},
14
+ ]
15
+ keywords = ["okf", "documentation", "ast", "code-analysis", "open-knowledge-format"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Software Development :: Documentation",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ ]
28
+ dependencies = [
29
+ "PyYAML>=6.0",
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/prabhay759/py-okf"
34
+ Repository = "https://github.com/prabhay759/py-okf"
35
+ Issues = "https://github.com/prabhay759/py-okf/issues"
36
+
37
+ [project.optional-dependencies]
38
+ dev = [
39
+ "pytest>=7.0",
40
+ "pytest-cov>=4.0",
41
+ "build>=1.0",
42
+ "twine>=5.0",
43
+ ]
44
+ watch = [
45
+ "watchdog>=3.0",
46
+ ]
47
+
48
+ [project.scripts]
49
+ okf = "pyokf.cli:main"
50
+
51
+ [tool.setuptools.packages.find]
52
+ where = ["src"]
53
+
54
+ [tool.pytest.ini_options]
55
+ testpaths = ["tests"]
56
+ addopts = "-v --tb=short"
57
+
58
+ [tool.coverage.run]
59
+ source = ["src/pyokf"]
60
+ branch = true
py_okf-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-okf
3
+ Version: 0.1.0
4
+ Summary: Python library for Open Knowledge Format (OKF) file generation and refresh
5
+ Author-email: Prabhay Gupta <coolprabhay90@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/prabhay759/py-okf
8
+ Project-URL: Repository, https://github.com/prabhay759/py-okf
9
+ Project-URL: Issues, https://github.com/prabhay759/py-okf/issues
10
+ Keywords: okf,documentation,ast,code-analysis,open-knowledge-format
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Documentation
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: PyYAML>=6.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
28
+ Requires-Dist: build>=1.0; extra == "dev"
29
+ Requires-Dist: twine>=5.0; extra == "dev"
30
+ Provides-Extra: watch
31
+ Requires-Dist: watchdog>=3.0; extra == "watch"
32
+ Dynamic: license-file
33
+
34
+ # py-okf
35
+
36
+ A Python library for generating and managing [Open Knowledge Format (OKF)](https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharing) files from Python projects.
37
+
38
+ OKF is a vendor-neutral markdown specification that lets AI agents and humans access curated knowledge without vendor lock-in — a directory of `.md` files with YAML frontmatter, one file per concept (module, class, API, dataset, etc.).
39
+
40
+ `py-okf` analyzes your Python codebase using the `ast` module and generates an `.okf/` bundle of markdown files describing your project's concepts.
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install py-okf
46
+ ```
47
+
48
+ ## CLI Usage
49
+
50
+ ```bash
51
+ # Generate OKF files for a Python project
52
+ okf generate /path/to/your/project
53
+
54
+ # Refresh stale OKF files (only regenerates files where source changed)
55
+ okf refresh /path/to/your/project
56
+
57
+ # Validate OKF files against the spec
58
+ okf validate /path/to/your/project
59
+
60
+ # Custom output directory
61
+ okf generate /path/to/your/project -o docs/okf
62
+
63
+ # Include private (underscore-prefixed) symbols
64
+ okf generate /path/to/your/project --include-private
65
+ ```
66
+
67
+ ## Python API
68
+
69
+ ```python
70
+ from pyokf import analyze_project, generate_module_concepts, OKFBundle
71
+ from pathlib import Path
72
+
73
+ # Analyze a project
74
+ modules = analyze_project(Path("./myproject"))
75
+
76
+ # Generate OKF concepts
77
+ bundle = OKFBundle(Path("./.okf"))
78
+ bundle.ensure_directory()
79
+ for module in modules:
80
+ concepts = generate_module_concepts(module)
81
+ bundle.write_all(concepts)
82
+
83
+ # Load and validate an existing bundle
84
+ bundle = OKFBundle(Path("./.okf")).load()
85
+ errors = bundle.validate_directory()
86
+ ```
87
+
88
+ ## Generated Output
89
+
90
+ Running `okf generate .` produces an `.okf/` directory with flat, dotted-name files:
91
+
92
+ ```
93
+ .okf/
94
+ ├── mypackage.md # module concept
95
+ ├── mypackage.Connection.md # class concept
96
+ └── mypackage.query.md # api concept (exported function)
97
+ ```
98
+
99
+ Each file contains YAML frontmatter followed by a markdown description:
100
+
101
+ ```markdown
102
+ ---
103
+ type: api
104
+ title: mypackage.query
105
+ description: Execute a SQL query against the active connection.
106
+ resource: ./mypackage/__init__.py
107
+ tags:
108
+ - python
109
+ - api
110
+ timestamp: '2026-06-22T10:00:00Z'
111
+ ---
112
+
113
+ # query
114
+
115
+ Execute a SQL query against the active connection.
116
+
117
+ ## Signature
118
+
119
+ def query(sql: str, params: Optional[list[str]] = None) -> list[dict]
120
+
121
+ ## Parameters
122
+
123
+ - **`sql`**: `str`
124
+ - **`params`**: `Optional[list[str]]` *(default: `None`)*
125
+
126
+ ## Returns
127
+
128
+ `list[dict]`
129
+ ```
130
+
131
+ ## Concept Types
132
+
133
+ | Type | Description |
134
+ |------|-------------|
135
+ | `module` | A Python module file |
136
+ | `class` | A class definition |
137
+ | `function` | A top-level function |
138
+ | `api` | A function listed in `__all__` (publicly exported) |
139
+
140
+ ## Requirements
141
+
142
+ - Python 3.10+
143
+ - PyYAML >= 6.0
@@ -0,0 +1,20 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/py_okf.egg-info/PKG-INFO
5
+ src/py_okf.egg-info/SOURCES.txt
6
+ src/py_okf.egg-info/dependency_links.txt
7
+ src/py_okf.egg-info/entry_points.txt
8
+ src/py_okf.egg-info/requires.txt
9
+ src/py_okf.egg-info/top_level.txt
10
+ src/pyokf/__init__.py
11
+ src/pyokf/analyzer.py
12
+ src/pyokf/bundle.py
13
+ src/pyokf/cli.py
14
+ src/pyokf/generator.py
15
+ src/pyokf/models.py
16
+ tests/test_analyzer.py
17
+ tests/test_bundle.py
18
+ tests/test_cli.py
19
+ tests/test_generator.py
20
+ tests/test_models.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ okf = pyokf.cli:main
@@ -0,0 +1,10 @@
1
+ PyYAML>=6.0
2
+
3
+ [dev]
4
+ pytest>=7.0
5
+ pytest-cov>=4.0
6
+ build>=1.0
7
+ twine>=5.0
8
+
9
+ [watch]
10
+ watchdog>=3.0
@@ -0,0 +1 @@
1
+ pyokf
@@ -0,0 +1,33 @@
1
+ """py-okf: Python library for Open Knowledge Format (OKF) file generation."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ from pyokf.models import (
6
+ ConceptType,
7
+ OKFConcept,
8
+ ArgumentInfo,
9
+ AttributeInfo,
10
+ MethodInfo,
11
+ ClassInfo,
12
+ FunctionInfo,
13
+ ModuleInfo,
14
+ )
15
+ from pyokf.analyzer import analyze_file, analyze_project
16
+ from pyokf.generator import generate_concept, generate_module_concepts
17
+ from pyokf.bundle import OKFBundle
18
+
19
+ __all__ = [
20
+ "ConceptType",
21
+ "OKFConcept",
22
+ "ArgumentInfo",
23
+ "AttributeInfo",
24
+ "MethodInfo",
25
+ "ClassInfo",
26
+ "FunctionInfo",
27
+ "ModuleInfo",
28
+ "analyze_file",
29
+ "analyze_project",
30
+ "generate_concept",
31
+ "generate_module_concepts",
32
+ "OKFBundle",
33
+ ]