Registry / web-framework / ledoc-ui

ledoc-ui

JSON →
library0.1.0pypiunverified

ledoc-ui is a Python package that bundles static files for the 'livedoc' user interface. It acts as a convenient way to distribute the HTML, CSS, and JavaScript assets of the 'livedoc' UI, which is designed to display API documentation (often generated by frameworks like Spring). The package itself does not contain Python logic for UI generation or interaction but rather provides the front-end resources for a web application to serve. The current version is 0.1.0, and its release cadence appears irregular based on its minimal activity.

pip install ledoc-ui
INSTALL
IMPORT
SIG · LEDOC-UI
L
ledoc-ui
web-frameworkenv0.1.0
Install
1.8s avg
Import
488ms
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.317s · 27.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.8s · import 0.269s · 28MB
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

static_folder_path
import os; import pkg_resources; static_folder_path = pkg_resources.resource_filename('ledoc_ui', 'static')
ledoc-ui primarily provides static web assets; direct Python imports for UI components or functions are not applicable. Instead, you import standard Python modules to locate and serve its static files.

This quickstart demonstrates how to serve the static web assets provided by `ledoc-ui` using the Flask web framework. The key is to locate the `static` directory within the installed `ledoc_ui` package and configure your web server to serve files from there. This example provides two routes: one for the main `index.html` and a catch-all for other static assets. Users would then navigate to the Flask application's root URL to access the `livedoc` UI in their browser.

import os from flask import Flask, send_from_directory import pkg_resources app = Flask(__name__) # Get the path to the static files bundled with ledoc-ui try: LEDOCO_UI_STATIC_PATH = pkg_resources.resource_filename('ledoc_ui', 'static') except ImportError: # Fallback if pkg_resources isn't ideal or if the structure changes # This assumes 'ledoc_ui' is installed in site-packages and 'static' is a direct subdir. # A more robust solution might involve __file__ and os.path.dirname logic if pkg_resources fails. print("Warning: pkg_resources failed. Attempting fallback for ledoc-ui static path.") LEDOCO_UI_STATIC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'env', 'lib', 'pythonX.Y', 'site-packages', 'ledoc_ui', 'static') # Replace 'pythonX.Y' with your actual Python version or adjust path as needed @app.route('/') def index(): # Serve the main index.html from ledoc-ui's static folder return send_from_directory(LEDOCO_UI_STATIC_PATH, 'index.html') @app.route('/<path:filename>') def serve_static(filename): # Serve other static files (CSS, JS, images) from ledoc-ui's static folder return send_from_directory(LEDOCO_UI_STATIC_PATH, filename) if __name__ == '__main__': print(f"Serving ledoc-ui static files from: {LEDOCO_UI_STATIC_PATH}") app.run(debug=True)
Debug
Known issues
gotchaledoc-ui is purely a bundle of static web assets. It does not provide Python APIs for UI generation, component interaction, or documentation processing within Python code itself. Its utility is in providing front-end files to be served by a web server.
fix
Do not expect to import classes or functions directly from `ledoc_ui` to build a UI programmatically in Python. Instead, treat it as a resource folder for your web application.
affects: 0.1.0
gotchaLocating the static files correctly within the installed Python package can sometimes be tricky due to varying installation paths in different environments (virtual environments, Docker, etc.).
fix
Use `pkg_resources.resource_filename('ledoc_ui', 'static')` (as shown in the quickstart) for a robust way to find the static directory. Avoid hardcoding paths or relying solely on `__file__` based relative paths, as they can break once the package is installed.
affects: 0.1.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ledoc_ui.SomeClass'
Attempting to import a Python class or module that does not exist within the `ledoc_ui` package. The package is designed to provide static assets, not Python-executable code for UI construction.
fix
Do not try to import Python classes or functions from `ledoc_ui`. Instead, use `pkg_resources.resource_filename` to locate its static files and serve them via a web framework.
404 Not Found (for CSS/JS files after loading index.html)
The web server (e.g., Flask, Django) is not correctly configured to serve the additional static assets (CSS, JavaScript, images) from the `ledoc-ui` package, or the paths in `index.html` do not match how the files are being served.
fix
Ensure your web framework's static file serving routes are configured to cover all files within the `ledoc_ui/static` directory, not just `index.html`. Verify that the paths requested by the browser (seen in network tab) match the paths your server is exposing.
Upgrade
Version history
0.1.0latest on PyPI · released Sep 2, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources

No resource links recorded.

ledoc-ui — pip install ledoc-ui · libregistry