Migrate to Poetry packaging and restructure codebase #21

Merged
Sudo-Ivan merged 23 commits from codebase-improvements into master 2025-12-01 18:24:25 +00:00
Showing only changes of commit 9b4b8fdfeb - Show all commits

View File

1
@@ -13,7 +13,7 @@ A heavily customized fork of [Reticulum MeshChat](https://github.com/liamcottle/
- [ ] Multi-identity support. - [ ] Multi-identity support.
- [ ] Multi-language support - [ ] Multi-language support
- [ ] Offline Reticulum documentation tool - [ ] Offline Reticulum documentation tool
- [ ] More tools (translate, LoRa calculator, LXMFy bots, etc) - [ ] More tools (translate, LoRa calculator, LXMFy bots, etc.)
- [x] Codebase reorganization and cleanup. - [x] Codebase reorganization and cleanup.
- [ ] Tests and proper CI/CD pipeline. - [ ] Tests and proper CI/CD pipeline.
- [ ] RNS hot reload - [ ] RNS hot reload
1
@@ -62,5 +62,35 @@ The Electron build artifacts will still live under `dist/` for releases.
## Python packaging ## Python packaging
The backend now provides `pyproject.toml` so you can build/install a wheel with `pip install .` or `python -m build`. Before packaging, run `python3 scripts/sync_version.py` (or `make sync-version`) so the generated `src/version.py` reflects the `package.json` version that the Electron artifacts use. The same version helper drives `meshchat.get_app_version()` and `setup.py`, so the CLI release metadata, wheel and AppImage/NSIS bundles stay aligned. The backend uses Poetry with `pyproject.toml` for dependency management and packaging. Before building, run `python3 scripts/sync_version.py` (or `make sync-version`) to ensure the generated `src/version.py` reflects the version from `package.json` that the Electron artifacts use. This keeps the CLI release metadata, wheel packages, and other bundles aligned.
### Building with Poetry
```bash
# Install dependencies
poetry install
# Build the package
poetry build
# Install locally for testing
pip install dist/*.whl
```
### Building with pip (alternative)
coderabbitai[bot] commented 2025-12-01 17:53:28 +00:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion | 🟠 Major

Inconsistent Python invocation: use python3 consistently.

Line 46 uses python while line 75 uses python3 for the same sync_version.py script. Since Python 3 is standard and line 75 explicitly specifies python3, line 46 should do the same for consistency.

Apply this diff:

 The Python build is driven entirely by Poetry now. Run `python scripts/sync_version.py` or `make sync-version` before packaging so `pyproject.toml` and `src/version.py` match `package.json`. After that:

-python -m poetry install
+python3 scripts/sync_version.py
-make wheel  # produces a wheel in python-dist/ that bundles the public assets
+make wheel

Or more simply, update line 46:

-Run `python scripts/sync_version.py` or `make sync-version` before packaging so `pyproject.toml` and `src/version.py` match `package.json`. After that:
+Run `python3 scripts/sync_version.py` or `make sync-version` before packaging so `pyproject.toml` and `src/version.py` match `package.json`. After that:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

### Python packaging

The Python build is driven entirely by Poetry now. Run `python3 scripts/sync_version.py` or `make sync-version` before packaging so `pyproject.toml` and `src/version.py` match `package.json`. After that:

🤖 Prompt for AI Agents
In README.md around lines 44 to 51, the invocation for the sync_version script
uses `python` while elsewhere (line 75) `python3` is used; update the command on
line 46 to use `python3` (i.e., replace `python scripts/sync_version.py` with
`python3 scripts/sync_version.py`) so the README consistently references Python
3 for running the script.

Addressed in commits 284517b to 3848613

_🛠️ Refactor suggestion_ | _🟠 Major_ **Inconsistent Python invocation: use `python3` consistently.** Line 46 uses `python` while line 75 uses `python3` for the same `sync_version.py` script. Since Python 3 is standard and line 75 explicitly specifies `python3`, line 46 should do the same for consistency. Apply this diff: ```diff The Python build is driven entirely by Poetry now. Run `python scripts/sync_version.py` or `make sync-version` before packaging so `pyproject.toml` and `src/version.py` match `package.json`. After that: -python -m poetry install +python3 scripts/sync_version.py -make wheel # produces a wheel in python-dist/ that bundles the public assets +make wheel ``` Or more simply, update line 46: ```diff -Run `python scripts/sync_version.py` or `make sync-version` before packaging so `pyproject.toml` and `src/version.py` match `package.json`. After that: +Run `python3 scripts/sync_version.py` or `make sync-version` before packaging so `pyproject.toml` and `src/version.py` match `package.json`. After that: ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion ### Python packaging The Python build is driven entirely by Poetry now. Run `python3 scripts/sync_version.py` or `make sync-version` before packaging so `pyproject.toml` and `src/version.py` match `package.json`. After that: ``` </details> <!-- suggestion_end --> <details> <summary>🤖 Prompt for AI Agents</summary> ``` In README.md around lines 44 to 51, the invocation for the sync_version script uses `python` while elsewhere (line 75) `python3` is used; update the command on line 46 to use `python3` (i.e., replace `python scripts/sync_version.py` with `python3 scripts/sync_version.py`) so the README consistently references Python 3 for running the script. ``` </details> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits 284517b to 3848613
If you prefer pip, you can build/install directly:
```bash
# Build the wheel
pip install build
python -m build
# Install locally
pip install .
```
### cx_Freeze (for AppImage/NSIS)
The `cx_setup.py` script uses cx_Freeze for creating standalone executables (AppImage for Linux, NSIS for Windows). This is separate from the Poetry/pip packaging workflow.