Skip to main content

LitePolis-router Template

This repository serves as a template for creating router modules for LitePolis. It provides a basic structure and example code to guide you through the process.

:warning: Keep the prefix "litepolis-router-" and "litepolis_router_" in the name of package and directories to ensure the LitePolis package manager will be able to recognize it during deployment.

Getting Started

  1. Clone the Repository: Start by cloning this repository to your local machine.

  2. Rename the Package: Update the package name in the following files:

    • setup.py: Change name='litepolis-router-template' to your desired package name (e.g., litepolis-router-dashboard). Also, update the version, description, author, and url fields accordingly.
    • tests/test_core.py: Update the import statement to reflect your new package name. For example, change from litepolis_router_template import * to from litepolis_router_dashboard import *.
    • Rename the folder litepolis_router_template to your new package name.
  3. Implement Database Logic: Modify the litepolis_router_template/core.py file (renamed in the previous step) to interact with your specific database. The init function in core.py is crucial for initializing the router and should be implemented correctly. The DEFAULT_CONFIG dictionary in core.py allows for configurable settings. Ensure you update the docstrings to accurately reflect the functionality of your endpoints. These docstrings will be used to generate API documentation.

  4. Testing: The tests/test_core.py file contains example tests. Update these tests to cover your database module's functionality. The test_core.py file should utilize the DEFAULT_CONFIG and init function to properly initialize the application for testing. Ensure the tests run successfully after making changes.

Key Files and Modifications

  • setup.py: This file contains metadata about your package. Crucially, you need to change the name field to your package's unique name. Also, update the version, description, author, and url fields as needed.

  • litepolis_router_template/core.py: This file contains the core logic for your module, including the DEFAULT_CONFIG and init function. The init function is essential for the LitePolis package manager to correctly initialize and start the services. The DEFAULT_CONFIG dictionary provides default configuration settings. Replace the example endpoints with your own endpoints and operations. Important: Update the docstrings for API documentation generation. Pay attention to the ResponseMessage model and adapt it if necessary to fit your data structures.

  • tests/test_core.py: This file contains tests for your module. Update the tests to reflect your changes in core.py. Thorough testing is essential for ensuring the correctness of your module. Ensure your tests correctly utilize the init function and DEFAULT_CONFIG for proper setup.

Important Considerations

  • API Documentation: Well-documented code is crucial for maintainability and collaboration. Ensure your endpoints in core.py have clear and comprehensive docstrings. These docstrings will be used to generate API documentation for LitePolis. For best practices and detailed examples, refer to this helpful resource: How to Document an API for Python FastAPI

  • Testing: Write comprehensive tests to cover all aspects of your router module. This will help catch errors early and ensure the stability of your code.

  • Dependencies: If your module requires external libraries, add them to the install_requires list in setup.py.

  • DEFAULT_CONFIG and init: The DEFAULT_CONFIG dictionary and the init function are crucial for the package manager to correctly initialize and start the services. Ensure these are correctly implemented and used in your tests.

Metadata

Release files for litepolis-router-example 0.0.1

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

Source distribution (sdist)

Source distribution for litepolis-router-example 0.0.1
File Size Uploaded
litepolis_router_example-0.0.1.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for litepolis-router-example 0.0.1
File Interpreter ABI Platform
litepolis_router_example-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / litepolis_router_example-0.0.1.tar.gz

Download URL litepolis_router_example-0.0.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
22b9a89db4e025a374e15a5f623c8e890b4a495473b9661436f879a0daff29b2
BLAKE2b-256 checksum
How to use checksums
98e2a0fb202c309397ef1c83d8070ff1b02d289e12fdee9c275ca06436d940a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2025.

Transparency log

Release files / litepolis_router_example-0.0.1-py3-none-any.whl

Download URL litepolis_router_example-0.0.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a94044dcc0e785aefce2eaa4084c35a39252156b2104fadad224756b867f1f79
BLAKE2b-256 checksum
How to use checksums
0735d9cd2dad58b109d0c7fa269528ee904e351279ad59e2938f9902c3bf8fb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

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