Metadata-Version: 2.4
Name: bsm-frontend
Version: 1.4.0b3
Summary: The React frontend for Bedrock Server Manager, packaged as a Python library.
Author-email: DMedina559 <dmedina559-github@outlook.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/dmedina559/bsm-frontend.git
Project-URL: Bug Tracker, https://github.com/DMedina559/bsm-frontend/issues
Project-URL: Changelog, https://bedrock-server-manager.readthedocs.io/en/latest/changelog.html
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest<9.3,>=8.4.0; extra == "dev"
Requires-Dist: pre-commit<5.0,>=4.5.0; extra == "dev"
Dynamic: license-file

# BSM frontend Python distribution

This package delivers compiled BSM web assets to the Python backend. It exports
`bsm_frontend.get_static_dir()`, which returns the installed asset directory as a
`pathlib.Path`.

## Install a published release

```sh
python -m pip install bsm-frontend
```

```python
from bsm_frontend import get_static_dir

static_files = get_static_dir()
```

Installing a wheel does not require Node.js. The package supplies assets; it does
not start the BSM backend or a web server.

## Build from a checkout

Use Node.js 22.12 or later and Python 3.11 or later. From the repository root,
using the Python environment intended for packaging:

```sh
python -m pip install build
npm ci
npm run build:python
```

The build creates `frontend/dist/`, copies it into
`python/src/bsm_frontend/static/`, and builds the wheel and source archive under
`python/dist/`. Generated outputs are not committed. Each packaging run replaces
the copied assets and previous distribution output.

Set `PYTHON` to select a different Python executable. In PowerShell, for example:

```powershell
$env:PYTHON = "C:\Path\To\python.exe"
npm run build:python
```

`python/build.sh` is a Bash compatibility wrapper that installs npm dependencies
and runs the same build. npm commands are the primary cross-platform interface.
The generated source archive includes compiled assets; from an extracted archive,
`python -m build` can build a wheel without Node.js.

## Install a local build

After a successful repository build, use the wheel under `python/dist/`.

PowerShell:

```powershell
python -m pip install --force-reinstall (Get-ChildItem python/dist/*.whl).FullName
```

Bash:

```sh
python -m pip install --force-reinstall python/dist/*.whl
```

Restart the backend after replacing its installed frontend distribution.

## Tests

From the repository root, in a Python development environment:

```sh
python -m pip install --editable "./python[dev]"
python -m pytest -c python/pyproject.toml python/tests
```

The wrapper tests check its Python API. CI additionally builds the distributions,
checks their metadata, installs the wheel, and verifies the bundled HTML,
JavaScript, manifest, and panorama assets.

Flake8 configuration is in `python/.flake8`. Run Flake8 from `python/` or select
that configuration explicitly when invoking it from another directory.

## Releases

Publish a GitHub release tagged `1.4.0` or `1.4.0b1`. The coordinated
workflow publishes all four npm packages and this Python distribution only after
shared validation passes. npm uses `1.4.0-beta.1`; Python uses the equivalent
`1.4.0b1`. Both frontend archives contain the same compiled web assets.

Version discovery still recognizes historical frontend and unprefixed tags in
the parent repository and ignores former SDK-only tags. New publications require
a unified unprefixed version tag. The workflow uses the existing `release` environment
and PyPI trusted publisher; retries skip files already published.
See the [workspace release guide](https://github.com/DMedina559/bsm-frontend#releases)
for the full release process and npm trusted publishing setup.
