-
Notifications
You must be signed in to change notification settings - Fork 309
docs: middlewares 0.6 changes #2345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2726ae4 to
5749bcb
Compare
e5a8f5a to
7a05e2e
Compare
* Add HTTP bindings * Ruff format * Remove unnecessary isinstance calls * Apply suggested fixes --------- Co-authored-by: Pastukhov Nikita <[email protected]>
ee37dff to
91e3c24
Compare
|
faststream-actions[bot] seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
@Lancetnik please check for correctness, without merge. |
|
Please, add information about methods |
* Update specs public API (#1799) * init * AsyncAPI2 * AsyncAPI3 * AsyncAPI facade * AsyncAPI facade refactoring to factory * Rename facade to factory * Remove specs interface from Faststream and AsgiFaststream * Tests update * fixes * tests fixes * tests fix * tests fix * fixes * fixes * docs: generate API References * asyncapi.py rename to facade.py * tests fix * docs: generate API References * merge conflict fix * docs: generate API References * Separation of AMQP bindings creation for AsyncAPI 3.0.0 and 2.6.0 * docs: generate API References * Correct cc for AMQP in AsyncAPI 3.0.0 * docs: generate API References --------- Co-authored-by: KrySeyt <[email protected]> * refactor: change AsyncAPI inheritance tree * lint: update ruff config, drop python3.8 * add: NATS HowTO * rm useless change * refactor: create publisher factory * refactor: split publish to private * refactor: use CMD to call publisher (#1857) * refactor: use CMD to call publisher * fix: add missing pre-commit changes * refactor: add an ability to check RPC response * refactor: use PublishType * refactor: new NatsFakePublisher * refactor: use PublishCmd in request * fix: correct publisher.publish * fix: correct Nats JS request * lint: polish annotations * feat: add RabbitPublishCommand * refactor: add basic publish & request publisher methods * refactor: remove add_header Response method * refactor: add KafkaPublishCommand * refactor: pass context to middleware directly * refactor: Confluent, Redis publish commands * refactor: break ISP, add publish_batch to ProducerProto * refactor: create basic fake publisher * refactor: do not call LoggingMiddleware for RPC responses * refactor: new NatsOtelMiddleware * refactor: new RabbitOtelMiddleware * refactor: new RedisOtelMiddleware * refactor: new KafkaOtelMiddleware * refactor: new ConfluentOtelMiddleware * feat: add PublishCmd add_headers method * refactor: actual PrometheusMiddleware * fix: correct AsyncAPI * fix: add missing pre-commit changes * chore: remove 3.8 from CI * docs: generate API References * chore: fix CI * chore: fix CI * fix: set miltilock at start only --------- Co-authored-by: Lancetnik <[email protected]> * Feat/fast depends 3 (#1886) * refactor: make context not-global * docs: generate API References * tests: refactor context tests * chore: merge main * fix: correct Context propogation from App to Broker * docs: generate API References * tests: in-memory cli * chore: use python3.9 compatible FastDepends * chore: revert FD version --------- Co-authored-by: Lancetnik <[email protected]> * Fixed RPC for Prometheus metrics (#1887) * fixing metrics for rpc * == -> is * tests on MetricsSettingsProvider for all brokers (#1890) * tests on MetricsSettingsProvider for all brokers * chore: fix tests * chore: remove loguru usage --------- Co-authored-by: Nikita Pastukhov <[email protected]> * feat/ack_middleware added middleware (#1869) * feat/ack_middleware added ack middleware * tests: fix FastAPI tests * feat/ack_middleware added ack middleware * ack_middleware fixed redis stream * tests: fix FastAPI tests * ack_middleware fixed redis stream * chore: remove conflicts * chore: refactor AckMiddleware * docs: generate API References --------- Co-authored-by: Nikita Pastukhov <[email protected]> Co-authored-by: Pastukhov Nikita <[email protected]> Co-authored-by: Lancetnik <[email protected]> * refactor: use caps names for public enums * refactor: little type changes * refactor: new setup logic * fix: correct RMQ subscriber get_one logic * chore: fix pydantic 2.10 compatibility * refactor: create default middlewares in runtime * refactor: add ack handling for brokers (#1897) * refactor: add ack handling for brokers * fix: warnings arguments and is_manual flag * refactor: complete NATS * docs: generate API References * fix: update ack_policy * refactor: new tests * refactor: move ack_policy reject outside of return functions * tests: fix NATS tests * refactor: validate warnings * chore: remove loguru usage * chore: remove deprecated type option * chore: correct warnings stacklevel --------- Co-authored-by: vectorvp <[email protected]> Co-authored-by: Pastukhov Nikita <[email protected]> * feat: lazy decoder * feat: added ack_first * docs: generate API References * feat: ack_first added deprecated and docstrings to Ack_Policy * docs: generate API References * docs: fix typo * feat: ack_first refactored ack_first check * refactor: new Specification Schema (#1843) * refactor: new Specification Schema * fix: add missing pre-commit changes * refactor: delete defaults * refactor: polish AsyncAPI all brokers * fix: add missing pre-commit changes --------- Co-authored-by: Lancetnik <[email protected]> * fix: correct AsyncAPI 2.6 operations * tests: add Nats concurrent test * tests: actualize AsyncAPI 2.6.0 tests * fix: do not ack Nats Core message: * chore: fix NATS Core acknowledgement * Remove `retry` from docs and add acknowledgement to getting start (#1934) * Remove `retry` from block and add acknowledgement to getting start * fix pre-commit * tests: add middlewares enter-exit order test * feat: added ack_first (#1917) * feat: added ack_first * docs: generate API References * feat: ack_first added deprecated and docstrings to Ack_Policy * docs: generate API References * feat: ack_first refactored ack_first check * chore: merge 0.6 * docs: generate API References --------- Co-authored-by: Rusich90 <[email protected]> Co-authored-by: Nikita Pastukhov <[email protected]> * Fix AsyncAPI 3.0.0 AMQP bindings (#1949) * Fix RabbitMQ AsyncAPI 3.0.0 binding version * Fix tests * docs: generate API References --------- Co-authored-by: KrySeyt <[email protected]> * docs: use DeliverPolicy Enum for deliver_policy in subscriber (#1952) * docs: use DeliverPolicy Enum for deliver_policy in subscriber Updated deliver_policy to use DeliverPolicy enum according to type definition * docs: generate API References --------- Co-authored-by: Majajashka <[email protected]> * chore: remove useless * lint: fix mypy a bit * chore: remove useless code * tests: make cli tests little bit clear * refactor: make BaseMiddleware generic * refactor: make Prometheus middleware generic * refactor: make Telemetry middleware generic * refactor: deprecate subscriber/publisher-level middlewares * refactor: deprecate filter middlewares * tests: fix Kafka tests from main branch * feat: init_routes added routes to init broker (#1981) * feat: init_routes added routes to init broker * docs: generate API References --------- Co-authored-by: Rusich90 <[email protected]> * Fix: return logger (#1982) * Fix: return logger, typing * Fix: lint * chore: fix tests --------- Co-authored-by: Daniil Dumchenko <[email protected]> Co-authored-by: Nikita Pastukhov <[email protected]> * Feat: replace subscribers (#1976) * Feat: replace subscribers * Fix: lint * Fix: add mixin * Fix: lint * Fix: add markers * chore: fix tests --------- Co-authored-by: Daniil Dumchenko <[email protected]> Co-authored-by: Pastukhov Nikita <[email protected]> Co-authored-by: Nikita Pastukhov <[email protected]> * lint: fix routers types * lint: fix internal broker types * lint: fix ruff TC006 * lint: fix internal mypy * feat: add application states (#1974) * feat: add application state * docs: generate API References --------- Co-authored-by: Artem-Safronov <[email protected]> * fix: correct FastAPI with new state * tests: refactor publish js frame test * feat: make return RecordMetada if not no_confirm, change annotations and convert Doc to doc string. (#1983) * feat: change returns kafka publish, change annotation and convert Doc to doc string * docs: generate API References * delete docs * change annotations on broker publish and publish_batch * add tests and use lint.sh --------- Co-authored-by: spataphore1337 <[email protected]> * fix type hins in faststream/specification (#1985) * chore: polish types * lint: fix top-level mypy * lint: fix rabbit otel & prometheus mypy * lint: fix rabbit response types * feat: add raise BatchBufferOverflowException (#1989) * feat: add raise BatchBufferOverflowException * Update producer.py --------- Co-authored-by: Pastukhov Nikita <[email protected]> * fix: KeyError 'reply_to' in rabbit (#1999) * feat: delayed broker setting (#1931) * feat: delayed broker setting * feat: tests for delayed broker setting * feat: addition test * feat: broker -> **brokers * feat: ruff * lint: fix rabbit types a bit * feat: Pretty prom tests (#2000) * feat: moved the creation of metrics to functions * feat: ruff * feat: pretty prometheus tests * feat: ruff * feat: fix test * fix: correct PublishType for publisher decorator * Overwrite message schema (#2007) * fix: use of overwritten message scheme and warning * test: overwrite schema and warning * test: deleted the loop and made a length check * new test: in_memory_routing (#2010) Co-authored-by: Nikita Pastukhov <[email protected]> Co-authored-by: Pastukhov Nikita <[email protected]> * Separated thread for confluent kafka consumer client. (#2014) * fix: Disabled excessive throttling for BatchSubscriber. * fix: Use separate thread for confluent kafka consumer. * refactor: Added run_in_executor function. * fix: Stop consumer client after consumer tasks are stopped. * Feat: concurrent redis (#2012) * Feat: add tests * Feat: add concurrent subscriber * Fix: revert ruff * Fix: again ruff * Fix: fastapi init * Fix: inheritance --------- Co-authored-by: Daniil Dumchenko <[email protected]> Co-authored-by: Pastukhov Nikita <[email protected]> * chore: add warning comment to confluent client * fix: show a warning only if the message scheme is changed (#2021) * add warning for overwrite channel (#2020) * Confluent kafka producer refactoring. (#2019) * fix: Non-threadsafe operations in AsyncConfluentProducer. * fix: Unbound error in AsyncConfluentProducer.publish method. * fix: AsyncConfluentFastProducer type hints. * lint: correct Redis producer publish types * lint: fix specification mypy * Type-hints + refactoring (#2018) * feat: add PublishCmd.batch_bodies setter * refactor: basic BatchPublishCommand * chore: update deprecations * tests: use correct import name * Fix: middleware type hints (#2033) * feat: Mypy tests for broker middleware. * refactor: Move BaseMiddleware to _internal module. * fix: Added missed second type variable to BrokerMiddleware protocol. * fix: Broker middleware mypy issues. * fix: Added missed type vars to base prometheus middleware classes. * fix: Redis prometheus middleware type hints. * fix: Rabbit prometheus middleware type hints. * fix: Nats prometheus middleware type-hints. * fix: Kafka broker public middleware contract. * fix: Confluent broker middleware public contract. * fix: Confluent prometheus middleware type hints. * fix: Kafka pometheus middleware type hints. * fix: Linter issues. * chore: merge main (#2045) * chore: merge main * tests: new Listener tests * chore: refactor CincurrentBetwwenPartitionsSubscriber * chore: refactor CincurrentBetwwenPartitionsSubscriber * fix: correct ConcurrentManualAckSubscriber behavior * tests: increase timeout in kafka concurrent tests * refactor: change ListenerProxy logic * tests: increase workers number for kafka * refactor: use RMQ declare instead of passive option * refactor: deprecate log_fmt option * feature: support RMQ autoacknowledgement * tests: resolve RMQ conflicts * fix: resolve kafka conflicts * fix: resolve conflicts * fix: correct logging setLevel * tests: add missing fixture * tests: make FastAPI validation in-memory * fix: correct Kafka rebalance logging tests * Subscriber iterator (#2039) * feat: rabbit subscriber iterator * test: rabbit subscriber iterator * test: use async for loop for test async iterator * feat: add __aiter__ method in SubscriberProto * fix: return RabbitMessage everytime, ignore override * feat: kafka subscriber iterator * feat: add subscriber iterator for nats * feat: add subscriber iterator for redis * feat: add subscriber iterator for confluent * fix: type hint fixes and formatting * fix: type hint fixes and formatting * test: add test iterator in base consume * test: add test iterator for nats js, kv, os and etc * test: add test iterator for redis list and stream * chore: fix typo --------- Co-authored-by: Pastukhov Nikita <[email protected]> * chore: update from main * tests: fix typer * Feat: add dto in subscribers and publishers constructor (#2038) * Feat: init * Feat: add dto for publishers and subscribers in rabbit, need rename and mpre clearly import * Fix: lint * Fix: some fixes * Fix: remove base options * Feat: add dto for specification broker * Fix: rewrute rmq * Feat: add confluent publishers * Feat: add kafka * Feat: add nats * Feat: add redis * Fix: rename base options * Fix: pop schema_ from publishers dto * Fix: lint * Fix: some fixes * Fix: folder restructuring * Fix: rename options to configs * Fix: correct publisher configs * Fix: again replace options to config * Fix: remove internal options from confluent * Fix: drop internal configs * Feat: move default from factory to property * Fix * Fix: remove options and typo * Fix: remove set attr in getter * Fix: remove switch to furst topic in between partitions sub * Fix: revert prev change --------- Co-authored-by: Daniil Dumchenko <[email protected]> Co-authored-by: Pastukhov Nikita <[email protected]> * chore: merge DTO * chore: fix timestamp * refactor: polish DTO for publishers & subscribers factories * fix: correct and test AckPolicy logic * Feature: add test for pubkishers with same name (#2237) * refactor: new object registration logic (#2235) * refactor: new object registration logic * refactor: move logger config, change _setup to start * tests: polish new test * lint: run ruff * refactor: new NATS structure * refactor: new Kafka structure * refactor: new Confluent and Redis broker * refactor: support dynamic subscribers RMQ * fix: correct decorators logic * refactor: new nats registration * refactor: new Redis structure * refactor: new Kafka structure * refactor: new Confluent structure * refactor: make subscribers registration lazy * tests: make most tests green * tests: fix otel tests (#2254) * fix: correct empty task initialization * fix: use typing_extensions.Self * fix: correct KafkaConcurrentSubscriber start * fix: correct memory Kafka tests --------- Co-authored-by: treaditup <[email protected]> * chore: add subscriber error logging * lint: polish mypy a bit * chore: revert changes * docs: new way asyncapi (#2273) * docs: new way asyncapi * fix: asyncapi tests * test changes * fix: add switch for click deps * docs/update acknowledgment.md (#2296) * docs/update acknowledgment.md * docs: refactoring after yandex editor * fix(docs): nack_on_error * docs: update manual info * fix(docs): no_action to do_nothing * docs: improve manual info * docs: polish AckPolicy * docs: remove API --------- Co-authored-by: Nikita Pastukhov <[email protected]> * refactor: RMQ specification composition instead of inheritance (#2279) * refactor: RMQ specification composition instead of inheritance * docs: generate API References * chore: bump python version to 3.10 * refactor: NATS specification composition instead of inheritance * chore: use pep 735 for dependencies * refactor: Kafka Specification composition * refactor: Confluent Specification composition * refactor: Redis Specification composition * chore: uv install with groups * chore: uv use public extras * chore: uv use public extras * test: mark slow tests flaky * chore: mv service files to .github * chore: mv service files to .github * chore: mv meaning files back * tests: speedup CLI tests * docs: add API References * chore: format CI file * chore: correct cursor rule metainfo (#2316) * chore: correct cursor rule metainfo * tests: do not check status code * tests: adopt select to windows * tests: graceful CLI stopping * tests: suppress joined error * docs: generate API References * tests: revert conftest changes * docs: generate API References * tests: graceful application stop * docs: generate API References * tests: improve stderr wait * tests: improve stderr wait * tests: kill windows * docs: generate API References * tests: correct windows signal * tests: mock confluent flaky test * chore: remove useless group * chore: fix docs.py types * feat: FS-2031 added docker compose and justfile (#2066) * feat: FS-2031 added docker compose and justfile * feat: FS-2031 added justfile and docker compose for developers * feat: FS-2031 fix ci * feat: FS-2031 fix ci just * feat: FS-2031 fix ci build docs * change to 0.6 * remove lcal pre commit, return scripts * docs: generate API References --------- Co-authored-by: Pastukhov Nikita <[email protected]> * chore: remove some docstrings * Feat: add test to msgspec (#2290) * Feat: add test to msgspec * Fix: tests * chore: little msgspec tests polish * Add serializer for RMQ * Add no all broker * Fix: remove marker * Fix: add import * docs: generate API References * chore: update FastDepends * tests: mark multiprocess test flaky * tests: add tests for all brokers * Fix: drop serializer re-encoding, use json_dumps * chore: update cursor rules * chore: mark asgi-workers CLI test flaky --------- Co-authored-by: Nikita Pastukhov <[email protected]> Co-authored-by: Pastukhov Nikita <[email protected]> * refactor: polish call_decorators logic * refactor: polish dishka integration * Update registrator.py (#2324) fixed a typo related to the class name for an incoming message from Redis * improoved docker and justfile (#2320) * dependencies: replace pytest-retry by pytest-rerunfailures * Add worker_id extra option (#2315) * tests: use individual test marks * Refactor: asyncapi asgi (#2322) * refactor: fix nats AsyncAPI * Refactor asyncapi asgi tests (#2329) * refactor: extract common functions and fix confluent asyncapi * refactor: fix kafka, rabbit and redis asyncapi tests * fix: revert unrelated changes * fix: fix doc tests * refactor: add AsyncAPI ASGI support * tests: mark ASGI CLI tests kafka connection-required * tests: fix AsyncAPI documentation tests * tests: fix CLI asgi docs tests --------- Co-authored-by: Tapeline <[email protected]> * feat(build-backend): drop `hatch`, add `uv_build` (#2333) * Modify sys.path on publish (#2340) * improoved justfile (#2342) * improoved justfile * docs: generate API References * chore: make Justfile crossplatform * lint: fix mypy a bit more * tests: fix CLI docs generation * Add HTTP bindings (#2350) * Add HTTP bindings * Ruff format * Remove unnecessary isinstance calls * Apply suggested fixes --------- Co-authored-by: Pastukhov Nikita <[email protected]> * chore: remove useless comments * refactor: unwrap FastDepends errors * fix: correct startup logs * chore: merge NATS overlap changes * ci: add API Reference build to documentation build job * ci: add precommit * ci: add mypy to precommit * chore: run typos locally * ci: use codespell locally * docs: add Conventional Commits mention * chore: add just docs-serve --full option * test: fix examples/filters type hints * improoved justfile tests (#2369) * style: fix mypy errors * ci: add just installation * chore: add deprecation notices (#2370) * resolve #2367 * Remove some Doc, add deprecated * Fix: typo --------- Co-authored-by: Pastukhov Nikita <[email protected]> * refactor: rename AckPolicy.DO_NOTHING to MANUAL * chore: remove useless script * Change f-string with assigned topic partitions (#2373) * chore: bump fastdepends to fix PydanticV1 compat * feat: add Redis MessageFormat * tests: suppress JSONMessageFormat warnings * fix: respect publisher message_format in request * lint: set max-line-length 90 * lint: improve mypy tests * chore: fix kafka imports * fix: #1036 use WeakSet to store broker.subscribers * Mark tests (#2371) * added connect mark to kafka * added connect mark to confluent redis nats rabbit tests * added mark kafka tests * added mark confluent tests * added mark redis rabbit nats tests * fix ci tests * change testing dependencies * fix xi tests * fix ci tests again --------- Co-authored-by: Pastukhov Nikita <[email protected]> * docs: update AsyncAPI docs * tests: update connected markers * tests: update handler.mock tests * chore: add test-[broker] commands to Justfile * tests: fix broken due subscriber order tests * refactor: use IS_WINDOWS everywhere to check windows * tests: fix GC problems due reexport * docs: add msgspec examples (#2380) Co-authored-by: Pastukhov Nikita <[email protected]> * docs: polish Msgspec page * Feat: add benchmarks (#2383) * Feat: add benchmarks * chore: apply autofixes --------- Co-authored-by: faststream-actions[bot] <faststream-actions[bot]@users.noreply.github.com> * docs: add benchmarks * docs: middlewares 0.6 changes (#2345) * docs/index.md updated * docs/ add intertal link * docs/add internal link * fix(docs): rename after_process to after_processed * fix(docs): remove mention publisher level * lint: fix mypy a bit more * tests: fix CLI docs generation * Add HTTP bindings (#2350) * Add HTTP bindings * Ruff format * Remove unnecessary isinstance calls * Apply suggested fixes --------- Co-authored-by: Pastukhov Nikita <[email protected]> * chore: remove useless comments * refactor: unwrap FastDepends errors * fix(docs): consistency * docs: add flow.svg * docs: flow.svg updated * docs: rename flow.svg to middlewares-flow.svg * docs: add description for middleware flow * docs: add summary and linting via yandex.editor * docs: fix markup * chore: apply autofixes * docs: remove space & internal-link added * Update .gitignore --------- Co-authored-by: Nikita Pastukhov <[email protected]> Co-authored-by: Tapeline <[email protected]> Co-authored-by: Pastukhov Nikita <[email protected]> Co-authored-by: faststream-actions[bot] <faststream-actions[bot]@users.noreply.github.com> * types: add Redis type tests (#2386) * async handler * add all validate tests * lint update * addede different publisher types * chore: apply autofixes --------- Co-authored-by: faststream-actions[bot] <faststream-actions[bot]@users.noreply.github.com> Co-authored-by: Pastukhov Nikita <[email protected]> * docs: update Context 0.6 * chore: add public export for CLI * refactor: remove AnyDict type * chore: bump fastdepends to fix PydanticV1 compat * types: add Rabbit type tests (#2388) * fix typo * added rabbit type tests * chore: apply autofixes --------- Co-authored-by: faststream-actions[bot] <faststream-actions[bot]@users.noreply.github.com> Co-authored-by: Pastukhov Nikita <[email protected]> * lint: fix Redis types * docs: add dynamic subscribers page * refactor: rename RedisMessage type * chore: apply autofixes * docs: update default Redis Message Format * tests: add more retries on Kafka flaky test * tests: remove slow kafka tests --------- Co-authored-by: Vladimir Kibisov <[email protected]> Co-authored-by: KrySeyt <[email protected]> Co-authored-by: Lancetnik <[email protected]> Co-authored-by: Roma Frolov <[email protected]> Co-authored-by: Ruslan Alimov <[email protected]> Co-authored-by: Vladislav Tumko <[email protected]> Co-authored-by: vectorvp <[email protected]> Co-authored-by: Rusich90 <[email protected]> Co-authored-by: sheldy <[email protected]> Co-authored-by: Majajashka <[email protected]> Co-authored-by: Majajashka <[email protected]> Co-authored-by: Flosckow <[email protected]> Co-authored-by: Daniil Dumchenko <[email protected]> Co-authored-by: Artem-Safronov <[email protected]> Co-authored-by: Artem-Safronov <[email protected]> Co-authored-by: Spataphore <[email protected]> Co-authored-by: spataphore1337 <[email protected]> Co-authored-by: Ivan Kirpichnikov <[email protected]> Co-authored-by: Apostol Fet <[email protected]> Co-authored-by: doublehomixide <[email protected]> Co-authored-by: David Grigorenko <[email protected]> Co-authored-by: Ageev Maxim <[email protected]> Co-authored-by: treaditup <[email protected]> Co-authored-by: Sergey <[email protected]> Co-authored-by: computerScienceEnjoyer <[email protected]> Co-authored-by: Boris Alekseev <[email protected]> Co-authored-by: Tapeline <[email protected]> Co-authored-by: chiri <[email protected]> Co-authored-by: Tapeline <[email protected]> Co-authored-by: Nikita Nuzhdenko <[email protected]> Co-authored-by: faststream-actions[bot] <faststream-actions[bot]@users.noreply.github.com> Co-authored-by: Evgeny Demchenko <[email protected]>
Description
Documentation for middlewares has been updated.
Type of change
Please delete options that are not relevant.
Checklist
scripts/lint.shshows no errors)scripts/test-cov.shscripts/static-analysis.sh