polis-genesis 0.2.0__py3-none-any.whl

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.
@@ -0,0 +1,5 @@
1
+ """
2
+ Polis Genesis: Autonomous multi agent society simulation.
3
+ """
4
+
5
+ __version__ = "0.2.0"
@@ -0,0 +1,4 @@
1
+ from polis_genesis.cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
polis_genesis/cli.py ADDED
@@ -0,0 +1,97 @@
1
+ """
2
+ Command line interface for Polis Genesis.
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ import shutil
8
+ import subprocess
9
+ import sys
10
+ import webbrowser
11
+
12
+ def find_cli_binary() -> str | None:
13
+ # Look in cargo target directories
14
+ candidates = [
15
+ os.path.join(os.path.dirname(__file__), "..", "..", "target", "release", "polis_cli.exe"),
16
+ os.path.join(os.path.dirname(__file__), "..", "..", "target", "debug", "polis_cli.exe"),
17
+ os.path.join(os.path.dirname(__file__), "..", "..", "target", "release", "polis_cli"),
18
+ os.path.join(os.path.dirname(__file__), "..", "..", "target", "debug", "polis_cli"),
19
+ shutil.which("polis_cli"),
20
+ shutil.which("polis_cli.exe"),
21
+ ]
22
+ for c in candidates:
23
+ if c and os.path.exists(c):
24
+ return os.path.abspath(c)
25
+ return None
26
+
27
+ def cmd_console(args: argparse.Namespace) -> None:
28
+ bin_path = find_cli_binary()
29
+ if bin_path:
30
+ subprocess.run([bin_path, "console", str(args.seed), str(args.population), str(args.ticks), str(args.delay)])
31
+ else:
32
+ # Fall back to cargo run
33
+ cmd = ["cargo", "run", "--release", "-p", "polis_cli", "--", "console", str(args.seed), str(args.population), str(args.ticks), str(args.delay)]
34
+ try:
35
+ subprocess.run(cmd)
36
+ except FileNotFoundError:
37
+ print("cargo was not found. Please install Rust from https://rustup.rs to compile polis_cli.")
38
+ sys.exit(1)
39
+
40
+ def cmd_serve(args: argparse.Namespace) -> None:
41
+ bin_path = find_cli_binary()
42
+ cmd = [bin_path or "cargo", "serve" if bin_path else "run", *(["--release", "-p", "polis_cli", "--", "serve"] if not bin_path else []), str(args.seed), str(args.population), str(args.port)]
43
+ try:
44
+ subprocess.run(cmd)
45
+ except KeyboardInterrupt:
46
+ print("\nTown server stopped.")
47
+
48
+ def cmd_web(args: argparse.Namespace) -> None:
49
+ url = args.url or "https://eyadstein.github.io/polis-genesis/world.html"
50
+ print(f"Opening Polis Genesis in browser: {url}")
51
+ webbrowser.open(url)
52
+
53
+ def cmd_info(_args: argparse.Namespace) -> None:
54
+ print("==================================================")
55
+ print(" Polis Genesis: Society & Mind Simulator")
56
+ print(" Version: 0.2.0")
57
+ print(" Repository: https://github.com/eyadstein/polis-genesis")
58
+ print(" Website: https://eyadstein.github.io/polis-genesis/world.html")
59
+ print("==================================================")
60
+ print(" Districts: 16 districts with central water fountains")
61
+ print(" Needs: Hunger, Thirst, Energy, Social, Purpose")
62
+ print(" Actions: Eat, Drink, Rest, Work, Socialize, Wander")
63
+ print(" Economics: Real estate, rents, progressive taxes")
64
+ print("==================================================")
65
+
66
+ def main() -> None:
67
+ parser = argparse.ArgumentParser(prog="polis-genesis", description="Polis Genesis Autonomous Simulation")
68
+ subparsers = parser.add_subparsers(dest="command", help="Subcommand to execute")
69
+
70
+ p_console = subparsers.add_parser("console", help="Run interactive terminal world")
71
+ p_console.add_argument("--seed", type=int, default=1, help="World RNG seed")
72
+ p_console.add_argument("--population", type=int, default=120, help="Initial population")
73
+ p_console.add_argument("--ticks", type=int, default=500, help="Total simulation ticks")
74
+ p_console.add_argument("--delay", type=int, default=70, help="Milliseconds between ticks")
75
+ p_console.set_defaults(func=cmd_console)
76
+
77
+ p_serve = subparsers.add_parser("serve", help="Run live town server")
78
+ p_serve.add_argument("--seed", type=int, default=1, help="World RNG seed")
79
+ p_serve.add_argument("--population", type=int, default=200, help="Initial population")
80
+ p_serve.add_argument("--port", type=int, default=8787, help="Server port")
81
+ p_serve.set_defaults(func=cmd_serve)
82
+
83
+ p_web = subparsers.add_parser("web", help="Open the 3D visualizer website")
84
+ p_web.add_argument("--url", type=str, default=None, help="Target URL")
85
+ p_web.set_defaults(func=cmd_web)
86
+
87
+ p_info = subparsers.add_parser("info", help="Show system and simulation information")
88
+ p_info.set_defaults(func=cmd_info)
89
+
90
+ args = parser.parse_args()
91
+ if hasattr(args, "func"):
92
+ args.func(args)
93
+ else:
94
+ cmd_info(args)
95
+
96
+ if __name__ == "__main__":
97
+ main()
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: polis-genesis
3
+ Version: 0.2.0
4
+ Summary: A living autonomous multi agent society simulation with neural minds, realistic economics, and 3D visualizer
5
+ Author: Eyad Stein
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/eyadstein/polis-genesis
8
+ Project-URL: Documentation, https://eyadstein.github.io/polis-genesis/world.html
9
+ Project-URL: Repository, https://github.com/eyadstein/polis-genesis
10
+ Project-URL: Issues, https://github.com/eyadstein/polis-genesis/issues
11
+ Keywords: simulation,multi-agent,artificial-life,society,neural-network,generative-agents,threejs,rust
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Rust
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Games/Entertainment :: Simulation
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Dynamic: license-file
23
+
24
+ # Polis Genesis
25
+
26
+ > **An autonomous town simulation where artificial life meets a living
27
+ > 3D world.**
28
+
29
+ [![ENTER THE WORLD --- Launch Live
30
+ Demo](https://img.shields.io/badge/ENTER_THE_WORLD-Launch_Live_Demo-2ea44f?style=for-the-badge)](https://eyadstein.github.io/polis-genesis/)
31
+
32
+ [![CI](https://github.com/eyadstein/polis-genesis/actions/workflows/ci.yml/badge.svg)](https://github.com/eyadstein/polis-genesis/actions/workflows/ci.yml)
33
+ [![GitHub
34
+ Pages](https://github.com/eyadstein/polis-genesis/actions/workflows/pages.yml/badge.svg)](https://github.com/eyadstein/polis-genesis/actions/workflows/pages.yml)
35
+ [![MIT
36
+ License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
37
+ [![PyPI](https://img.shields.io/pypi/v/polis-genesis.svg)](https://pypi.org/project/polis-genesis/)
38
+
39
+ **[🌐 Open the live simulation
40
+ →](https://eyadstein.github.io/polis-genesis/)**
41
+
42
+ ------------------------------------------------------------------------
43
+
44
+ ## Overview
45
+
46
+ **Polis Genesis** is a real-time, 3D town simulation built around
47
+ autonomous agents. Each resident has its own genome, needs, moods,
48
+ memories, relationships, and a neural-network-driven mind.
49
+
50
+ Residents make decisions, work, interact, form families, and participate
51
+ in an evolving virtual society. Rather than relying entirely on scripted
52
+ events, the simulation brings together individual behavior and
53
+ interconnected systems to explore how a virtual society develops.
54
+
55
+ Try the hosted viewer without installing anything:
56
+
57
+ **[Enter Polis Genesis](https://eyadstein.github.io/polis-genesis/)**
58
+
59
+ ## Features
60
+
61
+ - **Autonomous agents** --- neural-network-driven behavior that learns
62
+ from experience.
63
+ - **Needs and daily life** --- food, water, sleep, work, social
64
+ interaction, and other needs shape decisions.
65
+ - **Economy** --- jobs, salaries, housing, taxes, and a shared town
66
+ treasury.
67
+ - **Families and genealogy** --- relationships, children, genetic
68
+ inheritance, and mutation.
69
+ - **Law and order** --- crime, police, courts, fines, and prisons.
70
+ - **Dynamic environment** --- day/night transitions, seasonal
71
+ lighting, waterways, fountains, and ambient sound.
72
+ - **Interactive 3D viewer** --- a browser-based world built with
73
+ Three.js and Vite.
74
+ - **Python CLI** --- console, server, and web commands for interacting
75
+ with the simulation.
76
+ - **Snapshots and analytics** --- JSON exports, statistical reports,
77
+ and replay functionality.
78
+
79
+ ## Getting Started
80
+
81
+ ### Try it online
82
+
83
+ Open the live demo:
84
+
85
+ **https://eyadstein.github.io/polis-genesis/**
86
+
87
+ ### Install the Python package
88
+
89
+ ``` bash
90
+ pip install polis-genesis
91
+ ```
92
+
93
+ ### Run the simulation
94
+
95
+ Start the console interface:
96
+
97
+ ``` bash
98
+ polis-genesis console
99
+ ```
100
+
101
+ Start the local server:
102
+
103
+ ``` bash
104
+ polis-genesis serve
105
+ ```
106
+
107
+ Open the local viewer address printed by the server. Depending on the
108
+ configuration, it may be available at
109
+ `http://localhost:8787/world.html`.
110
+
111
+ Launch web mode:
112
+
113
+ ``` bash
114
+ polis-genesis web
115
+ ```
116
+
117
+ ## Build from Source
118
+
119
+ ### Prerequisites
120
+
121
+ - Rust and Cargo
122
+ - Node.js and npm
123
+ - Python for Python tooling
124
+
125
+ ### Run the simulation
126
+
127
+ From the repository root:
128
+
129
+ ``` bash
130
+ cargo run --release -p polis_cli -- 1 3000 200
131
+ ```
132
+
133
+ ### Start the 3D viewer
134
+
135
+ ``` bash
136
+ cd viewer
137
+ npm ci
138
+ npm run dev
139
+ ```
140
+
141
+ Vite prints the local development URL in the terminal.
142
+
143
+ ### Build the production viewer
144
+
145
+ From the `viewer` directory:
146
+
147
+ ``` bash
148
+ npm run build
149
+ ```
150
+
151
+ The generated static site is written to `viewer/dist`. GitHub Actions
152
+ builds and deploys the viewer to GitHub Pages.
153
+
154
+ ## Technology Stack
155
+
156
+ Component Technology
157
+ ------------------------ ----------------
158
+ Simulation engine Rust
159
+ 3D rendering Three.js
160
+ Front-end tooling Vite
161
+ Python interface Python
162
+ Continuous integration GitHub Actions
163
+ Demo hosting GitHub Pages
164
+
165
+ ## Roadmap
166
+
167
+ - [x] Core engine, genomes, needs, moods, and movement
168
+ - [x] Economy, jobs, and housing
169
+ - [x] Relationships, children, and inheritance
170
+ - [x] Memory and social interaction
171
+ - [x] Law enforcement and justice systems
172
+ - [ ] Schools, belief systems, culture, and sports
173
+ - [ ] Expanded survival mechanics and emergent epochs
174
+ - [ ] Enhanced observation, replay, and analytics
175
+
176
+ ## Documentation
177
+
178
+ - [Design overview](docs/DESIGN.md)
179
+ - [Contributing guidelines](CONTRIBUTING.md)
180
+ - [Changelog](CHANGELOG.md)
181
+ - [License](LICENSE)
182
+
183
+ ## Contributing
184
+
185
+ Contributions, bug reports, and ideas are welcome.
186
+
187
+ 1. Fork the repository.
188
+ 2. Create a branch for your changes.
189
+ 3. Implement your changes and add tests where appropriate.
190
+ 4. Run the relevant checks.
191
+ 5. Submit a pull request describing your changes.
192
+
193
+ Run the Rust checks:
194
+
195
+ ``` bash
196
+ cargo test --workspace --all-features --locked
197
+ cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
198
+ ```
199
+
200
+ For viewer changes:
201
+
202
+ ``` bash
203
+ cd viewer
204
+ npm ci
205
+ npm test
206
+ npm run build
207
+ ```
208
+
209
+ ## License
210
+
211
+ Distributed under the [MIT License](LICENSE).
212
+
213
+ ------------------------------------------------------------------------
214
+
215
+ **Explore the world. Observe the agents. Watch the town evolve.**
216
+
217
+ **[ENTER POLIS GENESIS →](https://eyadstein.github.io/polis-genesis/)**
@@ -0,0 +1,9 @@
1
+ polis_genesis/__init__.py,sha256=csltdf_T919KsRB5qusf71kKmhQYqBCwbZeECxlJT-g,89
2
+ polis_genesis/__main__.py,sha256=-0UHikyg1UcQJG9ydDPx1u1uN_TEIxDV6jfj_LI6Swc,74
3
+ polis_genesis/cli.py,sha256=bapcqa_7mOv2Vi-oRcCzCxCuhBLbafXt32K4qx8ntGU,4317
4
+ polis_genesis-0.2.0.dist-info/licenses/LICENSE,sha256=4ZNTs0RLW3NLl1j5QjvZO5mTrX2C8SknemoQE4uQYhY,1066
5
+ polis_genesis-0.2.0.dist-info/METADATA,sha256=GAKobSYMVkcrJ5ajlmlBxcZuT14_lgHfvXMjn3EiFIE,6238
6
+ polis_genesis-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
7
+ polis_genesis-0.2.0.dist-info/entry_points.txt,sha256=jqNTZnVkhpjKpkle6BOCnR3zlN2mltHgiENHVpyO9-Q,88
8
+ polis_genesis-0.2.0.dist-info/top_level.txt,sha256=TkYhitvuDXIsF0Tkna1ltgUjI42U5kXogVRmahWnx8g,14
9
+ polis_genesis-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ polis = polis_genesis.cli:main
3
+ polis-genesis = polis_genesis.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eyad Ahmed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ polis_genesis