openconvert 1.0.0__tar.gz → 1.1.1__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.
Files changed (64) hide show
  1. {openconvert-1.0.0 → openconvert-1.1.1}/MANIFEST.in +3 -0
  2. {openconvert-1.0.0 → openconvert-1.1.1}/PKG-INFO +2 -2
  3. {openconvert-1.0.0 → openconvert-1.1.1}/pyproject.toml +7 -2
  4. {openconvert-1.0.0 → openconvert-1.1.1}/setup.py +3 -2
  5. openconvert-1.1.1/src/openconvert/__init__.py +100 -0
  6. {openconvert-1.0.0 → openconvert-1.1.1/src}/openconvert/__main__.py +1 -1
  7. {openconvert-1.0.0 → openconvert-1.1.1/src}/openconvert/openconvert_cli.py +52 -16
  8. openconvert-1.1.1/src/openconvert.egg-info/PKG-INFO +504 -0
  9. {openconvert-1.0.0 → openconvert-1.1.1/src}/openconvert.egg-info/SOURCES.txt +11 -9
  10. openconvert-1.1.1/src/openconvert.egg-info/dependency_links.txt +1 -0
  11. openconvert-1.1.1/src/openconvert.egg-info/entry_points.txt +2 -0
  12. openconvert-1.1.1/src/openconvert.egg-info/not-zip-safe +1 -0
  13. openconvert-1.1.1/src/openconvert.egg-info/requires.txt +17 -0
  14. openconvert-1.1.1/src/openconvert.egg-info/top_level.txt +1 -0
  15. openconvert-1.0.0/openconvert/__init__.py +0 -112
  16. openconvert-1.0.0/service/README.md +0 -162
  17. openconvert-1.0.0/service/network_config.yaml +0 -97
  18. openconvert-1.0.0/service/run_agent.py +0 -509
  19. openconvert-1.0.0/service/test_end_to_end.py +0 -416
  20. openconvert-1.0.0/service/test_txt_to_md.py +0 -117
  21. {openconvert-1.0.0 → openconvert-1.1.1}/.readthedocs.yaml +0 -0
  22. {openconvert-1.0.0 → openconvert-1.1.1}/LICENSE +0 -0
  23. {openconvert-1.0.0 → openconvert-1.1.1}/PYPI_UPLOAD.md +0 -0
  24. {openconvert-1.0.0 → openconvert-1.1.1}/README.md +0 -0
  25. {openconvert-1.0.0 → openconvert-1.1.1}/demo.py +0 -0
  26. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/api/cli.rst.txt +0 -0
  27. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/api/client.rst.txt +0 -0
  28. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/api/openconvert.rst.txt +0 -0
  29. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/deployment/network-setup.rst.txt +0 -0
  30. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/development/contributing.rst.txt +0 -0
  31. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/examples/batch-processing.rst.txt +0 -0
  32. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/examples/python-integration.rst.txt +0 -0
  33. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/getting-started/basic-usage.rst.txt +0 -0
  34. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/getting-started/installation.rst.txt +0 -0
  35. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/getting-started/quickstart.rst.txt +0 -0
  36. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/index.rst.txt +0 -0
  37. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/user-guide/advanced-usage.rst.txt +0 -0
  38. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/user-guide/cli-reference.rst.txt +0 -0
  39. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/user-guide/python-api.rst.txt +0 -0
  40. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/user-guide/supported-formats.rst.txt +0 -0
  41. {openconvert-1.0.0 → openconvert-1.1.1}/docs/_build/html/_sources/user-guide/troubleshooting.rst.txt +0 -0
  42. {openconvert-1.0.0 → openconvert-1.1.1}/docs/api/cli.rst +0 -0
  43. {openconvert-1.0.0 → openconvert-1.1.1}/docs/api/client.rst +0 -0
  44. {openconvert-1.0.0 → openconvert-1.1.1}/docs/api/openconvert.rst +0 -0
  45. {openconvert-1.0.0 → openconvert-1.1.1}/docs/conf.py +0 -0
  46. {openconvert-1.0.0 → openconvert-1.1.1}/docs/deployment/network-setup.rst +0 -0
  47. {openconvert-1.0.0 → openconvert-1.1.1}/docs/development/contributing.rst +0 -0
  48. {openconvert-1.0.0 → openconvert-1.1.1}/docs/examples/batch-processing.rst +0 -0
  49. {openconvert-1.0.0 → openconvert-1.1.1}/docs/examples/python-integration.rst +0 -0
  50. {openconvert-1.0.0 → openconvert-1.1.1}/docs/getting-started/basic-usage.rst +0 -0
  51. {openconvert-1.0.0 → openconvert-1.1.1}/docs/getting-started/installation.rst +0 -0
  52. {openconvert-1.0.0 → openconvert-1.1.1}/docs/getting-started/quickstart.rst +0 -0
  53. {openconvert-1.0.0 → openconvert-1.1.1}/docs/index.rst +0 -0
  54. {openconvert-1.0.0 → openconvert-1.1.1}/docs/requirements.txt +0 -0
  55. {openconvert-1.0.0 → openconvert-1.1.1}/docs/user-guide/advanced-usage.rst +0 -0
  56. {openconvert-1.0.0 → openconvert-1.1.1}/docs/user-guide/cli-reference.rst +0 -0
  57. {openconvert-1.0.0 → openconvert-1.1.1}/docs/user-guide/python-api.rst +0 -0
  58. {openconvert-1.0.0 → openconvert-1.1.1}/docs/user-guide/supported-formats.rst +0 -0
  59. {openconvert-1.0.0 → openconvert-1.1.1}/docs/user-guide/troubleshooting.rst +0 -0
  60. {openconvert-1.0.0 → openconvert-1.1.1}/scripts/README.md +0 -0
  61. {openconvert-1.0.0 → openconvert-1.1.1}/scripts/launch_agents.py +0 -0
  62. {openconvert-1.0.0 → openconvert-1.1.1}/scripts/launch_agents.sh +0 -0
  63. {openconvert-1.0.0 → openconvert-1.1.1}/setup.cfg +0 -0
  64. {openconvert-1.0.0 → openconvert-1.1.1/src}/openconvert/client.py +0 -0
