{"id":28281,"library":"spring-py-core","title":"Spring Python Core","description":"A Python implementation of the Spring Framework Inversion of Control (IoC) container, providing dependency injection, bean management, and configuration support. Currently at version 0.1.5, released with a monthly cadence. Requires Python 3.11+.","status":"active","version":"0.1.5","language":"python","source_language":"en","source_url":"https://github.com/spring-py/spring-py-core","tags":["spring","ioc","dependency-injection","python3.11+"],"install":[{"cmd":"pip install spring-py-core","lang":"bash","label":"Latest stable"}],"dependencies":[],"imports":[{"note":"The package name uses underscores, not hyphens.","wrong":"from spring import SpringApplication","symbol":"SpringApplication","correct":"from spring_py_core import SpringApplication"},{"note":"Component is in the annotations submodule.","wrong":"from spring_py_core import Component","symbol":"Component","correct":"from spring_py_core.annotations import Component"},{"note":"","wrong":null,"symbol":"Autowired","correct":"from spring_py_core.annotations import Autowired"}],"quickstart":{"code":"from spring_py_core import SpringApplication\nfrom spring_py_core.annotations import Component, Autowired\n\n@Component\nclass Greeter:\n    def greet(self):\n        return \"Hello, Spring!\"\n\n@Component\nclass App:\n    @Autowired\n    def __init__(self, greeter: Greeter):\n        self.greeter = greeter\n\n    def run(self):\n        print(self.greeter.greet())\n\nif __name__ == \"__main__\":\n    SpringApplication.run(App)","lang":"python","description":"Create two components with dependency injection and run the application."},"warnings":[{"fix":"Use 'import spring_py_core' (underscores) after pip installing 'spring-py-core' (hyphens).","message":"The package name on PyPI is 'spring-py-core' but the import module uses underscores: 'spring_py_core'. Common installation mistake leads to ImportError.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure Python 3.11 or higher is used.","message":"Only Python 3.11+ is supported. Installing on older Python versions will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Pass the class object directly: SpringApplication.run(App)","message":"In version 0.1.5, the 'SpringApplication.run()' method no longer accepts a class as a string; it must be a class reference.","severity":"breaking","affected_versions":">=0.1.5"},{"fix":"Replace 'XmlBeanFactory' with 'AnnotationConfigApplicationContext' and use annotations for configuration.","message":"The 'XmlBeanFactory' is deprecated in 0.1.5. Use 'AnnotationConfigApplicationContext' instead.","severity":"deprecated","affected_versions":">=0.1.5"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from spring_py_core import SpringApplication' (underscores).","cause":"Using wrong import path. The module uses underscores, not hyphens.","error":"ImportError: cannot import name 'SpringApplication' from 'spring'"},{"fix":"Use 'from spring_py_core.annotations import Component'.","cause":"Component is in the annotations submodule, not directly in spring_py_core.","error":"AttributeError: module 'spring_py_core' has no attribute 'Component'"},{"fix":"Use 'SpringApplication.run(App)' where App is a class, not a string.","cause":"Incorrect signature used; run() expects a class reference, not a string.","error":"TypeError: SpringApplication.run() got an unexpected keyword argument 'class_'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}