aisbf 0.2.0__tar.gz → 0.2.2__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.
@@ -3,6 +3,8 @@ include LICENSE.txt
3
3
  include requirements.txt
4
4
  include main.py
5
5
  include pyproject.toml
6
+ include aisbf.sh
7
+ include cli.py
6
8
  recursive-include config *.json
7
9
  recursive-include config *.md
8
10
  recursive-include aisbf *.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aisbf
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: AISBF - AI Service Broker Framework || AI Should Be Free - A modular proxy server for managing multiple AI provider integrations
5
5
  Home-page: https://git.nexlab.net/nexlab/aisbf.git
6
6
  Author: AISBF Contributors
@@ -43,7 +43,7 @@ from .providers import (
43
43
  )
44
44
  from .handlers import RequestHandler, RotationHandler, AutoselectHandler
45
45
 
46
- __version__ = "0.1.0"
46
+ __version__ = "0.2.0"
47
47
  __all__ = [
48
48
  # Config
49
49
  "config",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aisbf
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: AISBF - AI Service Broker Framework || AI Should Be Free - A modular proxy server for managing multiple AI provider integrations
5
5
  Home-page: https://git.nexlab.net/nexlab/aisbf.git
6
6
  Author: AISBF Contributors
@@ -2,6 +2,7 @@ LICENSE.txt
2
2
  MANIFEST.in
3
3
  README.md
4
4
  aisbf.sh
5
+ cli.py
5
6
  main.py
6
7
  pyproject.toml
7
8
  requirements.txt
@@ -1,2 +1,2 @@
1
1
  [console_scripts]
2
- aisbf = main:main
2
+ aisbf = cli:main
@@ -1 +1,2 @@
1
1
  aisbf
2
+ cli
aisbf-0.2.2/cli.py ADDED
@@ -0,0 +1,67 @@
1
+ """
2
+ Copyright (C) 2026 Stefy Lanza <stefy@nexlab.net>
3
+
4
+ AISBF - AI Service Broker Framework || AI Should Be Free
5
+
6
+ Python CLI wrapper that calls the aisbf.sh shell script.
7
+
8
+ This program is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
20
+
21
+ Why did the programmer quit his job? Because he didn't get arrays!
22
+ """
23
+
24
+ import os
25
+ import sys
26
+ import subprocess
27
+ from pathlib import Path
28
+
29
+
30
+ def main():
31
+ """Main entry point for the aisbf CLI - calls the aisbf.sh shell script"""
32
+
33
+ # Determine the correct script path at runtime
34
+ # Check for system installation first (/usr/local/share/aisbf/aisbf.sh)
35
+ script_path = Path("/usr/local/share/aisbf/aisbf.sh")
36
+ if not script_path.exists():
37
+ # Fall back to user installation (~/.local/share/aisbf/aisbf.sh)
38
+ script_path = Path.home() / ".local" / "share" / "aisbf" / "aisbf.sh"
39
+
40
+ # Check if the script exists
41
+ if not script_path.exists():
42
+ print(f"Error: AISBF script not found at {script_path}", file=sys.stderr)
43
+ print("Please ensure AISBF is properly installed.", file=sys.stderr)
44
+ print(f"Expected locations:", file=sys.stderr)
45
+ print(f" - /usr/local/share/aisbf/aisbf.sh (system-wide)", file=sys.stderr)
46
+ print(f" - ~/.local/share/aisbf/aisbf.sh (user installation)", file=sys.stderr)
47
+ sys.exit(1)
48
+
49
+ # Execute the shell script with all arguments passed to this Python script
50
+ try:
51
+ # Use subprocess to run the shell script
52
+ result = subprocess.run(
53
+ [str(script_path)] + sys.argv[1:],
54
+ check=False
55
+ )
56
+ # Exit with the same exit code as the shell script
57
+ sys.exit(result.returncode)
58
+ except KeyboardInterrupt:
59
+ # Handle Ctrl-C gracefully
60
+ sys.exit(130) # Standard exit code for SIGINT (128 + 2)
61
+ except Exception as e:
62
+ print(f"Error executing AISBF script: {e}", file=sys.stderr)
63
+ sys.exit(1)
64
+
65
+
66
+ if __name__ == "__main__":
67
+ main()
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "aisbf"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "AISBF - AI Service Broker Framework || AI Should Be Free - A modular proxy server for managing multiple AI provider integrations"
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-or-later"
@@ -49,6 +49,7 @@ Documentation = "https://git.nexlab.net/nexlab/aisbf.git"
49
49
 
50
50
  [tool.setuptools]
51
51
  packages = ["aisbf"]
52
+ py-modules = ["cli"]
52
53
 
53
54
  [tool.setuptools.package-data]
54
55
  aisbf = ["*.json"]
@@ -21,7 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
21
21
  Why did the programmer quit his job? Because he didn't get arrays!
22
22
  """
23
23
 
24
- from setuptools import setup, find_packages, Command
24
+ from setuptools import setup, find_packages
25
25
  from setuptools.command.install import install as _install
26
26
  from pathlib import Path
27
27
  import os
@@ -38,7 +38,7 @@ if (this_directory / "requirements.txt").exists():
38
38
  requirements = [line.strip() for line in f if line.strip() and not line.startswith("#")]
39
39
 
40
40
  class InstallCommand(_install):
41
- """Custom install command that also installs the aisbf script and creates venv"""
41
+ """Custom install command that adds --user flag for non-root users"""
42
42
 
43
43
  def initialize_options(self):
44
44
  _install.initialize_options(self)
@@ -46,44 +46,10 @@ class InstallCommand(_install):
46
46
  if os.geteuid() != 0 and '--user' not in sys.argv:
47
47
  print("Installing as non-root user. Adding --user flag for user-local installation.")
48
48
  self.user = True
49
-
50
- def run(self):
51
- # Run the standard install (this will install data_files to share directory)
52
- _install.run(self)
53
-
54
- # Install the aisbf script
55
- self._install_aisbf_script()
56
-
57
- def _install_aisbf_script(self):
58
- """Install the aisbf script that uses the venv"""
59
- # Determine the installation directory
60
- if '--user' in sys.argv or os.geteuid() != 0:
61
- # User installation - use ~/.local/bin
62
- bin_dir = Path.home() / '.local' / 'bin'
63
- share_dir = Path.home() / '.local' / 'share' / 'aisbf'
64
- else:
65
- # System installation - use /usr/local/bin
66
- bin_dir = Path('/usr/local/bin')
67
- share_dir = Path('/usr/share/aisbf')
68
-
69
- # Create the bin directory if it doesn't exist
70
- bin_dir.mkdir(parents=True, exist_ok=True)
71
-
72
- # Copy the aisbf.sh script from the share directory to the bin directory
73
- src = share_dir / 'aisbf.sh'
74
- dst = bin_dir / 'aisbf'
75
-
76
- # Copy the script
77
- import shutil
78
- shutil.copy(src, dst)
79
-
80
- # Make it executable
81
- os.chmod(dst, 0o755)
82
- print(f"Installed 'aisbf' script to {dst}")
83
49
 
84
50
  setup(
85
51
  name="aisbf",
86
- version="0.2.0",
52
+ version="0.2.2",
87
53
  author="AISBF Contributors",
88
54
  author_email="stefy@nexlab.net",
89
55
  description="AISBF - AI Service Broker Framework || AI Should Be Free - A modular proxy server for managing multiple AI provider integrations",
@@ -111,7 +77,7 @@ setup(
111
77
  "aisbf": ["*.json"],
112
78
  },
113
79
  data_files=[
114
- # Install to /usr/share/aisbf (system-wide)
80
+ # Install to /usr/local/share/aisbf (system-wide)
115
81
  ('share/aisbf', [
116
82
  'main.py',
117
83
  'requirements.txt',
@@ -132,7 +98,7 @@ setup(
132
98
  ],
133
99
  entry_points={
134
100
  "console_scripts": [
135
- "aisbf=main:main",
101
+ "aisbf=cli:main",
136
102
  ],
137
103
  },
138
104
  cmdclass={
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes