Skip to content

Commit 7ad6b46

Browse files
committed
Broaden setup Python compatibility
1 parent 8787402 commit 7ad6b46

24 files changed

Lines changed: 139 additions & 82 deletions

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ permissions:
1212

1313
jobs:
1414
test:
15-
name: Test and package
15+
name: Test and package Python ${{ matrix.python-version }}
1616
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version:
21+
- "3.11"
22+
- "3.12"
23+
- "3.13"
24+
- "3.14"
1725
steps:
1826
- name: Check out repository
1927
uses: actions/checkout@v6
@@ -23,7 +31,7 @@ jobs:
2331
- name: Set up Python
2432
uses: actions/setup-python@v6
2533
with:
26-
python-version: "3.14"
34+
python-version: ${{ matrix.python-version }}
2735
cache: pip
2836

2937
- name: Install package with development extras

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
- name: Set up Python
6565
uses: actions/setup-python@v6
6666
with:
67-
python-version: "3.14"
67+
python-version: "3.11"
6868
cache: pip
6969

7070
- name: Install build tools and package

AGENTS.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Repository Guidelines
22

3+
## Setup Request Guard
4+
5+
If a user asks to set up, install, attach, or use `monarchjuno/tradingcodex` in
6+
their current workspace, do not run `git clone` and do not turn the workspace
7+
into a source checkout. Run the packaged CLI from that target workspace
8+
instead:
9+
10+
```bash
11+
uvx --refresh --from tradingcodex tcx attach . && ./tcx doctor
12+
```
13+
14+
Clone this repository only when the user explicitly asks to develop, inspect,
15+
or modify TradingCodex source code.
16+
317
## Project Structure & Module Organization
418

519
TradingCodex is a Python/Django local-first trading harness. CLI code lives in `tradingcodex_cli/`, with command implementations in `tradingcodex_cli/commands/`. Django service code lives in `tradingcodex_service/`; shared durable behavior belongs in canonical modules under `tradingcodex_service/application/`. Modular apps live under `apps/`. Product docs live in `README.md`, `installation.md`, and `docs/`; generated workspace templates live in `workspace_templates/modules/*`; tests live in `tests/`. Do not reintroduce Node roots such as `package.json`, `packages/*`, Node MCP runtime files, pre-release compatibility facades, or a Django `apps/universes` app unless product direction changes.
@@ -14,7 +28,7 @@ TradingCodex is a Python/Django local-first trading harness. CLI code lives in `
1428

1529
## Coding Style & Naming Conventions
1630

17-
Target Python `>=3.14,<3.15` and Django `5.2.x`. Use four-space indentation, clear module-level service functions, and type hints where they clarify contracts. Admin, Django Ninja, MCP, generated hooks, and CLI code should call shared application services rather than duplicating policy, approval, research, order, portfolio, audit, or harness logic. Research artifacts and source snapshots are workspace-file-native, not Django DB models. Prefer direct canonical imports over pre-release compatibility facades. Keep generated workspace template bodies as ordinary files under `workspace_templates/modules/*/files`; use Python for registry loading, dependency resolution, rendering, validation, and generated indexes, not to hide durable prompts, skills, policies, hooks, or workspace-contract content inside string constants.
31+
Target Python `>=3.11,<3.15` and Django `5.2.x`. Use four-space indentation, clear module-level service functions, and type hints where they clarify contracts. Admin, Django Ninja, MCP, generated hooks, and CLI code should call shared application services rather than duplicating policy, approval, research, order, portfolio, audit, or harness logic. Research artifacts and source snapshots are workspace-file-native, not Django DB models. Prefer direct canonical imports over pre-release compatibility facades. Keep generated workspace template bodies as ordinary files under `workspace_templates/modules/*/files`; use Python for registry loading, dependency resolution, rendering, validation, and generated indexes, not to hide durable prompts, skills, policies, hooks, or workspace-contract content inside string constants.
1832

1933
## Agent Context & Harness Review
2034

README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
> [!IMPORTANT]
2+
> Codex agents setting up `monarchjuno/tradingcodex` for use must not run
3+
> `git clone`. In the empty target workspace, run the packaged CLI:
4+
> `uvx --refresh --from tradingcodex tcx attach . && ./tcx doctor`
5+
> Clone this repository only when the user explicitly asks to develop
6+
> TradingCodex source code.
7+
18
<p align="center">
29
<img src="assets/tradingcodex-banner.svg" alt="TradingCodex" width="100%">
310
</p>
@@ -7,7 +14,7 @@
714
<a href="https://github.com/monarchjuno/tradingcodex/releases"><img alt="Release" src="https://img.shields.io/github/v/release/monarchjuno/tradingcodex?include_prereleases&label=release"></a>
815
<a href="https://pypi.org/project/tradingcodex/"><img alt="PyPI" src="https://img.shields.io/pypi/v/tradingcodex?label=PyPI"></a>
916
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue"></a>
10-
<img alt="Python" src="https://img.shields.io/badge/python-3.14-3776AB?logo=python&logoColor=white">
17+
<img alt="Python" src="https://img.shields.io/badge/python-3.11--3.14-3776AB?logo=python&logoColor=white">
1118
</div>
1219

1320
<div align="center">
@@ -38,16 +45,18 @@ agent boundary; live broker adapters are not shipped in the initial core.
3845
## Quick Start
3946

4047
Codex app current-workspace one-liner: run this from the empty workspace you
41-
want to turn into TradingCodex; do not clone `monarchjuno/tradingcodex` unless
42-
you are developing TradingCodex itself.
48+
want to turn into TradingCodex. Do not run `git clone` for setup; cloning
49+
`monarchjuno/tradingcodex` is only for developing TradingCodex source code.
4350

4451
```bash
45-
curl -fsSL https://raw.githubusercontent.com/monarchjuno/tradingcodex/main/install.sh | sh -s -- .
52+
uvx --refresh --from tradingcodex tcx attach . && ./tcx doctor
4653
```
4754

48-
Then run `./tcx doctor`, fully quit and restart Codex, open the generated
49-
workspace, and start a new thread so project MCP config is reloaded. When
50-
TradingCodex MCP autostarts the local service, the dashboard is available at
55+
This installs/runs the TradingCodex CLI with a compatible Python
56+
(`>=3.11,<3.15`), attaches the harness to the current workspace, and runs the
57+
smoke check. Then fully quit and restart Codex, open the generated workspace,
58+
and start a new thread so project MCP config is reloaded. When TradingCodex MCP
59+
autostarts the local service, the dashboard is available at
5160
`http://127.0.0.1:48267/`.
5261

