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
4 changed files with 15 additions and 14 deletions
Showing only changes of commit f8b0dd18c5 - Show all commits

View File

@@ -45,4 +45,3 @@ setup(
}, },
}, },
) )

View File

@@ -1116,7 +1116,11 @@ class ReticulumMeshChat:
interfaces[interface_name] = interface_details interfaces[interface_name] = interface_details
# handle SerialInterface, KISSInterface, and AX25KISSInterface # handle SerialInterface, KISSInterface, and AX25KISSInterface
if interface_type in ("SerialInterface", "KISSInterface", "AX25KISSInterface"): if interface_type in (
"SerialInterface",
"KISSInterface",
"AX25KISSInterface",
):
# ensure port provided # ensure port provided
interface_port = data.get("port") interface_port = data.get("port")
if interface_port is None or interface_port == "": if interface_port is None or interface_port == "":
@@ -5051,8 +5055,8 @@ class NomadnetDownloader:
self.path = path self.path = path
self.data = data self.data = data
self.timeout = timeout self.timeout = timeout
self.on_download_success = on_download_success self._download_success_callback = on_download_success
self.on_download_failure = on_download_failure self._download_failure_callback = on_download_failure
self.on_progress_update = on_progress_update self.on_progress_update = on_progress_update
self.request_receipt = None self.request_receipt = None
self.is_cancelled = False self.is_cancelled = False
@@ -5077,7 +5081,7 @@ class NomadnetDownloader:
pass pass
# notify that download was cancelled # notify that download was cancelled
self.on_download_failure("cancelled") self._download_failure_callback("cancelled")
# setup link to destination and request download # setup link to destination and request download
async def download( async def download(
@@ -5117,7 +5121,7 @@ class NomadnetDownloader:
# if we still don't have a path, we can't establish a link, so bail out # if we still don't have a path, we can't establish a link, so bail out
if not RNS.Transport.has_path(self.destination_hash): if not RNS.Transport.has_path(self.destination_hash):
self.on_download_failure("Could not find path to destination.") self._download_failure_callback("Could not find path to destination.")
return return
# check if cancelled before establishing link # check if cancelled before establishing link
@@ -5153,7 +5157,7 @@ class NomadnetDownloader:
# if we still haven't established a link, bail out # if we still haven't established a link, bail out
if link.status is not RNS.Link.ACTIVE: if link.status is not RNS.Link.ACTIVE:
self.on_download_failure("Could not establish link to destination.") self._download_failure_callback("Could not establish link to destination.")
# link to destination was established, we should now request the download # link to destination was established, we should now request the download
def link_established(self, link): def link_established(self, link):
@@ -5176,11 +5180,11 @@ class NomadnetDownloader:
# handle successful download # handle successful download
def on_response(self, request_receipt: RNS.RequestReceipt): def on_response(self, request_receipt: RNS.RequestReceipt):
self.on_download_success(request_receipt) self._download_success_callback(request_receipt)
# handle failure # handle failure
def on_failed(self, request_receipt=None): def on_failed(self, request_receipt=None):
self.on_download_failure("request_failed") self._download_failure_callback("request_failed")
# handle download progress # handle download progress
def on_progress(self, request_receipt): def on_progress(self, request_receipt):

View File

@@ -1,6 +1,5 @@
""" """Auto-generated helper so Python tooling and the Electron build
Auto-generated helper so Python tooling and the Electron build
share the same version string. share the same version string.
""" """
__version__ = '2.41.0' __version__ = "2.41.0"

View File

@@ -1,5 +1,5 @@
from pathlib import Path
import shutil import shutil
coderabbitai[bot] commented 2025-12-01 06:13:58 +00:00 (Migrated from github.com)
Review

⚠️ Potential issue | 🟡 Minor

Make the file executable or remove the shebang.

The shebang is present but the file is not executable.

Based on static analysis hints, run:

chmod +x scripts/prepare_frontend_dir.py

Or remove the shebang if the script is only intended to be invoked via python scripts/prepare_frontend_dir.py.

🧰 Tools
🪛 Ruff (0.14.6)

1-1: Shebang is present but file is not executable

(EXE001)

🤖 Prompt for AI Agents
In scripts/prepare_frontend_dir.py around line 1, the file contains a shebang
but is not executable; either make the file executable by running chmod +x
scripts/prepare_frontend_dir.py so it can be run directly, or remove the shebang
line if you intend to always invoke it via the python interpreter (e.g., python
scripts/prepare_frontend_dir.py); apply one of these two changes and update any
relevant documentation/CI that assumes direct execution.

Addressed in commits ac839df to c98131f

_⚠️ Potential issue_ | _🟡 Minor_ **Make the file executable or remove the shebang.** The shebang is present but the file is not executable. Based on static analysis hints, run: ```shell chmod +x scripts/prepare_frontend_dir.py ``` Or remove the shebang if the script is only intended to be invoked via `python scripts/prepare_frontend_dir.py`. <details> <summary>🧰 Tools</summary> <details> <summary>🪛 Ruff (0.14.6)</summary> 1-1: Shebang is present but file is not executable (EXE001) </details> </details> <details> <summary>🤖 Prompt for AI Agents</summary> ``` In scripts/prepare_frontend_dir.py around line 1, the file contains a shebang but is not executable; either make the file executable by running chmod +x scripts/prepare_frontend_dir.py so it can be run directly, or remove the shebang line if you intend to always invoke it via the python interpreter (e.g., python scripts/prepare_frontend_dir.py); apply one of these two changes and update any relevant documentation/CI that assumes direct execution. ``` </details> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits ac839df to c98131f
coderabbitai[bot] commented 2025-12-01 06:13:58 +00:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion | 🟠 Major

Add safety checks before removing the directory.

The script unconditionally removes the target directory without validation. If the TARGET path is misconfigured or if there's a symlink, this could lead to unintended data loss.

Consider adding basic safety checks:

+# Sanity check: ensure we're in the project root
+if not Path("pyproject.toml").exists():
+    raise RuntimeError("Must run from project root")
+
 if TARGET.exists():
+    # Additional safety: verify it's a directory, not a symlink
+    if TARGET.is_symlink():
+        raise RuntimeError(f"{TARGET} is a symlink, refusing to remove")
     shutil.rmtree(TARGET)

Addressed in commits ac839df to c98131f

_🛠️ Refactor suggestion_ | _🟠 Major_ **Add safety checks before removing the directory.** The script unconditionally removes the target directory without validation. If the `TARGET` path is misconfigured or if there's a symlink, this could lead to unintended data loss. Consider adding basic safety checks: ```diff +# Sanity check: ensure we're in the project root +if not Path("pyproject.toml").exists(): + raise RuntimeError("Must run from project root") + if TARGET.exists(): + # Additional safety: verify it's a directory, not a symlink + if TARGET.is_symlink(): + raise RuntimeError(f"{TARGET} is a symlink, refusing to remove") shutil.rmtree(TARGET) ``` <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits ac839df to c98131f
from pathlib import Path
TARGET = Path("meshchatx") / "public" TARGET = Path("meshchatx") / "public"
@@ -12,4 +12,3 @@ if TARGET.exists():
shutil.rmtree(TARGET) shutil.rmtree(TARGET)
TARGET.mkdir(parents=True, exist_ok=True) TARGET.mkdir(parents=True, exist_ok=True)
2