-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathsetup.py
More file actions
203 lines (177 loc) · 7.76 KB
/
setup.py
File metadata and controls
203 lines (177 loc) · 7.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
"""
Setup configuration for CIRIS Agent.
This enables pip-installable distribution with optional GUI bundling.
The CLI command 'ciris-agent' wraps the existing main.py Click interface.
Platform-specific wheels:
When a CIRIS Desktop JAR is present in ciris_engine/desktop_app/,
the wheel is tagged with the matching platform (e.g., macosx_11_0_arm64).
When no JAR is present, a pure-Python py3-none-any wheel is produced
for headless server deployments.
Localization:
The authoritative localization files are in /localization/*.json.
During build, these are copied to ciris_engine/data/localized/ for bundling.
"""
import shutil
from pathlib import Path
from setuptools import find_packages, setup
from setuptools.command.build_py import build_py as _build_py
class _BuildPyWithLocalization(_build_py):
"""Copy localization files to package data before building."""
def run(self):
# Copy localization files to package data directory
src_dir = Path(__file__).parent / "localization"
dst_dir = Path(__file__).parent / "ciris_engine" / "data" / "localized"
dst_dir.mkdir(parents=True, exist_ok=True)
if src_dir.exists():
for json_file in src_dir.glob("*.json"):
shutil.copy2(json_file, dst_dir / json_file.name)
super().run()
try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
except ImportError:
_bdist_wheel = None
# Map Compose Desktop JAR platform suffixes to PEP 427 wheel platform tags
_JAR_PLATFORM_MAP = {
"macos-arm64": "macosx_11_0_arm64",
"macos-x64": "macosx_10_15_x86_64",
"linux-x64": "manylinux2014_x86_64",
"windows-x64": "win_amd64",
}
def _detect_jar_platform():
"""Detect platform from the JAR filename in ciris_engine/desktop_app/."""
jar_dir = Path(__file__).parent / "ciris_engine" / "desktop_app"
if not jar_dir.exists():
return None
for jar in jar_dir.glob("CIRIS-*.jar"):
# JAR names: CIRIS-macos-arm64-2.0.0.jar, CIRIS-linux-x64-2.0.0.jar, etc.
stem = jar.stem # e.g. "CIRIS-macos-arm64-2.0.0"
for jar_suffix, wheel_tag in _JAR_PLATFORM_MAP.items():
if jar_suffix in stem:
return wheel_tag
return None
if _bdist_wheel is not None:
class _PlatformBdistWheel(_bdist_wheel):
"""Override bdist_wheel to set platform tag based on bundled JAR."""
def finalize_options(self):
super().finalize_options()
self._detected_platform = _detect_jar_platform()
if self._detected_platform:
self.root_is_pure = False
def get_tag(self):
if self._detected_platform:
return "py3", "none", self._detected_platform
return super().get_tag()
_cmdclass = {"bdist_wheel": _PlatformBdistWheel, "build_py": _BuildPyWithLocalization}
else:
_cmdclass = {"build_py": _BuildPyWithLocalization}
# Read the README for long description
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text(encoding="utf-8")
# Read version from constants.py
version = "1.6.2" # Will be updated by bump_version.py
try:
with open("ciris_engine/constants.py") as f:
for line in f:
if line.startswith("CIRIS_VERSION"):
version = line.split('"')[1]
# Strip "-stable" or other suffixes for PEP 440 compliance
version = version.split("-")[0]
break
except Exception:
pass # Fall back to hardcoded version if constants.py is not readable
# Read requirements
requirements = []
with open("requirements.txt") as f:
requirements = [line.strip() for line in f if line.strip() and not line.startswith("#")]
# Read dev requirements
dev_requirements = []
try:
with open("requirements-dev.txt") as f:
dev_requirements = [line.strip() for line in f if line.strip() and not line.startswith("#")]
except FileNotFoundError:
pass
setup(
name="ciris-agent",
version=version,
cmdclass=_cmdclass,
description="CIRIS: Ethical AI Agent with Consensual Evolution Protocol",
long_description=long_description,
long_description_content_type="text/markdown",
author="Eric Moore",
author_email="eric@ciris.ai",
url="https://github.com/CIRISAI/CIRISAgent",
packages=find_packages(exclude=["tests", "tests.*", "docs", "tools.test_*"]),
py_modules=["main"], # Include main.py at root level
include_package_data=True, # CRITICAL - includes non-Python files from MANIFEST.in
package_data={
"ciris_engine.data": [
"accord_1.2b.txt", # Accord text file (v1.2-Beta)
"accord_1.2b_compressed.txt", # Compressed accord for testing
"localized/*.json", # Backend localization files (copied from /localization/)
"localized/*.txt", # Localized ACCORD text files
"localized/*.md", # Localized comprehensive guides
"geo/cities.db", # GeoNames cities database for location typeahead
],
"ciris_engine.config": [
"*.json", # Pricing and configuration data
],
"ciris_engine.logic.dma": [
"prompts/*.yml", # DMA prompt templates (English)
"prompts/localized/*/*.yml", # Localized DMA prompt templates
],
"ciris_engine.logic.persistence": [
"migrations/sqlite/*.sql", # SQLite database migrations
"migrations/postgres/*.sql", # PostgreSQL database migrations
],
"ciris_engine": [
"ciris_templates/*.yaml", # Bundled agent identity templates
"desktop_app/*.jar", # CIRIS Desktop app (Kotlin Compose)
],
},
entry_points={
"console_scripts": [
"ciris-agent=ciris_engine.cli:main", # Desktop app (default) or server mode
"ciris-server=ciris_engine.cli:server", # Headless API server
"ciris-desktop=ciris_engine.cli:desktop", # Desktop app launcher
],
# Adapter discovery entry points - eliminates hardcoded KNOWN_MODULAR_SERVICES list
# Each entry point maps adapter_name -> module path for manifest loading
"ciris.adapters": [
"ciris_hosted_tools=ciris_adapters.ciris_hosted_tools",
"ciris_verify=ciris_adapters.ciris_verify",
"external_data_sql=ciris_adapters.external_data_sql",
"home_assistant=ciris_adapters.home_assistant",
"mcp_client=ciris_adapters.mcp_client",
"mcp_common=ciris_adapters.mcp_common",
"mcp_server=ciris_adapters.mcp_server",
"mock_llm=ciris_adapters.mock_llm",
"navigation=ciris_adapters.navigation",
"reddit=ciris_adapters.reddit",
"sample_adapter=ciris_adapters.sample_adapter",
"weather=ciris_adapters.weather",
],
},
install_requires=requirements,
extras_require={
"dev": dev_requirements,
},
python_requires=">=3.10",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Application Frameworks",
],
keywords="ai agent ethical-ai autonomous-agent discord-bot api-server",
project_urls={
"Bug Reports": "https://github.com/CIRISAI/CIRISAgent/issues",
"Source": "https://github.com/CIRISAI/CIRISAgent",
"Documentation": "https://github.com/CIRISAI/CIRISAgent/tree/main/docs",
},
)