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
-
Clone the Repository: Start by cloning this repository to your local machine.
-
Rename the Package: Update the package name in the following files:
setup.py: Changename='litepolis-router-template'to your desired package name (e.g.,litepolis-router-dashboard). Also, update theversion,description,author, andurlfields accordingly.tests/test_core.py: Update the import statement to reflect your new package name. For example, changefrom litepolis_router_template import *tofrom litepolis_router_dashboard import *.- Rename the folder
litepolis_router_templateto your new package name.
-
Implement Database Logic: Modify the
litepolis_router_template/core.pyfile (renamed in the previous step) to interact with your specific database. Theinitfunction incore.pyis crucial for initializing the router and should be implemented correctly. TheDEFAULT_CONFIGdictionary incore.pyallows 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. -
Testing: The
tests/test_core.pyfile contains example tests. Update these tests to cover your database module's functionality. Thetest_core.pyfile should utilize theDEFAULT_CONFIGandinitfunction 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 thenamefield to your package's unique name. Also, update theversion,description,author, andurlfields as needed. -
litepolis_router_template/core.py: This file contains the core logic for your module, including theDEFAULT_CONFIGandinitfunction. Theinitfunction is essential for the LitePolis package manager to correctly initialize and start the services. TheDEFAULT_CONFIGdictionary 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 theResponseMessagemodel 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 incore.py. Thorough testing is essential for ensuring the correctness of your module. Ensure your tests correctly utilize theinitfunction andDEFAULT_CONFIGfor proper setup.
Important Considerations
-
API Documentation: Well-documented code is crucial for maintainability and collaboration. Ensure your endpoints in
core.pyhave 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_requireslist insetup.py. -
DEFAULT_CONFIGandinit: TheDEFAULT_CONFIGdictionary and theinitfunction 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)
| File | Size | Uploaded | |
|---|---|---|---|
| litepolis_router_example-0.0.1.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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