Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
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.
auto dependency injection
, auto configuration management
and a web server
for hosting your application.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.
To get started with PySpring, follow these steps:
pip3 install py-spring-core
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()
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.
FAQs
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.
We found that py-spring-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.