Migrate from setup.py to pyproject.toml (#440)

* Converted setup.py to pyproject.toml

* Modern package infrastructure as recommended by py docs
This commit is contained in:
cybermaggedon 2025-07-23 21:22:08 +01:00 committed by GitHub
parent d83e4e3d59
commit 98022d6af4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
145 changed files with 561 additions and 1159 deletions

View file

@ -0,0 +1,85 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "trustgraph-cli"
dynamic = ["version"]
authors = [{name = "trustgraph.ai", email = "security@trustgraph.ai"}]
description = "TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline."
readme = "README.md"
requires-python = ">=3.8"
dependencies = [
"trustgraph-base>=1.2,<1.3",
"requests",
"pulsar-client",
"aiohttp",
"rdflib",
"tabulate",
"msgpack",
"websockets",
]
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
[project.urls]
Homepage = "https://github.com/trustgraph-ai/trustgraph"
[project.scripts]
tg-add-library-document = "trustgraph.cli.add_library_document:main"
tg-delete-flow-class = "trustgraph.cli.delete_flow_class:main"
tg-delete-mcp-tool = "trustgraph.cli.delete_mcp_tool:main"
tg-delete-kg-core = "trustgraph.cli.delete_kg_core:main"
tg-delete-tool = "trustgraph.cli.delete_tool:main"
tg-dump-msgpack = "trustgraph.cli.dump_msgpack:main"
tg-get-flow-class = "trustgraph.cli.get_flow_class:main"
tg-get-kg-core = "trustgraph.cli.get_kg_core:main"
tg-graph-to-turtle = "trustgraph.cli.graph_to_turtle:main"
tg-init-trustgraph = "trustgraph.cli.init_trustgraph:main"
tg-invoke-agent = "trustgraph.cli.invoke_agent:main"
tg-invoke-document-rag = "trustgraph.cli.invoke_document_rag:main"
tg-invoke-graph-rag = "trustgraph.cli.invoke_graph_rag:main"
tg-invoke-llm = "trustgraph.cli.invoke_llm:main"
tg-invoke-mcp-tool = "trustgraph.cli.invoke_mcp_tool:main"
tg-invoke-prompt = "trustgraph.cli.invoke_prompt:main"
tg-load-doc-embeds = "trustgraph.cli.load_doc_embeds:main"
tg-load-kg-core = "trustgraph.cli.load_kg_core:main"
tg-load-pdf = "trustgraph.cli.load_pdf:main"
tg-load-sample-documents = "trustgraph.cli.load_sample_documents:main"
tg-load-text = "trustgraph.cli.load_text:main"
tg-load-turtle = "trustgraph.cli.load_turtle:main"
tg-put-flow-class = "trustgraph.cli.put_flow_class:main"
tg-put-kg-core = "trustgraph.cli.put_kg_core:main"
tg-remove-library-document = "trustgraph.cli.remove_library_document:main"
tg-save-doc-embeds = "trustgraph.cli.save_doc_embeds:main"
tg-set-mcp-tool = "trustgraph.cli.set_mcp_tool:main"
tg-set-prompt = "trustgraph.cli.set_prompt:main"
tg-set-token-costs = "trustgraph.cli.set_token_costs:main"
tg-set-tool = "trustgraph.cli.set_tool:main"
tg-show-config = "trustgraph.cli.show_config:main"
tg-show-flow-classes = "trustgraph.cli.show_flow_classes:main"
tg-show-flow-state = "trustgraph.cli.show_flow_state:main"
tg-show-flows = "trustgraph.cli.show_flows:main"
tg-show-graph = "trustgraph.cli.show_graph:main"
tg-show-kg-cores = "trustgraph.cli.show_kg_cores:main"
tg-show-library-documents = "trustgraph.cli.show_library_documents:main"
tg-show-library-processing = "trustgraph.cli.show_library_processing:main"
tg-show-mcp-tools = "trustgraph.cli.show_mcp_tools:main"
tg-show-processor-state = "trustgraph.cli.show_processor_state:main"
tg-show-prompts = "trustgraph.cli.show_prompts:main"
tg-show-token-costs = "trustgraph.cli.show_token_costs:main"
tg-show-token-rate = "trustgraph.cli.show_token_rate:main"
tg-show-tools = "trustgraph.cli.show_tools:main"
tg-start-flow = "trustgraph.cli.start_flow:main"
tg-unload-kg-core = "trustgraph.cli.unload_kg_core:main"
tg-start-library-processing = "trustgraph.cli.start_library_processing:main"
tg-stop-flow = "trustgraph.cli.stop_flow:main"
tg-stop-library-processing = "trustgraph.cli.stop_library_processing:main"
[tool.setuptools.packages.find]
include = ["trustgraph*"]
[tool.setuptools.dynamic]
version = {attr = "trustgraph.cli_version.__version__"}

View file

@ -1,97 +0,0 @@
import setuptools
import os
import importlib
with open("README.md", "r") as fh:
long_description = fh.read()
# Load a version number module
spec = importlib.util.spec_from_file_location(
'version', 'trustgraph/cli_version.py'
)
version_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(version_module)
version = version_module.__version__
setuptools.setup(
name="trustgraph-cli",
version=version,
author="trustgraph.ai",
author_email="security@trustgraph.ai",
description="TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/trustgraph-ai/trustgraph",
packages=setuptools.find_namespace_packages(
where='./',
),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
],
python_requires='>=3.8',
download_url = "https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v" + version + ".tar.gz",
install_requires=[
"trustgraph-base>=1.2,<1.3",
"requests",
"pulsar-client",
"aiohttp",
"rdflib",
"tabulate",
"msgpack",
"websockets",
],
scripts=[
"scripts/tg-add-library-document",
"scripts/tg-delete-flow-class",
"scripts/tg-delete-mcp-tool",
"scripts/tg-delete-kg-core",
"scripts/tg-delete-tool",
"scripts/tg-dump-msgpack",
"scripts/tg-get-flow-class",
"scripts/tg-get-kg-core",
"scripts/tg-graph-to-turtle",
"scripts/tg-init-trustgraph",
"scripts/tg-invoke-agent",
"scripts/tg-invoke-document-rag",
"scripts/tg-invoke-graph-rag",
"scripts/tg-invoke-llm",
"scripts/tg-invoke-mcp-tool",
"scripts/tg-invoke-prompt",
"scripts/tg-load-doc-embeds",
"scripts/tg-load-kg-core",
"scripts/tg-load-pdf",
"scripts/tg-load-sample-documents",
"scripts/tg-load-text",
"scripts/tg-load-turtle",
"scripts/tg-put-flow-class",
"scripts/tg-put-kg-core",
"scripts/tg-remove-library-document",
"scripts/tg-save-doc-embeds",
"scripts/tg-set-mcp-tool",
"scripts/tg-set-prompt",
"scripts/tg-set-token-costs",
"scripts/tg-set-tool",
"scripts/tg-show-config",
"scripts/tg-show-flow-classes",
"scripts/tg-show-flow-state",
"scripts/tg-show-flows",
"scripts/tg-show-graph",
"scripts/tg-show-kg-cores",
"scripts/tg-show-library-documents",
"scripts/tg-show-library-processing",
"scripts/tg-show-mcp-tools",
"scripts/tg-show-processor-state",
"scripts/tg-show-prompts",
"scripts/tg-show-token-costs",
"scripts/tg-show-token-rate",
"scripts/tg-show-tools",
"scripts/tg-start-flow",
"scripts/tg-unload-kg-core",
"scripts/tg-start-library-processing",
"scripts/tg-stop-flow",
"scripts/tg-stop-library-processing",
]
)

