Skip to main content

PySpring is a Python web framework inspired by Spring Boot, combining FastAPI, SQLModel, and Pydantic for building scalable web applications with auto dependency injection, configuration management, and a web server.

Project description

PySpring Framework

PySpring is a Python web framework inspired by Spring Boot. It combines FastAPI for the web layer, SQLModel for ORM, and Pydantic for data validation. PySpring provides a structured approach to building scalable web applications with auto dependency injection, auto configuration management and a web server for hosting your application.

Key Features

  • Application Initialization: PySpringApplication class serves as the main entry point for the PySpring application. It initializes the application from a configuration file, scans the application source directory for Python files, and groups them into class files and model files

  • Model Import and Table Creation: PySpring dynamically imports model modules and creates SQLModel tables based on the imported models. It supports SQLAlchemy for database operations.

  • Application Context Management: PySpring manages the application context and dependency injection. It registers application entities such as components, controllers, bean collections, and properties. It also initializes the application context and injects dependencies.

  • REST Controllers: PySpring supports RESTful API development using the RestController class. It allows you to define routes, handle HTTP requests, and register middlewares easily.

  • Component-based Architecture: PySpring encourages a component-based architecture, where components are reusable and modular building blocks of the application. Components can have their own lifecycle and can be registered and managed by the application context.

  • Properties Management: Properties classes provide a convenient way to manage application-specific configurations. PySpring supports loading properties from a properties file and injecting them into components.

  • Framework Modules: PySpring allows the integration of additional framework modules to extend the functionality of the application. Modules can provide additional routes, middlewares, or any other custom functionality required by the application.

  • Builtin FastAPI Integration: PySpring integrates with FastAPI, a modern, fast (high-performance), web framework for building APIs with Python. It leverages FastAPI's features for routing, request handling, and server configuration.

Getting Started

To get started with PySpring, follow these steps:

1. Install the PySpring framework by running:

pip3 install py-spring-core

2. Create a new Python project and navigate to its directory

  • Implement your application properties, components, controllers, using PySpring conventions inside declared source code folder (whcih can be modified the key app_src_target_dir inside app-config.json), this controls what folder will be scanned by the framework.

  • Instantiate a PySpringApplication object in your main script, passing the path to your application configuration file.

  • Optionally, define and enable any framework modules you want to use.

  • Run the application by calling the run() method on the PySpringApplication object, as shown in the example code below:

from py_spring_core import PySpringApplication

def main():
    app = PySpringApplication("./app-config.json")
    app.run()

if __name__ == "__main__":
    main()
  • For example project, please refer to this github repo.

Contributing

Contributions to PySpring are welcome! If you find any issues or have suggestions for improvements, please submit a pull request or open an issue on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_spring_core-0.0.5.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_spring_core-0.0.5-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file py_spring_core-0.0.5.tar.gz.

File metadata

  • Download URL: py_spring_core-0.0.5.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for py_spring_core-0.0.5.tar.gz
Algorithm Hash digest
SHA256 3cd20c8147543ab9b055d4e1ed3482b4c47b56818c86c1694e1690cc18a89232
MD5 844711336146552502217c03af0e9ca8
BLAKE2b-256 a7038bae94adaa7b567385ef7b056ef9abbbc0f70182dacfcaddd469114316de

See more details on using hashes here.

File details

Details for the file py_spring_core-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: py_spring_core-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for py_spring_core-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cc19abbfaa243db1e5d51c6fb2d9f138922d5aaf39435e331a72c2c0c95c92ea
MD5 daa3259a5c6adf264557483aa3519b9e
BLAKE2b-256 50858586d8cb1514214d3a6992900f3d0a26dc17f01ee74ea29b9fb7241bb5fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page