Skip to content

Add Flox package build configuration for publishing#2

Merged
billlevine merged 9 commits intomainfrom
package-for-publishing
Feb 5, 2026
Merged

Add Flox package build configuration for publishing#2
billlevine merged 9 commits intomainfrom
package-for-publishing

Conversation

@billlevine
Copy link
Copy Markdown
Collaborator

Summary

This PR reorganizes the project structure and adds build configuration to enable publishing spdx-to-mermaid as a standalone Flox package that can be installed in any environment.

Changes

Project Reorganization

  • Moved Python source to package/ subdirectory - This isolates the Python package from the .flox/ environment directory, preventing symlink issues during package builds
  • Preserved git history - Used git mv to maintain full file history during reorganization

Build Configuration

  • Added [build.spdx-to-mermaid] section to .flox/env/manifest.toml:
    • Builds Python wheel using uv build
    • Bundles all dependencies (spdx-tools, rdflib, etc.)
    • Creates wrapper script with proper PYTHONPATH
    • Only requires python3 as runtime dependency
  • Updated .gitignore to exclude build artifacts while preserving .flox/ directory
  • Updated Justfile to reference the new package/ directory

Package Details

  • Package name: spdx-to-mermaid
  • Version: 0.1.0
  • Runtime dependency: python3 only (all Python deps bundled)
  • Entry point: /bin/spdx-to-mermaid CLI tool

Testing

Build tested successfully:

flox build spdx-to-mermaid
./result-spdx-to-mermaid/bin/spdx-to-mermaid --help

Publishing

After merge, the package can be published with:

flox publish spdx-to-mermaid

Users will then be able to install it:

flox install spdx-to-mermaid
spdx-to-mermaid myfile.spdx.json

Notes

The visualization features (HTTP server, mermaid-cli, chromium) remain in the development environment. The published package is the core CLI tool only, which keeps it lightweight and widely usable.

billlevine and others added 2 commits February 4, 2026 09:37
Reorganize project structure to enable building and publishing
spdx-to-mermaid as a standalone Flox package:

- Move Python source to package/ subdirectory to isolate from
  .flox environment directory
- Add [build.spdx-to-mermaid] section to manifest.toml with build
  commands that create a Python wheel and bundle dependencies
- Update .gitignore to exclude build artifacts while keeping .flox
- Update Justfile to reference package/ directory
- Configure runtime dependency on python3 only

The built package can now be published to Flox Catalog and installed
in any environment with: flox install spdx-to-mermaid

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add a separate spdx-viewer/ environment that can be pushed to FloxHub
for easy sharing with teams:

- New Flox environment in spdx-viewer/ subdirectory
- Installs published spdx-to-mermaid package from catalog
- Includes visualization tools: mermaid-cli, chromium, HTTP server
- Comes with viewer.html, configs, and convenience Justfile
- Lightweight - no build tools or source code
- Can be shared via: flox push

This separates the development environment (build/publish) from
the runtime/visualization environment (consume published package).

Users can pull this environment from FloxHub and immediately start
visualizing SPDX files without needing the full development setup.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@billlevine
Copy link
Copy Markdown
Collaborator Author

Update: Added Viewer Environment

Added a standalone environment that can be shared via FloxHub:

What's New

Standalone Viewer Environment in :

  • Separate Flox environment for visualization only
  • Installs published spdx-to-mermaid package from FloxHub catalog
  • Includes all visualization tools: mermaid-cli, chromium, HTTP server, just
  • Complete with viewer.html, configs, and Justfile with convenience commands
  • Lightweight - no build tools or Python source code

Two Environments

The repository now has two distinct environments:

  1. Development Environment (root): For building and publishing the package
  2. Viewer Environment (spdx-viewer/): For consuming and visualizing SPDX files

Usage After Publishing

Once the package is published:

  1. Uncomment spdx-to-mermaid in spdx-viewer/.flox/env/manifest.toml
  2. Push to FloxHub: flox push
  3. Share with team: flox pull owner/spdx-viewer

This makes it easy for teams to use the visualization tools without needing the full development environment.

Replace Justfile with bash functions defined in manifest profile:

- Remove `just` dependency
- Add bash functions in [profile.common] section:
  - spdx-show: View SPDX file as interactive diagram
  - spdx-svg: Convert to SVG file
  - spdx-serve: Start HTTP server
  - spdx-stop: Stop services
- Install published flox/spdx-to-mermaid package
- Update README with new function-based usage
- Add welcome message on activation

Benefits:
- Fewer dependencies (no just required)
- More portable (works in any bash/zsh shell)
- Self-contained (everything in manifest.toml)
- Better discoverability (shows available commands on activate)

Functions are available when running `flox activate` in interactive mode.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@billlevine
Copy link
Copy Markdown
Collaborator Author

Update: Simplified Viewer Environment

The viewer environment has been simplified based on feedback:

Changes

Removed dependencies:

  • Removed just - no longer needed

Added bash functions in profile:
All visualization commands are now bash functions defined in the [profile.common] section of manifest.toml:

# After flox activate, these functions are available:
spdx-show <file> [options]    # View SPDX as interactive diagram
spdx-svg <file> [out] [opts]  # Convert to SVG file
spdx-serve                     # Start HTTP server
spdx-stop                      # Stop services

Published package installed:

  • Now installs flox/spdx-to-mermaid from the catalog
  • Restricted to x86_64-linux (where it was published)

Benefits

  1. Fewer dependencies - One less package to install
  2. Self-contained - Everything in manifest.toml
  3. Better UX - Shows welcome message with available commands on activation
  4. More portable - Works in bash/zsh without external tools

Usage

cd spdx-viewer
flox activate

# Functions are now available
spdx-show myfile.spdx.json --compact
spdx-svg myfile.spdx.json output.svg

The functions work in interactive shell mode. The environment is now ready to push to FloxHub.

billlevine and others added 2 commits February 4, 2026 10:23
Embed viewer.html, mermaid-config.json, and puppeteer-config.json as
heredocs in the manifest's on-activate hook. Files are written to
$FLOX_ENV_PROJECT on first activation, making the environment fully
self-contained and shareable via FloxHub without external dependencies.

The hook is idempotent - it checks for file existence before writing,
preserving any user modifications on subsequent activations.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add proper error checking to prevent cryptic "UnknownDiagramError" when
spdx-to-mermaid fails or produces no output. The functions now:

- Check if spdx-to-mermaid command succeeds
- Verify the mermaid file has content before processing
- Check if mmdc conversion succeeds
- Display clear error messages for each failure point
- Clean up temp files on error

This helps users diagnose issues when visualization fails instead of
seeing a confusing mermaid-cli error about no diagram type detected.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@billlevine billlevine requested review from devusb and stahnma February 4, 2026 15:40
billlevine and others added 3 commits February 4, 2026 10:46
Show the simplest way to get started with the published FloxHub
environment - just activate from remote and run spdx-show.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Prominently feature the SPDX Viewer environment at the top of the
main README with a quick usage example showing how to activate from
FloxHub and visualize SPDX files.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add CI/CD pipeline that builds and publishes spdx-to-mermaid package to FloxHub on multiple platforms (Ubuntu, macOS). Workflow includes change detection for efficient builds and automatic publishing on main branch pushes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add ubuntu-22.04-arm64 to the CI matrix to build and publish packages
for aarch64-linux architecture alongside existing x86_64-linux and
macOS builds.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@billlevine billlevine merged commit afe10a6 into main Feb 5, 2026
4 of 5 checks passed
@billlevine billlevine deleted the package-for-publishing branch February 5, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants