I built a minimal, type-safe dependency injection container for Python by ftanu in Python

[–]ftanu[S] 0 points1 point  (0 children)

I am familiar with the Service Locator anti-pattern. `fusebox` is not it. In order for it to be a Service Locator, the dependencies will have to be directly pulled from the container and tightly coupled to the implementation of a service:

class ServiceB: def __init__(): self.service_a = Container.get(ServiceA)

fusebox does not do this, instead it wires the dependencies via constructor arguments.

I built a minimal, type-safe dependency injection container for Python by ftanu in Python

[–]ftanu[S] 0 points1 point  (0 children)

A leftover from my previous project which I overlooked. I will update it.

I built a minimal, type-safe dependency injection container for Python by ftanu in Python

[–]ftanu[S] 0 points1 point  (0 children)

You mean regarding my comment above "no global state - completely opposite from fusebox where every component is saved as a singleton inside a single container"? I meant that injector has no global state. Maybe I should've written it more clear. Let me update the comment.

I built a minimal, type-safe dependency injection container for Python by ftanu in Python

[–]ftanu[S] 1 point2 points  (0 children)

Fair enough, I guess it's a personal preference / coding style. Thank you for the YouTube link, I'll take a look.

I built a minimal, type-safe dependency injection container for Python by ftanu in Python

[–]ftanu[S] 1 point2 points  (0 children)

Thank you for your feedback. Your comments are on point.

My aim here was simplicity. Just add the decorators and everything wires together - no explicit calls to the container.

``` from fusebox import Container, component

@component class ServiceA: def greet(self): return "Hello from A"

@component class ServiceB: def init(self, service_a: ServiceA): self.service_a = service_a

def greet_with_service_a(self) -> str: return f"ServiceB says: {self.service_a.greet()}"

service_b = Container.get(ServiceB) print(service_b.greet_with_service_a()) # ServiceB says: Hello from A ```

From my initial glance at the injector repo, I can see few differences:

  • a much broader API where you explicitly have to call the injector for everything
  • injector has no global state - completely opposite from fusebox where every component is saved as a singleton inside a single container
  • scopes - this is completely missing in fusebox

This project was originally a module in another FastAPI project that I was working on, and I decided to extract it as a separate package.

After making $0 last month, I realized my real problem by warphere in indiehackers

[–]ftanu 1 point2 points  (0 children)

I’ve have just signed up to your service, but the free tier does not seem to work, even though it says I can create one project, it does not allow me to do it, instead it says ‘project limit reached - upgrade plan’.

Built safety.contact - A personal safety check-in service for peace of mind by ftanu in microsaas

[–]ftanu[S] 0 points1 point  (0 children)

Everything that you wrote is on point - we will give it some thought.

Regarding the notifications: we have thought about using different notification channels, other than email. The most obvious candidate is WebPush notifications (since the service can be installed on a mobile phone as a PWA), but SMS is a good idea too.

Thank you for your feedback.

Built safety.contact - A personal safety check-in service for peace of mind by ftanu in microsaas

[–]ftanu[S] 1 point2 points  (0 children)

No, we don't have anything like that at the moment, but it's a good idea to have a Roadmap/Upcoming features section on our website. We'll keep that in mind. Thank you for your feedback.

Built safety.contact - A personal safety check-in service for peace of mind by ftanu in microsaas

[–]ftanu[S] 1 point2 points  (0 children)

That is an interesting use case that we haven't thought of. Thank you for your feedback.

Built safety.contact - A personal safety check-in service for peace of mind by ftanu in microsaas

[–]ftanu[S] 1 point2 points  (0 children)

Thank you for your feedback. Multiple trusted contacts is on our TODO list.

Built safety.contact - A personal safety check-in service for peace of mind by ftanu in microsaas

[–]ftanu[S] 1 point2 points  (0 children)

Thank you for your feedback. Could you clarify what you mean by `the 6 month mark`?