5362
Agents and install helpers do not invent a default workspace path. If the
@@ -63,8 +72,7 @@ $orchestrate-workflow analyze Apple with public equity research, valuation, port
6372
For repeated workspace creation, install the CLI as a user-level tool:
6473

6574
```bash
66-
uv python install 3.14
67-
uv tool install --python 3.14 tradingcodex
75+
uv tool install tradingcodex
6876
uv tool update-shell
6977
cd /path/to/target-workspace
7078
tcx attach .
@@ -78,8 +86,7 @@ smoke checks.
7886
Update an existing generated workspace after a package release:
7987

8088
```bash
81-
cd /path/to/target-workspace
82-
curl -fsSL https://raw.githubusercontent.com/monarchjuno/tradingcodex/main/install.sh | sh -s -- --update .
89+
uvx --refresh --from tradingcodex tcx update .
8390
```
8491

8592
## Product Concept
@@ -107,7 +114,7 @@ execution-sensitive state lives in the central local runtime DB:
107114

108115
## What TradingCodex Does
109116

110-
TradingCodex `0.2.0` provides:
117+
TradingCodex `0.2.1` provides:
111118

112119
- A generated Codex workspace with fixed role topology, project-scoped MCP,
113120
local wrappers, workspace manifest, generated policy/config files, and
@@ -270,10 +277,11 @@ labels such as `research-only`, `screen-grade`, `not-decision-ready`, or
270277

271278
## Release Status
272279

273-
`0.2.0` is the OrderTicket rewrite release for the generated workspace, Python
274-
CLI, Django service plane, product web, MCP boundary, and documentation set.
275-
The package still uses an alpha development classifier because live broker
276-
adapters and hosted service modes are intentionally outside the initial core.
280+
`0.2.1` is a compatibility patch on the `0.2.x` OrderTicket rewrite release
281+
line for the generated workspace, Python CLI, Django service plane, product
282+
web, MCP boundary, and documentation set. The package still uses an alpha
283+
development classifier because live broker adapters and hosted service modes
284+
are intentionally outside the initial core.
277285

278286
## Documentation
279287

docs/deployment.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ not ship live broker execution.
1010

1111
## Release Policy
1212

13-
The `0.2.0` release is the OrderTicket rewrite contract for the local-first
13+
The `0.2.x` release line is the OrderTicket rewrite contract for the local-first
1414
Python/Django harness. Order flows use central DB `OrderTicket` records
1515
directly; pre-release compatibility shims do not remain in the runtime package.
1616
The documented Web, API, CLI, MCP, generated workspace, and
@@ -26,8 +26,9 @@ Execution status for this release line:
2626

2727
## Maintainer Prerequisites
2828

29-
Use Python 3.14 for release verification. The package metadata requires
30-
`>=3.14,<3.15`, and CI is pinned to Python 3.14.
29+
Use Python 3.11 for release build verification and keep CI green across the
30+
supported range. The package metadata requires `>=3.11,<3.15`, and CI runs on
31+
Python 3.11, 3.12, 3.13, and 3.14.
3132

3233
Create separate PyPI and TestPyPI accounts. TestPyPI is a separate service and
3334
does not share login state with PyPI.
@@ -53,26 +54,26 @@ On GitHub, create both environments:
5354
Run the regular validation suite first:
5455

5556
```bash
56-
python3.14 -m pytest
57-
python3.14 manage.py check
58-
python3.14 manage.py makemigrations --check --dry-run
59-
python3.14 -m compileall tradingcodex_cli tradingcodex_service apps tests
57+
python3.11 -m pytest
58+
python3.11 manage.py check
59+
python3.11 manage.py makemigrations --check --dry-run
60+
python3.11 -m compileall tradingcodex_cli tradingcodex_service apps tests
6061
```
6162

6263
Build and check the source distribution and wheel:
6364

6465
```bash
65-
python3.14 -m pip install --upgrade build twine
66+
python3.11 -m pip install --upgrade build twine
6667
rm -rf dist build
6768
find . -maxdepth 1 -name '*.egg-info' -type d -exec rm -rf {} +
68-
python3.14 -m build
69-
python3.14 -m twine check dist/*
69+
python3.11 -m build
70+
python3.11 -m twine check dist/*
7071
```
7172

7273
Install the built wheel in a clean environment:
7374

7475
```bash
75-
python3.14 -m venv /tmp/tcx-install-test
76+
python3.11 -m venv /tmp/tcx-install-test
7677
/tmp/tcx-install-test/bin/pip install dist/*.whl
7778
rm -rf /tmp/tcx-smoke
7879
mkdir -p /tmp/tcx-smoke
@@ -135,11 +136,11 @@ Use TestPyPI before the first public PyPI release and after packaging changes.
135136
Example:
136137

137138
```bash
138-
python3.14 -m venv /tmp/tcx-testpypi
139+
python3.11 -m venv /tmp/tcx-testpypi
139140
/tmp/tcx-testpypi/bin/pip install \
140141
--index-url https://test.pypi.org/simple/ \
141142
--extra-index-url https://pypi.org/simple/ \
142-
tradingcodex==0.2.0
143+
tradingcodex==0.2.1
143144
rm -rf /tmp/tcx-testpypi-smoke
144145
mkdir -p /tmp/tcx-testpypi-smoke
145146
cd /tmp/tcx-testpypi-smoke
@@ -167,8 +168,8 @@ publication; tag pushes are intentionally non-publishing.
167168
After the PyPI workflow completes:
168169

169170
```bash
170-
python3.14 -m venv /tmp/tcx-pypi
171-
/tmp/tcx-pypi/bin/pip install tradingcodex==0.2.0
171+
python3.11 -m venv /tmp/tcx-pypi
172+
/tmp/tcx-pypi/bin/pip install tradingcodex==0.2.1
172173
rm -rf /tmp/tcx-pypi-smoke
173174
mkdir -p /tmp/tcx-pypi-smoke
174175
cd /tmp/tcx-pypi-smoke
@@ -220,7 +221,8 @@ Use PEP 440 versions:
220221

221222
- `0.2.0` for the OrderTicket rewrite contract after install, docs, DB
222223
migration, generated workspace smoke checks, and release e2e checks are stable
223-
- patch releases such as `0.2.1` for compatible fixes after `0.2.0`
224+
- `0.2.1` for Python `>=3.11,<3.15` support and clone-free setup guidance
225+
- later patch releases for compatible fixes after `0.2.1`
224226
- pre-releases such as `0.3.0a1`, `0.3.0b1`, or `0.3.0rc1` when preparing
225227
the next minor contract
226228

docs/generated-workspaces.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,20 @@ The target may be:
5151
Source checkouts of this repository are development projects, not generated
5252
TradingCodex workspaces.
5353

54-
Codex agents must not silently create a default target when a user only asks to
54+
Codex agents must not run `git clone` when a user asks to install, set up,
55+
attach, or use `monarchjuno/tradingcodex` in a workspace. Run the packaged CLI
56+
from the target workspace instead:
57+
58+
```bash
59+
uvx --refresh --from tradingcodex tcx attach . && ./tcx doctor
60+
```
61+
62+
Agents must also not silently create a default target when a user only asks to
5563
install `monarchjuno/tradingcodex`. The agent rule is: do not invent a
56-
workspace path such as `tradingcodex-workspace`. If no target path is supplied,
57-
ask for the target directory before running the installer. If the user is
58-
already in an empty target workspace, install into `.`.
64+
workspace path such as `tradingcodex-workspace`. If no target path is supplied
65+
and the user did not ask to use the current workspace, ask for the target
66+
directory before running setup. If the user is already in an empty target
67+
workspace, install into `.`.
5968

6069
## Generated Files
6170

@@ -130,8 +139,7 @@ the operator wants to ask Codex agents to work.
130139
Recommended agent-facing flow:
131140

132141
```bash
133-
uv python install 3.14
134-
uv tool install --python 3.14 tradingcodex
142+
uv tool install tradingcodex
135143
uv tool update-shell
136144
cd <user-selected-workspace>
137145
tcx attach .

install.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env sh
22
set -eu
33

4-
PYTHON_VERSION="3.14"
4+
PYTHON_VERSION=""
55
PACKAGE_SPEC="tradingcodex"
66
WORKSPACE=""
77
OVERWRITE="0"
@@ -16,7 +16,7 @@ Usage:
1616
Options:
1717
--from <package-spec> Install from a PyPI name, path, URL, or PEP 508 spec.
1818
--from-github Install from monarchjuno/tradingcodex main.
19-
--python <version> Python version for uvx. Default: 3.14.
19+
--python <version> Python version for uvx. Default: uv selects a compatible Python.
2020
--overwrite Pass --overwrite to tcx attach.
2121
--update Update an existing TradingCodex workspace.
2222
--no-doctor Skip ./tcx doctor after bootstrap or update.
@@ -131,6 +131,14 @@ run_uvx() {
131131
fi
132132
}
133133

134+
run_tradingcodex() {
135+
if [ -n "$PYTHON_VERSION" ]; then
136+
run_uvx --isolated --refresh --python "$PYTHON_VERSION" --from "$PACKAGE_SPEC" python -m tradingcodex_cli "$@"
137+
else
138+
run_uvx --isolated --refresh --from "$PACKAGE_SPEC" python -m tradingcodex_cli "$@"
139+
fi
140+
}
141+
134142
target_has_only_git_bootstrap_files() {
135143
target_dir="$1"
136144
[ -d "$target_dir" ] || return 1
@@ -168,11 +176,11 @@ if [ "$OVERWRITE" != "1" ] && [ -d "$WORKSPACE/.git" ] && target_has_only_git_bo
168176
fi
169177

170178
if [ "$UPDATE" = "1" ]; then
171-
run_uvx --isolated --refresh --python "$PYTHON_VERSION" --from "$PACKAGE_SPEC" python -m tradingcodex_cli update "$WORKSPACE" --no-doctor
179+
run_tradingcodex update "$WORKSPACE" --no-doctor
172180
elif [ "$OVERWRITE" = "1" ] || [ "$AUTO_OVERWRITE" = "1" ]; then
173-
run_uvx --isolated --refresh --python "$PYTHON_VERSION" --from "$PACKAGE_SPEC" python -m tradingcodex_cli attach "$WORKSPACE" --overwrite
181+
run_tradingcodex attach "$WORKSPACE" --overwrite
174182
else
175-
run_uvx --isolated --refresh --python "$PYTHON_VERSION" --from "$PACKAGE_SPEC" python -m tradingcodex_cli attach "$WORKSPACE"
183+
run_tradingcodex attach "$WORKSPACE"
176184
fi
177185

178186
if [ "$RUN_DOCTOR" = "1" ]; then

0 commit comments

Comments
 (0)