{"id":14664,"library":"ledoc-ui","title":"ledoc-ui","description":"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.","status":"active","version":"0.1.0","language":"en","source_language":"en","source_url":"https://pypi.org/project/ledoc-ui/","tags":["documentation","ui","static-files","web","flask"],"install":[{"cmd":"pip install ledoc-ui","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"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.","symbol":"static_folder_path","correct":"import os; import pkg_resources; static_folder_path = pkg_resources.resource_filename('ledoc_ui', 'static')"}],"quickstart":{"code":"import os\nfrom flask import Flask, send_from_directory\nimport pkg_resources\n\napp = Flask(__name__)\n\n# Get the path to the static files bundled with ledoc-ui\ntry:\n    LEDOCO_UI_STATIC_PATH = pkg_resources.resource_filename('ledoc_ui', 'static')\nexcept ImportError:\n    # Fallback if pkg_resources isn't ideal or if the structure changes\n    # This assumes 'ledoc_ui' is installed in site-packages and 'static' is a direct subdir.\n    # A more robust solution might involve __file__ and os.path.dirname logic if pkg_resources fails.\n    print(\"Warning: pkg_resources failed. Attempting fallback for ledoc-ui static path.\")\n    LEDOCO_UI_STATIC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'env', 'lib', 'pythonX.Y', 'site-packages', 'ledoc_ui', 'static')\n    # Replace 'pythonX.Y' with your actual Python version or adjust path as needed\n\n@app.route('/')\ndef index():\n    # Serve the main index.html from ledoc-ui's static folder\n    return send_from_directory(LEDOCO_UI_STATIC_PATH, 'index.html')\n\n@app.route('/<path:filename>')\ndef serve_static(filename):\n    # Serve other static files (CSS, JS, images) from ledoc-ui's static folder\n    return send_from_directory(LEDOCO_UI_STATIC_PATH, filename)\n\nif __name__ == '__main__':\n    print(f\"Serving ledoc-ui static files from: {LEDOCO_UI_STATIC_PATH}\")\n    app.run(debug=True)","lang":"python","description":"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."},"warnings":[{"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.","message":"ledoc-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.","severity":"gotcha","affected_versions":"0.1.0"},{"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.","message":"Locating 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.).","severity":"gotcha","affected_versions":"0.1.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"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.","cause":"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.","error":"ModuleNotFoundError: No module named 'ledoc_ui.SomeClass'"},{"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.","cause":"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.","error":"404 Not Found (for CSS/JS files after loading index.html)"}],"ecosystem":"pypi"}