nats.py icon indicating copy to clipboard operation
nats.py copied to clipboard

Add Service API

Open Jarema opened this issue 10 months ago • 3 comments

Proposed change

Implement Service API spec: https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-32.md

Use case

Simplify the development of NATS micro-services.

The design goal of the API is to reduce development to having a complexity similar to that of writing a NATS subscription, but then by using simple configuration, allow the specified metadata to allow for standardization of discovery and observability.

Jarema avatar Apr 05 '24 08:04 Jarema

Hi can i work on this problem?

yash97 avatar Apr 14 '24 04:04 yash97

Hi @yash97

Contributions are very welcome! However there is some work in progress. Let me find the branch and see if there was progress recently to avoid any duplication of efforts.

Jarema avatar Apr 14 '24 19:04 Jarema

You might want to check https://github.com/charbonats/nats-micro

There are some tests: https://github.com/charbonats/nats-micro/blob/main/tests/test_micro.py

Note that I created https://github.com/charbonats/nats-request-many and it's used as a dependency. It's also tested: https://github.com/charbonats/nats-request-many/blob/next/tests/test_request_many.py.

EDIT: In no case I'm suggesting to use my library, instead I'm suggesting it as an inspiration for writing a PR. We're using this library at work for a new product without problem fow now, but we did not put it in production yet.

Also, I'm convinced that a CLI is a game changer for this feature and I hope that this would be introduced in nats-py. Having no "standard way" to run a nats micro service is not harmful to existing NATS users, but may refrain new users from using this feature. It would be awesome to be able to start a NATS app as easily as you can start an ASGI or WSGI application using uvicorn/gunicorn today. I tried to come up with a solution in my library, you can see the example usage: https://charbonats.github.io/nats-micro/#example-usage. I'm not convinced it's the correct design, but it has proven to be extremely useful for quick prototyping at work. @Jarema , @wallyqs maybe you have an opinion on this subject ?

charbonnierg avatar Apr 14 '24 20:04 charbonnierg

@caspervonb seeing lots of issues w/o response / feedback and this python repo as a whole seems early beta at best based on issues being filed. Is the issue lack or time? There is no "Contributors" section in the projects README. Are PRs welcome?

I can help with many of the issues if the existing team is willing to put the time into timely reviews / merges.. Right now my feeling is that NATS for python is a non starter and mostly dead project. Some transparency would be appreciated.

skewty avatar Jul 14 '24 14:07 skewty

@caspervonb seeing lots of issues w/o response / feedback and this python repo as a whole seems early beta at best based on issues being filed. Is the issue lack or time? There is no "Contributors" section in the projects README. Are PRs welcome?

We will be chopping down on the backlog shortly, currently heads down trying to bring parity with services and jetstream APIs. Contributions are always welcome @skewty, but please get clarification on the issue tracker first to avoid duplicate efforts etc. There's a nats-io slack as-well for more immediate feedback.

Currently we're implementing the services API as-well as jetstream simplification. Both of these are expected to land roughly within the month.

Right now my feeling is that NATS for python is a non starter and mostly dead project. Some transparency would be appreciated.

I'm here breathing new life into it, really pushing towards parity with the Go client within the next couple of weeks 😁

caspervonb avatar Jul 14 '24 15:07 caspervonb

@caspervonb

Currently we're implementing the services API as-well as jetstream simplification. Both of these are expected to land roughly within the month.

It has been over 2 months now. Was the team able to achieve these goals?

skewty avatar Sep 16 '24 14:09 skewty

yes the @skewty the services API was merged

wallyqs avatar Sep 16 '24 14:09 wallyqs

My bad, I missed it in the change log somehow. I should probably finish my coffee before trying to do work. The team also did a wonderful job on documentation.

https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-32.md

skewty avatar Sep 16 '24 14:09 skewty

No worries! Feel free to drop into slack if you have any feedback @skewty.

caspervonb avatar Sep 17 '24 08:09 caspervonb

Many thanks for the long anticipated service API! Is there an equivalent of services.client in the JS sdk? i.e. something on which I can call ping() et al?

blowback avatar Sep 17 '24 16:09 blowback