Skip to main content

wex_addon_services_collab

Version: 11.9.7

This addon extends wex with install and configuration commands for self-hosted collaboration services — Nextcloud, OnlyOffice, Synapse, and Rocket.Chat. Each command writes service defaults (credentials, host, port) into the app config and rebuilds the runtime, giving wex-managed apps a consistent, command-driven setup path for their collaboration stack.

Table of Contents

Installation

pip install wexample-wex-addon-services-collab

Requires Python >=3.10.

Quickstart

Install the package:

pip install wexample-wex-addon-services-collab

Register ServicesCollabAddonManager when you set up your wex kernel:

from pathlib import Path

from wexample_wex_core.addons.core.core_addon_manager import CoreAddonManager
from wexample_wex_core.common.kernel import Kernel
from wexample_wex_addon_services_collab import ServicesCollabAddonManager

kernel = Kernel(entrypoint_path=Path(".wex"))
kernel.setup(addons=[CoreAddonManager, ServicesCollabAddonManager])

Once the kernel is set up, three service commands are available in any wex app that declares a matching service:

Command Effect
@nextcloud::service/install Writes admin.user and a random admin.password into the app config and rebuilds the runtime
@synapse::service/install Writes host and port (8008) into the app config and rebuilds the runtime
@synapse::service/ready Curls http://localhost:8008/health inside the Synapse container and returns a boolean

These commands are of type service: they resolve against the active app's services and are invoked inside a wex-managed app, not standalone.

Tests

This project uses pytest for testing and pytest-cov for code coverage analysis.

Installation

First, install the required testing dependencies:

.venv/bin/python -m pip install pytest pytest-cov

Basic Usage

Run all tests with coverage:

.venv/bin/python -m pytest --cov --cov-report=html

Common Commands

# Run tests with coverage for a specific module
.venv/bin/python -m pytest --cov=your_module

# Show which lines are not covered
.venv/bin/python -m pytest --cov=your_module --cov-report=term-missing

# Generate an HTML coverage report
.venv/bin/python -m pytest --cov=your_module --cov-report=html

# Combine terminal and HTML reports
.venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html

# Run specific test file with coverage
.venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing

Viewing HTML Reports

After generating an HTML report, open htmlcov/index.html in your browser to view detailed line-by-line coverage information.

Coverage Threshold

To enforce a minimum coverage percentage:

.venv/bin/python -m pytest --cov=your_module --cov-fail-under=80

This will cause the test suite to fail if coverage drops below 80%.

Architecture

The addon is a single Python package (wexample_wex_addon_services_collab) that plugs into a wex kernel. It owns three things: an addon manager that tells the framework where to look, a constants module that names its domain tags, and a set of service sub-packages — one per collaboration service — each containing commands and, where needed, a service class.

Entry point

src/wexample_wex_addon_services_collab/services_collab_addon_manager.py is the only object the outside world imports. ServicesCollabAddonManager extends AbstractAddonManager from wexample_wex_core and implements one method:

@classmethod
def get_package_module(cls) -> Any:
    import wexample_wex_addon_services_collab
    return wexample_wex_addon_services_collab

The framework calls get_package_module() during kernel setup and scans the returned package for every function decorated with @command. No explicit registration is needed for individual commands.

Domain tags

src/wexample_wex_addon_services_collab/const/tags.py declares DomainTag.COLLAB ("domain:collab") and DomainTag.SERVICE ("domain:service"). Every command in the addon tags itself with both, alongside the standard wexample_cli tags (EffectTag, AudienceTag, ScopeTag) that the framework uses for filtering and safety checks.

Service sub-packages

Under src/wexample_wex_addon_services_collab/services/ there is one sub-package per supported service. Nextcloud and Synapse have commands; OnlyOffice and Rocket.Chat have namespace packages only (empty __init__.py).

Nextcloud

src/wexample_wex_addon_services_collab/services/nextcloud/commands/service/install.py — nextcloud__service__install writes admin.user (fixed as "admin") and a random admin.password into the app config, then rebuilds the runtime:

config.set_by_path(f"service.{service_name}.admin.user", "admin")
config.set_by_path(f"service.{service_name}.admin.password", string_random_token())
config_file.write_config(config)
service.app_workdir.get_runtime_config(rebuild=True)

Synapse

src/wexample_wex_addon_services_collab/services/synapse/commands/service/install.py — synapse__service__install derives the Docker hostname from the app name and writes host and port (8008) into the app config:

config.set_by_path(f"{svc_prefix}.host", f"{app_name}_{svc_name}")
config.set_by_path(f"{svc_prefix}.port", 8008)

src/wexample_wex_addon_services_collab/services/synapse/commands/service/ready.py — synapse__service__ready checks liveness by running curl -sf http://localhost:8008/health inside the service's Docker container and returns a BooleanResponse:

result = subprocess.run(
    ["docker", "exec", container_name, "curl", "-sf", "http://localhost:8008/health"],
    stdout=subprocess.DEVNULL,
    stderr=subprocess.DEVNULL,
)
return BooleanResponse(kernel=context.kernel, content=result.returncode == 0)