@@ -10,6 +10,9 @@ include .readthedocs.yaml
10
10
  # Include scripts
11
11
  recursive-include scripts *.py *.sh *.md
12
12
 
13
+ # Include source code (src layout)
14
+ recursive-include src *.py
15
+
13
16
  # Exclude unnecessary files
14
17
  global-exclude *.pyc
15
18
  global-exclude __pycache__
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openconvert
3
- Version: 1.0.0
3
+ Version: 1.1.1
4
4
  Summary: CLI tool for connecting to OpenConvert OpenAgents network for file conversion
5
5
  Home-page: https://github.com/acenta-ai/openconvert
6
6
  Author: OpenAgents Team
@@ -35,7 +35,7 @@ Requires-Python: >=3.8
35
35
  Description-Content-Type: text/markdown
36
36
  License-File: LICENSE
37
37
  Requires-Dist: pyyaml>=5.4.0
38
- Requires-Dist: openagents>=0.5.0
38
+ Requires-Dist: openagents>=0.5.1
39
39
  Provides-Extra: dev
40
40
  Requires-Dist: pytest>=6.0.0; extra == "dev"
41
41
  Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
@@ -44,7 +44,7 @@ classifiers = [
44
44
  requires-python = ">=3.8"
45
45
  dependencies = [
46
46
  "pyyaml>=5.4.0",
47
- "openagents>=0.5.0",
47
+ "openagents>=0.5.1",
48
48
  ]
49
49
  dynamic = ["version"]
50
50
 
@@ -78,6 +78,7 @@ openconvert = "openconvert.openconvert_cli:main"
78
78
  include-package-data = true
79
79
 
80
80
  [tool.setuptools.packages.find]
81
+ where = ["src"]
81
82
  include = ["openconvert*"]
82
83
 
83
84
  [tool.setuptools.dynamic]
@@ -115,6 +116,8 @@ warn_unused_ignores = true
115
116
  warn_no_return = true
116
117
  warn_unreachable = true
117
118
  strict_equality = true
119
+ # mypy needs to know the package path for src layout
120
+ mypy_path = "src"
118
121
 
119
122
  [tool.pytest.ini_options]
120
123
  minversion = "6.0"
@@ -122,4 +125,6 @@ addopts = "-ra -q"
122
125
  testpaths = [
123
126
  "tests",
124
127
  ]
125
- asyncio_mode = "auto"
128
+ asyncio_mode = "auto"
129
+ # pytest needs to know where to find the package
130
+ pythonpath = ["src"]
@@ -15,7 +15,7 @@ def read_readme():
15
15
 
16
16
  # Get version from __init__.py
17
17
  def get_version():
18
- init_path = os.path.join(os.path.dirname(__file__), "openconvert", "__init__.py")
18
+ init_path = os.path.join(os.path.dirname(__file__), "src", "openconvert", "__init__.py")
19
19
  with open(init_path, "r", encoding="utf-8") as f:
20
20
  content = f.read()
21
21
  version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
@@ -39,7 +39,8 @@ setup(
39
39
  "Source": "https://github.com/acenta-ai/openconvert",
40
40
  "Documentation": "https://openconvert.readthedocs.io/",
41
41
  },
42
- packages=find_packages(),
42
+ package_dir={"": "src"},
43
+ packages=find_packages(where="src"),
43
44
  include_package_data=True,
44
45
  install_requires=[
45
46
  "pyyaml>=5.4.0",
@@ -0,0 +1,100 @@
1
+ """
2
+ OpenConvert CLI Tool
3
+
4
+ A command-line interface for connecting to the OpenConvert OpenAgents network
5
+ to discover file conversion services and perform file conversions.
6
+ """
7
+
8
+ import asyncio
9
+ from pathlib import Path
10
+ from typing import Optional, List
11
+
12
+ __version__ = "1.1.1"
13
+ __author__ = "OpenAgents Team"
14
+ __email__ = "team@openagents.com"
15
+
16
+ # Import the async convert function
17
+ try:
18
+ from openconvert.openconvert_cli import convert as _async_convert
19
+ except ImportError:
20
+ from openconvert_cli import convert as _async_convert
21
+
22
+
23
+ def convert(
24
+ input_files: List[Path],
25
+ output_path: Path,
26
+ host: str = "network.openconvert.ai",
27
+ port: int = 8765,
28
+ ) -> bool:
29
+ """
30
+ Convert files using the OpenConvert network.
31
+
32
+ Args:
33
+ input_files: List of input file paths to convert
34
+ output_path: Output file path
35
+ host: OpenConvert network host (default: network.openconvert.ai)
36
+ port: OpenConvert network port (default: 8765)
37
+
38
+ Returns:
39
+ bool: True if conversion successful, False otherwise
40
+ """
41
+ try:
42
+ result = asyncio.run(_async_convert(
43
+ input_files=input_files,
44
+ output_path=output_path,
45
+ host=host,
46
+ port=port
47
+ ))
48
+ return result
49
+ except Exception as e:
50
+ print(f"Conversion failed: {e}")
51
+ return False
52
+
53
+
54
+ def convert_file(
55
+ input_path: str,
56
+ output_path: str,
57
+ host: str = "network.openconvert.ai",
58
+ port: int = 8765
59
+ ) -> bool:
60
+ """
61
+ Convert a single file using the OpenConvert network.
62
+
63
+ Args:
64
+ input_path: Path to input file
65
+ output_path: Path for output file
66
+ host: OpenConvert network host (default: network.openconvert.ai)
67
+ port: OpenConvert network port (default: 8765)
68
+
69
+ Returns:
70
+ bool: True if conversion successful, False otherwise
71
+
72
+ Example:
73
+ >>> from openconvert import convert_file
74
+ >>> success = convert_file("document.txt", "document.pdf")
75
+ >>> if success:
76
+ ... print("Conversion completed!")
77
+ """
78
+ try:
79
+ input_files = [Path(input_path)]
80
+ output_file = Path(output_path)
81
+
82
+ return convert(
83
+ input_files=input_files,
84
+ output_path=output_file,
85
+ host=host,
86
+ port=port
87
+ )
88
+ except Exception as e:
89
+ print(f"File conversion failed: {e}")
90
+ return False
91
+
92
+
93
+ # Export main functions
94
+ __all__ = [
95
+ "convert",
96
+ "convert_file",
97
+ "__version__",
98
+ "__author__",
99
+ "__email__",
100
+ ]
@@ -7,7 +7,7 @@ Allows running the OpenConvert CLI as a module:
7
7
  """
8
8
 
9
9
  import sys
10
- from .openconvert_cli import main
10
+ from openconvert.openconvert_cli import main
11
11
 
12
12
  if __name__ == "__main__":
13
13
  sys.exit(main())
@@ -25,10 +25,7 @@ current_dir = Path(__file__).resolve().parent
25
25
  openagents_root = current_dir.parent.parent
26
26
  sys.path.insert(0, str(openagents_root / "src"))
27
27
 
28
- try:
29
- from .client import OpenConvertClient
30
- except ImportError:
31
- from client import OpenConvertClient
28
+ from openconvert.client import OpenConvertClient
32
29
 
33
30
  # Set up logging
34
31
  logging.basicConfig(
@@ -89,7 +86,9 @@ def validate_args(args: argparse.Namespace) -> bool:
89
86
  """
90
87
  # For conversion operations, input and output are required
91
88
  if not args.input or not args.output:
92
- logger.error("Input (-i) and output (-o) arguments are required for conversion")
89
+ logger.error("Input and output are required for conversion")
90
+ logger.error("Usage: openconvert <input> <output>")
91
+ logger.error(" or: openconvert -i <input> -o <output>")
93
92
  return False
94
93
 
95
94
  # Check input exists
@@ -105,10 +104,17 @@ def validate_args(args: argparse.Namespace) -> bool:
105
104
  logger.error(f"Output directory does not exist: {output_dir}")
106
105
  return False
107
106
 
108
- # If input is a directory, require --from and --to
107
+ # If input is a directory, require --from and --to (positional args don't support directory conversion)
109
108
  if input_path.is_dir():
110
109
  if not args.from_format or not args.to_format:
111
110
  logger.error("When input is a directory, --from and --to formats must be specified")
111
+ logger.error("Example: openconvert -i docs/ -o converted/ --from text/plain --to application/pdf")
112
+ return False
113
+
114
+ # For directory conversion, must use flag arguments
115
+ if hasattr(args, 'input_file') and (args.input_file or args.output_file):
116
+ logger.error("Directory conversion requires -i and -o flags, not positional arguments")
117
+ logger.error("Example: openconvert -i docs/ -o converted/ --from text/plain --to application/pdf")
112
118
  return False
113
119
 
114
120
  return True
@@ -391,24 +397,36 @@ def main() -> int:
391
397
  """Main CLI entry point.
392
398
 
393
399
  Returns:
394
- int: Exit code (0 = success, 1 = error)
400
+ int: Exit code (0 for success, 1 for error)
395
401
  """
396
402
  parser = argparse.ArgumentParser(
397
- description="OpenConvert CLI - Connect to OpenAgents network for file conversion",
403
+ prog="openconvert",
404
+ description="Connect to OpenConvert OpenAgents network for file conversions",
398
405
  formatter_class=argparse.RawDescriptionHelpFormatter,
399
- epilog="""
406
+ epilog=f"""
400
407
  Examples:
401
- # Convert single file (formats auto-detected)
402
- openconvert -i document.txt -o document.pdf
408
+ # Simple file conversion (positional arguments)
409
+ openconvert input.txt output.pdf
410
+ openconvert image.png image.jpg
411
+
412
+ # Using flags (traditional way)
413
+ openconvert -i input.txt -o output.pdf
414
+ openconvert -i image.png -o image.jpg
403
415
 
404
- # Convert directory with specific formats
405
- openconvert -i images/ -o converted/ --from image/png --to application/pdf
416
+ # Directory conversion (requires format specification)
417
+ openconvert -i docs/ -o converted/ --from text/plain --to application/pdf
418
+
419
+ # Convert with format specification
420
+ openconvert input.data output.pdf --from text/csv --to application/pdf
406
421
 
407
422
  # Convert with custom prompt
408
- openconvert -i data.csv -o report.pdf --prompt "Create a formatted report with charts"
423
+ openconvert data.csv report.pdf --prompt "Create a formatted report with charts"
409
424
 
410
425
  # Specify network connection
411
- openconvert -i file.doc -o file.md --host remote.server.com --port 8765
426
+ openconvert file.doc file.md --host remote.server.com --port 8765
427
+
428
+ # List available formats
429
+ openconvert --list-formats
412
430
 
413
431
  Supported formats include:
414
432
  Documents: txt, pdf, docx, html, md, rtf, csv, xlsx
@@ -421,7 +439,19 @@ Supported formats include:
421
439
  """
422
440
  )
423
441
 
424
- # Arguments (required for conversion, optional for discovery)
442
+ # Positional arguments (optional)
443
+ parser.add_argument(
444
+ "input_file",
445
+ nargs="?",
446
+ help="Input file path (alternative to -i/--input)"
447
+ )
448
+ parser.add_argument(
449
+ "output_file",
450
+ nargs="?",
451
+ help="Output file path (alternative to -o/--output)"
452
+ )
453
+
454
+ # Traditional flag arguments (for backward compatibility and directory operations)
425
455
  parser.add_argument(
426
456
  "-i", "--input",
427
457
  help="Input file or directory path"
@@ -482,6 +512,12 @@ Supported formats include:
482
512
  # Parse arguments
483
513
  args = parser.parse_args()
484
514
 
515
+ # Merge positional and flag arguments (positional takes precedence)
516
+ if args.input_file:
517
+ args.input = args.input_file
518
+ if args.output_file:
519
+ args.output = args.output_file
520
+
485
521
  # Configure logging level
486
522
  if args.quiet:
487
523
  logging.getLogger().setLevel(logging.ERROR)