Skip to content

Commit 64cc4c3

Browse files
committed
opencode init
0 parents  commit 64cc4c3

16 files changed

Lines changed: 492 additions & 0 deletions

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv
11+
stderr.txt
12+
stderr2.txt
13+
stdout.txt
14+
stdout2.txt

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.14

.vscode/extensions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"ms-python.python",
4+
"ms-python.vscode-pylance",
5+
"ms-python.debugpy",
6+
"charliermarsh.ruff",
7+
"Gruntfuggly.todo-tree"
8+
]
9+
}
10+

.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
8+
{
9+
"name": "Python Debugger: Current File",
10+
"type": "debugpy",
11+
"request": "launch",
12+
"program": "${file}",
13+
"console": "integratedTerminal",
14+
"env": {
15+
"PYTHONASYNCIODEBUG": "1",
16+
"DEBUG": "1"
17+
}
18+
}
19+
]
20+
}

.vscode/settings.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"python.autoComplete.extraPaths": [],
3+
"python.analysis.autoImportCompletions": true,
4+
"[python]": {
5+
"editor.formatOnSaveMode": "file",
6+
"editor.formatOnSave": true,
7+
"editor.defaultFormatter": "charliermarsh.ruff",
8+
"editor.formatOnType": false,
9+
"editor.insertSpaces": false,
10+
"editor.tabSize": 4,
11+
"editor.detectIndentation": false
12+
},
13+
"editor.defaultFormatter": "charliermarsh.ruff",
14+
"notebook.defaultFormatter": "charliermarsh.ruff",
15+
"editor.defaultFoldingRangeProvider": "charliermarsh.ruff",
16+
"[jsonc]": {
17+
"editor.defaultFormatter": "vscode.json-language-features"
18+
},
19+
"[json]": {
20+
"editor.defaultFormatter": "vscode.json-language-features"
21+
},
22+
"cSpell.words": [
23+
"ASMR",
24+
"autotapping",
25+
"byewave",
26+
"Chillout",
27+
"gameobject",
28+
"Poiyomi",
29+
"Resonite",
30+
"steamvr",
31+
"Toastacuga",
32+
"unitypackage",
33+
"vrcfury",
34+
"vrchat",
35+
"zeroconf"
36+
],
37+
"cSpell.enabledFileTypes": {
38+
"markdown": true,
39+
"python": false
40+
},
41+
"cSpell.useGitignore": false,
42+
"workbench.colorCustomizations": {
43+
"titleBar.activeBackground": "#374e19",
44+
"titleBar.inactiveBackground": "#2c3f14",
45+
}
46+
}

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# crosschat-python
2+
3+
Game server cross-chat via MQTT.
4+
5+
## Requirements
6+
7+
- Python >= 3.14
8+
- [uv](https://docs.astral.sh/uv/getting-started/installation/)
9+
10+
## Usage
11+
12+
```sh
13+
uv run python src/crosschat/main.py
14+
uv run python src/crosschat/main.py --config config.metatest2.json
15+
uv run python src/crosschat/main.py --server-id metatest2 --host 10.0.0.1 -v
16+
```
17+
18+
Connect to the aiomonitor REPL:
19+
20+
```sh
21+
telnet localhost 20103
22+
```
23+
24+
Type `status` to see known servers and their online/users state.

config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"mqtt": {
3+
"host": "10.0.0.1",
4+
"port": 1883
5+
},
6+
"server_id": "metatest1",
7+
"topic_prefix": "crosschat/",
8+
"last_will_topic": "crosschat/state/metatest1/online"
9+
}

config.metatest2.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"mqtt": {
3+
"host": "10.0.0.1",
4+
"port": 1883
5+
},
6+
"server_id": "metatest2",
7+
"topic_prefix": "crosschat/",
8+
"last_will_topic": "crosschat/state/metatest2/online"
9+
}

opencode.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://opencode.ai/config.json",
3+
"lsp": true
4+
}

pyproject.toml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
[project]
2+
name = "crosschat-python"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.14"
7+
dependencies = [
8+
"aiomonitor>=0.7.1",
9+
"aiomqtt>=2.5.1",
10+
"fastapi[standard]>=0.136.1",
11+
"paho-mqtt>=2.1.0",
12+
"pydantic>=2.13.4",
13+
"rich>=15.0.0",
14+
"structlog>=25.5.0",
15+
]
16+
17+
18+
# https://docs.astral.sh/ruff/tutorial/
19+
[tool.ruff.lint]
20+
#select = ["ALL"]
21+
ignore = ["W191","E101"]
22+
per-file-ignores = { }
23+
24+
[tool.ruff.lint.flake8-quotes]
25+
inline-quotes = "single"
26+
27+
[tool.ruff]
28+
line-length = 120
29+
target-version = "py313"
30+
31+
src = ["src", "tests"]
32+
33+
34+
[tool.ruff.format]
35+
quote-style = "single"
36+
indent-style = "tab"
37+
docstring-code-format = true
38+
39+
exclude = [
40+
".bzr",
41+
".direnv",
42+
".eggs",
43+
".git",
44+
".hg",
45+
".mypy_cache",
46+
".nox",
47+
".pants.d",
48+
".ruff_cache",
49+
".svn",
50+
".tox",
51+
".venv",
52+
"__pypackages__",
53+
"_build",
54+
"buck-out",
55+
"build",
56+
"dist",
57+
"node_modules",
58+
"venv",
59+
"*.json",
60+
]
61+
62+
63+
[tool.mypy]
64+
strict = false
65+
exclude = ["venv", ".venv"]
66+
ignore_missing_imports = true
67+
allow_untyped_decorators = true
68+
plugins = ["pydantic.mypy"]
69+
follow_imports = "silent"
70+
warn_redundant_casts = true
71+
warn_unused_ignores = true
72+
disallow_any_generics = true
73+
no_implicit_reexport = true
74+
disallow_untyped_defs = false
75+
76+
[tool.pydantic-mypy]
77+
init_forbid_extra = true
78+
init_typed = true
79+
warn_required_dynamic_aliases = true
80+
81+
[dependency-groups]
82+
dev = [
83+
"pylance>=4.0.1",
84+
"pyright>=1.1.409",
85+
"pytest>=9.0.3",
86+
"pytest-asyncio>=1.3.0",
87+
"ruff>=0.15.12",
88+
"ty>=0.0.34",
89+
]
90+
91+
[tool.ruff.lint.pycodestyle]
92+
max-line-length = 130

0 commit comments

Comments
 (0)