
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Pyfony is a Dependency Injection (DI) powered framework written in Python greatly inspired by the Symfony Framework in PHP & Spring Framework in Java.
The DI functionality is provided by the Injecta Dependency Injection Container.
Pyfony = Injecta + bundles (extensions) API
$ pip install pyfony
(The following steps are covered in the BaseKernelTest)
To start using Pyfony, create a simple config_dev.yaml
file to define your DI services:
parameters:
api:
endpoint: 'https://api.mycompany.com'
services:
mycompany.api.ApiClient:
arguments:
- '@mycompany.api.Authenticator'
mycompany.api.Authenticator:
class: mycompany.authenticator.RestAuthenticator
arguments:
- '%api.endpoint%'
- '%env(API_TOKEN)%'
Then, initialize the container:
from injecta.config.YamlConfigReader import YamlConfigReader
from pyfony.kernel.BaseKernel import BaseKernel
appEnv = 'dev'
kernel = BaseKernel(
appEnv,
'/config/dir/path', # must be directory, not the config_dev.yaml file path!
YamlConfigReader()
)
container = kernel.initContainer()
Use container.get()
to finally retrieve your service:
from mycompany.api.ApiClient import ApiClient
apiClient = container.get('mycompany.api.ApiClient') # type: ApiClient
apiClient.get('/foo/bar')
FAQs
Dependency Injection powered framework
We found that pyfony demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.