Skip to main content

Proof of concept, not a product. This library belongs to the earlier Python research prototype (Socrates) and is not maintained as a product. The current products are listed at nireus79.github.io. Contact: Hermes_creative@proton.me.

Socratic Knowledge

PyPI License: MIT

A small package extracted from the Socrates prototype. It has no dependencies outside the Python standard library.

What is in the package

  • KnowledgeEntry: a dataclass (id, content, category, embedding, metadata) with to_dict() and from_dict().
  • CodeParser: reads the structure of a source file from its text. Python files are parsed with the ast module; JavaScript, Java, C and C++ files with regular expressions, so those results are approximate.
  • DEFAULT_KNOWLEDGE: a list of five general notes (software architecture, Python practice and similar) that the prototype used as starting entries.

There is no storage, no search, no access control, no versioning, no multi-tenancy and no audit log. Earlier versions of this README described a KnowledgeManager with those features; it does not exist in the code. For vector search over entries like these, see socratic-rag.

Install

pip install socratic-knowledge

Use

from socratic_knowledge import CodeParser, KnowledgeEntry

source = """
import os

class Greeter:
    def hello(self, name):
        return "hi " + name

def main():
    pass
"""

result = CodeParser().parse_file("greeter.py", source)
print(result["language"])            # python
print(result["structure_summary"])   # one-line summary
print([c["name"] for c in result["classes"]])      # ['Greeter']
print([f["name"] for f in result["functions"]])    # ['main']

entry = KnowledgeEntry(id="greeter", content=result["structure_summary"], category="code")
print(entry.to_dict())

parse_file returns a dictionary with language, file_path, functions, classes, imports, structure_summary and metrics (line, function, class and import counts). An unsupported file extension is reported in the result and is not parsed.

Tests

pip install -e ".[dev]"
python -m pytest tests/

License

MIT. Contact: Hermes_creative@proton.me

Metadata

Release files for socratic-knowledge 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for socratic-knowledge 0.1.10
File Size Uploaded Provenance Actions
socratic_knowledge-0.1.10.tar.gz 11.7 kB Without provenance Details for socratic_knowledge-0.1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for socratic-knowledge 0.1.10
File Interpreter ABI Platform Actions
socratic_knowledge-0.1.10-py3-none-any.whl Python 3 none any Details for socratic_knowledge-0.1.10-py3-none-any.whl

Total release size: 21.6 kB

Release files / socratic_knowledge-0.1.10.tar.gz

Download URL socratic_knowledge-0.1.10.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
982962e772ff175c35f9728d89c54a440bff323bdd737a07a939069639a20b37
BLAKE2b-256 checksum
How to use checksums
3e9153f3a7ee4631746b9da1a3d4984ecb613535eb8dbbdf91275c443c69cc23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / socratic_knowledge-0.1.10-py3-none-any.whl

Download URL socratic_knowledge-0.1.10-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
539467114ab114f0797576407bf6d66f3085e5e7f50ce9a50441c3f0f7d48ca6
BLAKE2b-256 checksum
How to use checksums
428459ab186936df3ee69918333d97da8ebd194b7c22e33a3b1c53ac3428e14e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for socratic-knowledge 0.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page