{"id":27824,"library":"ghostos-container","title":"ghostos-container","description":"An IoC container library for Interface-oriented programming in Python, part of the GhostOS ecosystem. Currently version 0.2.7, requires Python >=3.10. Release cadence is irregular with recent dev releases for 0.4.0.","status":"active","version":"0.2.7","language":"python","source_language":"en","source_url":"https://github.com/ghost-in-moss/GhostOS","tags":["ioc","dependency-injection","container","interface-oriented"],"install":[{"cmd":"pip install ghostos-container","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The package name uses a hyphen but the module name uses an underscore.","wrong":"from ghostos_container import Container","symbol":"Container","correct":"from ghostos.container import Container"},{"note":"Same module name issue.","wrong":"from ghostos_container import Provider","symbol":"Provider","correct":"from ghostos.container import Provider"},{"note":"Common import mistake due to package name.","wrong":"from ghostos_container import get_container","symbol":"get_container","correct":"from ghostos.container import get_container"}],"quickstart":{"code":"from ghostos.container import Container, Provider\n\n# Define a simple provider\nclass GreetingProvider(Provider):\n    def register(self, container: Container):\n        container.set('greeting', 'Hello, world!')\n\n# Create container and use it\ncontainer = Container()\ncontainer.register(GreetingProvider())\nprint(container.get('greeting'))","lang":"python","description":"Basic usage of ghostos-container: define a Provider, register it, and retrieve a value."},"warnings":[{"fix":"Use 'from ghostos.container import ...' not 'from ghostos_container import ...'.","message":"The package name on PyPI uses a hyphen (ghostos-container) but the Python module uses an underscore (ghostos.container). This often causes confusion with imports.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Check the GhostOS documentation for additional packages. For basic container usage, ghostos-container is standalone.","message":"The library is part of the larger GhostOS project and may have dependencies on other ghostos packages not explicitly listed. Ensure you install the required extras (e.g., ghostos[realtime]) if you need full functionality.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Migrate from MossAgent to MossGhost when upgrading to 0.4.0+.","message":"The GitHub repository shows v0.4.0-dev1 which deprecates MossAgent in favor of MossGhost. This may affect future releases of ghostos-container if it re-exports those symbols.","severity":"deprecated","affected_versions":">=0.4.0-dev1"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Change import to 'from ghostos.container import ...'","cause":"Incorrect import path: using package name with hyphen instead of underscore.","error":"ModuleNotFoundError: No module named 'ghostos_container'"},{"fix":"Ensure you are using the correct symbol: 'Container', 'Provider', etc. Check the documentation.","cause":"Typo or incorrect symbol name. The symbol may be misspelled or not yet imported.","error":"ImportError: cannot import name 'Container' from 'ghostos.container'"},{"fix":"Use container.set(key, value) for simple registration, or implement Provider.","cause":"Using the wrong method. The container might use 'set' or 'bind' instead.","error":"AttributeError: 'Container' object has no attribute 'register'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}