src/wexample_wex_addon_services_collab/services/synapse/app_service.py is not a command — it is a service class that overrides get_workdir_contribution() to declare the synapse/data/ directory with owner 991:991 and permissions 755. The framework calls this method when building the app workdir tree, so the correct ownership is applied before the container starts.

Call path through a command

  1. The caller invokes a service command (e.g., @nextcloud::service/install).
  2. The framework resolves the command function discovered from the package and injects ExecutionContext and the matching AppService.
  3. The command reads the current app config via service.app_workdir.get_config_file().read_config().
  4. It mutates the config with config.set_by_path(...) and writes it back.
  5. It calls app_workdir.get_runtime_config(rebuild=True) so the live runtime reflects the change.
  6. It logs a confirmation through context.io.log(...).

The ready command skips config mutation and instead shells out to Docker, returning a typed boolean rather than logging.

Integration in the Suite

This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.

The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.

Visit the Wexample Suite documentation for the complete package ecosystem.

Dependencies

  • wexample-wex-addon-app: >=32.4.0
  • wexample-wex-core: >=31.1.0

Versioning & Compatibility Policy

Wexample packages follow Semantic Versioning (SemVer):

  • MAJOR: Breaking changes
  • MINOR: New features, backward compatible
  • PATCH: Bug fixes, backward compatible

We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Free to use in both personal and commercial projects.

About us

Wexample stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.

This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.

Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.

Known Limitations & Roadmap

Current limitations and planned features are tracked in the GitHub issues.

See the project roadmap for upcoming features and improvements.

Status & Compatibility

Maturity: Production-ready

Python Support: >=3.10

OS Support: Linux, macOS, Windows

Status: Actively maintained

Migration Notes

When upgrading between major versions, refer to the migration guides in the documentation.

Breaking changes are clearly documented with upgrade paths and examples.

Metadata

Release files for wexample-wex-addon-services-collab 11.9.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wexample-wex-addon-services-collab 11.9.7
File Size Uploaded
wexample_wex_addon_services_collab-11.9.7.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wexample-wex-addon-services-collab 11.9.7
File Interpreter ABI Platform
wexample_wex_addon_services_collab-11.9.7-py3-none-any.whl Python 3 none any Details

Total release size: 36.1 kB

Release files / wexample_wex_addon_services_collab-11.9.7.tar.gz

Download URL wexample_wex_addon_services_collab-11.9.7.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
49fc61fccf0a3f227d03bc93bc4aed797f80ae3b8d674aac9bdfbc4f81b5d4d4
BLAKE2b-256 checksum
How to use checksums
83a695116c35da0314cce4ac6158dea7071adde44e6b2e33f41370d9e38a4992
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.25.9 CPython/3.12.3 Linux/6.8.0-139-generic

Release files / wexample_wex_addon_services_collab-11.9.7-py3-none-any.whl

Download URL wexample_wex_addon_services_collab-11.9.7-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
075dc72f12543e84767087fb60753d69bc98bc630f1313de3582cd72f11b4942
BLAKE2b-256 checksum
How to use checksums
29cab1422fb922202a154a13142a158cd3c4d7e7419afb49907abc108ea1d45b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.25.9 CPython/3.12.3 Linux/6.8.0-139-generic

Release history Release notifications | RSS feed

11.9.9

2 release files

11.9.8

2 release files

This release

11.9.7 This release

2 release files

11.9.3

2 release files

11.9.2

2 release files

11.9.1

2 release files

11.8.4

2 release files

11.8.3

2 release files

11.8.2

2 release files

11.7.3

2 release files

11.7.2

2 release files

11.7.1

2 release files

11.7.0

2 release files

11.6.6

2 release files

11.6.5

2 release files

11.6.4

2 release files

11.6.3

2 release files

11.6.2

2 release files

11.6.1

2 release files

11.6.0

2 release files

11.4.9

2 release files

11.4.8

2 release files

11.4.7

2 release files

11.4.6

2 release files

11.4.5

2 release files

11.4.4

2 release files

11.4.3

2 release files

11.4.2

2 release files

11.4.1

2 release files

11.4.0

2 release files

11.3.0

2 release files

11.2.2

2 release files

11.2.0

2 release files

11.1.1

2 release files

11.1.0

2 release files

11.0.1

2 release files

11.0.0

2 release files

10.0.3

2 release files

10.0.2

2 release files

10.0.1

2 release files

10.0.0

2 release files

9.1.3

2 release files

9.1.2

2 release files

9.1.1

2 release files

9.1.0

2 release files

9.0.1

2 release files

9.0.0

2 release files

8.0.0

2 release files

7.0.10

2 release files

7.0.9

2 release files

7.0.8

2 release files

7.0.7

2 release files

7.0.6

2 release files

7.0.5

2 release files

7.0.4

2 release files

7.0.3

2 release files

7.0.2

2 release files

7.0.1

2 release files

7.0.0

2 release files

1.0.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page