View file

@ -0,0 +1 @@
# TrustGraph CLI modules

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Loads a document into the library
"""
@ -202,5 +200,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Deletes a flow class
"""
@ -49,5 +47,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Deletes a flow class
"""
@ -57,5 +55,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Deletes MCP (Model Control Protocol) tools from the TrustGraph system.
Removes MCP tool configurations by ID from the 'mcp' configuration group.
@ -91,4 +89,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Deletes tools from the TrustGraph system.
Removes tool configurations by ID from the agent configuration
@ -96,5 +94,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
This utility reads a knowledge core in msgpack format and outputs its
contents in JSON form to standard output. This is useful only as a
@ -89,5 +87,5 @@ def main():
else:
dump(**vars(args))
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Outputs a flow class definition in JSON format.
"""
@ -52,5 +50,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Uses the knowledge service to fetch a knowledge core which is saved
to a local file in msgpack format.
@ -157,5 +155,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Connects to the graph query service and dumps all graph edges in Turtle
format.
@ -102,5 +100,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Initialises Pulsar with Trustgraph tenant / namespaces & policy.
"""
@ -237,5 +235,5 @@ def main():
time.sleep(2)
print("Will retry...", flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Uses the agent service to answer a question
"""
@ -169,5 +167,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Uses the DocumentRAG service to answer a question
"""
@ -84,5 +82,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Uses the GraphRAG service to answer a question
"""
@ -113,5 +111,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Invokes the text completion service by specifying an LLM system prompt
and user prompt. Both arguments are required.
@ -66,5 +64,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Invokes MCP (Model Control Protocol) tools through the TrustGraph API.
Allows calling MCP tools by specifying the tool name and providing
@ -76,5 +74,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Invokes the LLM prompt service by specifying the prompt template to use
and values for the variables in the prompt template. The
@ -86,5 +84,5 @@ specified multiple times''',
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
This utility takes a document embeddings core and loads it into a running
TrustGraph through the API. The document embeddings core should be in msgpack

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Starts a load operation on a knowledge core which is already stored by
the knowledge manager. You could load a core with tg-put-kg-core and then
@ -76,5 +74,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Loads a PDF document into TrustGraph processing by directing to
the pdf-decoder queue.
@ -198,5 +196,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Loads a PDF document into the library
"""
@ -737,5 +735,5 @@ def main():
print("Exception:", e, flush=True)
raise e
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Loads a text document into TrustGraph processing by directing to a text
loader queue.
@ -203,6 +201,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Loads triples into the knowledge graph.
"""
@ -157,5 +155,5 @@ def main():
time.sleep(10)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Uploads a flow class definition. You can take the output of
tg-get-flow-class and load it back in using this utility.
@ -55,5 +53,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Uses the agent service to answer a question
"""
@ -179,5 +177,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Remove a document from the library
"""
@ -55,5 +53,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
This utility connects to a running TrustGraph through the API and creates
a document embeddings core from the data streaming through the processing

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Configures and registers MCP (Model Context Protocol) tools in the
TrustGraph system.
@ -107,5 +105,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Sets a prompt template.
"""
@ -139,5 +137,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Sets a model's token costs.
"""
@ -107,5 +105,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Configures and registers tools in the TrustGraph system.
@ -222,5 +220,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Dumps out the current configuration
"""
@ -45,5 +43,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Shows all defined flow classes.
"""
@ -65,5 +63,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Dump out a flow's processor states
"""
@ -89,5 +87,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Shows configured flows.
"""
@ -110,5 +108,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Connects to the graph query service and dumps all graph edges.
"""
@ -70,5 +68,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Shows knowledge cores
"""
@ -55,5 +53,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Shows all loaded library documents
"""
@ -72,5 +70,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
"""
@ -71,5 +69,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Displays the current MCP (Model Context Protocol) tool configuration
"""
@ -65,5 +63,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Dump out TrustGraph processor states.
"""
@ -51,5 +49,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Dumps out the current prompts
"""
@ -92,5 +90,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Dumps out token cost configuration
"""
@ -75,5 +73,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Dump out a stream of token rates, input, output and total. This is averaged
across the time since tg-show-token-rate is started.
@ -105,5 +103,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Displays the current agent tool configurations
@ -89,5 +87,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Starts a processing flow using a defined flow class
"""
@ -68,5 +66,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Submits a library document for processing
"""
@ -99,5 +97,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Stops a processing flow.
"""
@ -50,5 +48,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Removes a library document processing record. This is just a record of
procesing, it doesn't stop in-flight processing at the moment.
@ -61,5 +59,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()

View file

@ -1,5 +1,3 @@
#!/usr/bin/env python3
"""
Starts a load operation on a knowledge core which is already stored by
the knowledge manager. You could load a core with tg-put-kg-core and then
@ -68,5 +66,5 @@ def main():
print("Exception:", e, flush=True)
main()
if __name__ == "__main__":
main()