ReMe/scripts/package_studio.py
jinliyl ef3f99f019
refactor(packaging): reorganize published packages (#495)
* refactor(packaging): reorganize published packages

* fix(packaging): install AgentScope extra in wheel smoke

* docs: align package guides and documentation site

* ci(workflow): add core dependency verification step in Python package build

- Add a workflow step to verify released core dependencies by installing the wheel with core extras
- Assert the presence of the static index.html file to ensure proper package contents
- Create and use a temporary virtual environment for isolation during verification
- Keep existing artifacts upload step intact and conditional on inputs.upload_artifacts flag

* fix(ci): update package installation dependencies in Windows workflow

- Change pip install from editable reme_studio and core to only dev and as extras
- Remove installation of reme_studio and core to streamline dependency setup
- Ensure Windows CI uses the correct extras for testing environment

* fix(tests): add missing commas in toml file reads in package version tests

- Added trailing commas in the tomllib.loads calls for auto-fin and daily_paper configs
- Ensured consistent syntax to prevent potential tuple misinterpretation
- Improved readability and correctness of the test setup code

* fix(packaging): protect qwenpaw releases and test Studio health
2026-08-27 14:02:09 +08:00

35 lines
1.1 KiB
Python

"""Stage the ReMe Studio static build for its Python distribution."""
from __future__ import annotations
import shutil
from pathlib import Path
REPOSITORY_DIR = Path(__file__).resolve().parents[1]
STUDIO_DIR = REPOSITORY_DIR / "reme_studio"
STATIC_DIR = STUDIO_DIR / "src" / "reme_studio" / "static"
LICENSE_FILE = REPOSITORY_DIR / "LICENSE"
STATIC_GITIGNORE = "*\n!.gitignore\n"
def prepare_package() -> None:
"""Copy generated assets into the importable Python package."""
shutil.copyfile(LICENSE_FILE, STUDIO_DIR / "LICENSE")
source = STUDIO_DIR / "dist-static"
if not (source / "index.html").is_file():
raise FileNotFoundError(f"Studio static build is unavailable: {source}")
try:
shutil.rmtree(STATIC_DIR, ignore_errors=True)
shutil.copytree(source, STATIC_DIR)
finally:
STATIC_DIR.mkdir(parents=True, exist_ok=True)
(STATIC_DIR / ".gitignore").write_text(STATIC_GITIGNORE, encoding="utf-8")
def main() -> None:
"""Run the package preparation command."""
prepare_package()
if __name__ == "__main__":
main()