shinyhub 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,23 @@
1
+ .superpowers/
2
+ docs/superpowers/
3
+ go.work
4
+ go.work.sum
5
+ bin/
6
+ tmp/
7
+ .worktrees/
8
+ CLAUDE.md
9
+ CLAUDE.local.md
10
+
11
+ # Runtime artifacts created when running the server from a checkout
12
+ # (default config writes the SQLite DB and per-app data under ./data).
13
+ /data/
14
+ *.db
15
+ *.db-shm
16
+ *.db-wal
17
+
18
+ # PyPI wheel build artifacts
19
+ /packaging/python/src/shinyhub/_binary/shinyhub
20
+ /packaging/python/dist/
21
+ /packaging/python/build/
22
+ /packaging/python/src/shinyhub.egg-info/
23
+ /packaging/python/__pycache__/
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.4
2
+ Name: shinyhub
3
+ Version: 0.2.4
4
+ Summary: Self-hosted platform for deploying and managing Shiny apps.
5
+ Project-URL: Homepage, https://github.com/rvben/shinyhub
6
+ Project-URL: Repository, https://github.com/rvben/shinyhub
7
+ Project-URL: Issues, https://github.com/rvben/shinyhub/issues
8
+ Author-email: "Ruben J. Jongejan" <ruben.jongejan@gmail.com>
9
+ License-Expression: MIT
10
+ Keywords: deployment,posit,shiny,shinyhub
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+
22
+ # shinyhub
23
+
24
+ Python distribution of the [ShinyHub](https://github.com/rvben/shinyhub) CLI.
25
+
26
+ ShinyHub is a self-hosted platform for deploying and managing Shiny apps
27
+ (Python or R). This package bundles the `shinyhub` Go binary so Python
28
+ users can install it with `pip` or `uv`:
29
+
30
+ ```bash
31
+ uv tool install shinyhub
32
+ # or:
33
+ pip install shinyhub
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```bash
39
+ shinyhub --help # list subcommands
40
+ shinyhub serve # run the server
41
+ shinyhub login --host https://... # authenticate against a server
42
+ shinyhub deploy ./my-app --slug demo # deploy an app
43
+ ```
44
+
45
+ See [the project README](https://github.com/rvben/shinyhub) for full
46
+ documentation, server configuration, and Docker usage.
47
+
48
+ ## Supported platforms
49
+
50
+ Prebuilt binaries ship for:
51
+
52
+ - Linux (amd64, arm64)
53
+ - macOS (amd64, arm64)
54
+
55
+ For other platforms, use the Docker image
56
+ (`ghcr.io/rvben/shinyhub:latest`) or
57
+ [build from source](https://github.com/rvben/shinyhub#from-source).
@@ -0,0 +1,36 @@
1
+ # shinyhub
2
+
3
+ Python distribution of the [ShinyHub](https://github.com/rvben/shinyhub) CLI.
4
+
5
+ ShinyHub is a self-hosted platform for deploying and managing Shiny apps
6
+ (Python or R). This package bundles the `shinyhub` Go binary so Python
7
+ users can install it with `pip` or `uv`:
8
+
9
+ ```bash
10
+ uv tool install shinyhub
11
+ # or:
12
+ pip install shinyhub
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ shinyhub --help # list subcommands
19
+ shinyhub serve # run the server
20
+ shinyhub login --host https://... # authenticate against a server
21
+ shinyhub deploy ./my-app --slug demo # deploy an app
22
+ ```
23
+
24
+ See [the project README](https://github.com/rvben/shinyhub) for full
25
+ documentation, server configuration, and Docker usage.
26
+
27
+ ## Supported platforms
28
+
29
+ Prebuilt binaries ship for:
30
+
31
+ - Linux (amd64, arm64)
32
+ - macOS (amd64, arm64)
33
+
34
+ For other platforms, use the Docker image
35
+ (`ghcr.io/rvben/shinyhub:latest`) or
36
+ [build from source](https://github.com/rvben/shinyhub#from-source).
@@ -0,0 +1,68 @@
1
+ """Hatchling hooks for the shinyhub wheel.
2
+
3
+ CI exports two env vars before invoking ``python -m build``:
4
+
5
+ * ``SHINYHUB_WHEEL_VERSION`` — the Git tag without the leading ``v``
6
+ (e.g. ``0.3.0``). ``VersionHook`` writes it into the project metadata.
7
+ * ``SHINYHUB_WHEEL_PLATFORM`` — the wheel platform tag for this matrix
8
+ entry (e.g. ``manylinux_2_17_x86_64``). ``PlatformTagHook`` writes it
9
+ into the wheel's build-data.
10
+
11
+ Local sanity builds without either env var get sensible defaults so the
12
+ build does not blow up; those wheels are only ever used for smoke tests.
13
+
14
+ When pip falls back to building a wheel from the sdist (because no
15
+ matching binary wheel exists for the user's platform), ``PlatformTagHook``
16
+ raises a ``RuntimeError`` with a clear explanation — see the
17
+ binary-existence check in ``initialize``.
18
+ """
19
+ import os
20
+
21
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
22
+ from hatchling.metadata.plugin.interface import MetadataHookInterface
23
+
24
+
25
+ UNSUPPORTED_PLATFORM_MESSAGE = """\
26
+ shinyhub does not ship a prebuilt binary for your platform.
27
+ Supported: linux/amd64, linux/arm64, darwin/amd64, darwin/arm64.
28
+
29
+ For other platforms:
30
+ - Use the Docker image: ghcr.io/rvben/shinyhub:latest
31
+ - Or build from source: https://github.com/rvben/shinyhub#from-source
32
+ """
33
+
34
+
35
+ class VersionHook(MetadataHookInterface):
36
+ """Sources the package version from SHINYHUB_WHEEL_VERSION."""
37
+
38
+ PLUGIN_NAME = "custom"
39
+
40
+ def update(self, metadata: dict) -> None:
41
+ metadata["version"] = os.environ.get(
42
+ "SHINYHUB_WHEEL_VERSION", "0.0.0+local"
43
+ )
44
+
45
+
46
+ class PlatformTagHook(BuildHookInterface):
47
+ """Includes the Go binary and sets the wheel's platform tag.
48
+
49
+ Runs for the wheel target only; sdist builds skip this hook, so
50
+ publishing an sdist does not require the binary to be present.
51
+ """
52
+
53
+ PLUGIN_NAME = "custom"
54
+
55
+ def initialize(self, version: str, build_data: dict) -> None:
56
+ binary = os.path.join(self.root, "src", "shinyhub", "_binary", "shinyhub")
57
+ if not os.path.isfile(binary):
58
+ raise RuntimeError(UNSUPPORTED_PLATFORM_MESSAGE)
59
+
60
+ build_data["force_include"][binary] = "shinyhub/_binary/shinyhub"
61
+
62
+ platform = os.environ.get("SHINYHUB_WHEEL_PLATFORM")
63
+ if not platform:
64
+ # Local sanity builds: let hatchling assign a default. CI always
65
+ # sets this, so the production path never hits this branch.
66
+ return
67
+ build_data["tag"] = f"py3-none-{platform}"
68
+ build_data["pure_python"] = False
@@ -0,0 +1,61 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "shinyhub"
7
+ dynamic = ["version"]
8
+ description = "Self-hosted platform for deploying and managing Shiny apps."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "Ruben J. Jongejan", email = "ruben.jongejan@gmail.com" },
14
+ ]
15
+ keywords = ["shiny", "shinyhub", "deployment", "posit"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: MacOS",
22
+ "Operating System :: POSIX :: Linux",
23
+ "Programming Language :: Python :: 3",
24
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/rvben/shinyhub"
29
+ Repository = "https://github.com/rvben/shinyhub"
30
+ Issues = "https://github.com/rvben/shinyhub/issues"
31
+
32
+ [project.scripts]
33
+ shinyhub = "shinyhub.__main__:main"
34
+
35
+ # Metadata hook computes the dynamic version from SHINYHUB_WHEEL_VERSION.
36
+ [tool.hatch.metadata.hooks.custom]
37
+ path = "hatch_build.py"
38
+
39
+ [tool.hatch.build.targets.wheel]
40
+ packages = ["src/shinyhub"]
41
+
42
+ # Build hook owns binary inclusion + platform tag. It raises when the
43
+ # binary is absent, which is what pip sees when falling back to sdist
44
+ # on an unsupported platform.
45
+ [tool.hatch.build.targets.wheel.hooks.custom]
46
+ path = "hatch_build.py"
47
+
48
+ [tool.hatch.build.targets.sdist]
49
+ include = [
50
+ "src/shinyhub",
51
+ "pyproject.toml",
52
+ "hatch_build.py",
53
+ "README.md",
54
+ ]
55
+ # The binary is wheel-only. Keeping it out of the sdist is what makes
56
+ # the sdist a usable stub: pip falls back to building a wheel from it
57
+ # on unsupported platforms, the wheel build detects the missing binary,
58
+ # and the build fails with a clear error.
59
+ exclude = [
60
+ "src/shinyhub/_binary/shinyhub",
61
+ ]
@@ -0,0 +1,14 @@
1
+ """ShinyHub — deploy and manage Shiny apps.
2
+
3
+ This Python package is a distribution vehicle for the ``shinyhub`` CLI.
4
+ It does not expose a stable Python API; use the ``shinyhub`` command.
5
+ """
6
+
7
+ from importlib.metadata import PackageNotFoundError, version as _pkg_version
8
+
9
+ try:
10
+ __version__ = _pkg_version("shinyhub")
11
+ except PackageNotFoundError:
12
+ __version__ = "0.0.0+unknown"
13
+
14
+ __all__ = ["__version__"]
@@ -0,0 +1,27 @@
1
+ """Entry point for the ``shinyhub`` console script.
2
+
3
+ We locate the embedded Go binary inside the installed package data and
4
+ ``os.execv`` to replace this Python process with it. Process replacement
5
+ (rather than ``subprocess.run``) preserves signal handling, exit codes,
6
+ stdio, and $0, so ``shinyhub`` behaves indistinguishably from the native
7
+ binary for every caller.
8
+ """
9
+ import os
10
+ import sys
11
+ from importlib.resources import files
12
+
13
+
14
+ def main() -> None:
15
+ binary = files("shinyhub") / "_binary" / "shinyhub"
16
+ if not binary.is_file():
17
+ sys.stderr.write(
18
+ "shinyhub: embedded binary not found at "
19
+ f"{binary}. This wheel is broken; please report it at "
20
+ "https://github.com/rvben/shinyhub/issues.\n"
21
+ )
22
+ sys.exit(1)
23
+ os.execv(str(binary), ["shinyhub", *sys.argv[1:]])
24
+
25
+
26
+ if __name__ == "__main__":
27
+ main()
File without changes