Nats-py

Latest version: v2.7.2

Safety actively analyzes 622330 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 6

2.7.0

Added

- Added support for multiple filter consumers when using nats-server +v2.10
This is only supported when using the `pull_subscribe_bind` API:

python
await jsm.add_stream(name="multi", subjects=["a", "b", "c.>"])
cinfo = await jsm.add_consumer(
"multi",
name="myconsumer",
filter_subjects=["a", "b"],
)
psub = await js.pull_subscribe_bind("multi", "myconsumer")
msgs = await psub.fetch(2)
for msg in msgs:
await msg.ack()


- Added `subjects_filter` option to `js.stream_info()` API

python
stream = await js.add_stream(name="foo", subjects=["foo.>"])
for i in range(0, 5):
await js.publish("foo.%d" % i, b'A')

si = await js.stream_info("foo", subjects_filter=">")
print(si.state.subjects)
=> {'foo.0': 1, 'foo.1': 1, 'foo.2': 1, 'foo.3': 1, 'foo.4': 1}


Changed

- Changed kv.watch default `inactive_threshold` cleanup timeout to be 5 minutes.
It can now be customized as well by passing `inactive_threshold` as argument in seconds:


w = await kv.watchall(inactive_threshold=30.0)


- Changed `pull_subscribe_bind` first argument to be called `consumer` instead of `durable`
since it also supports ephemeral consumers. This should be backwards compatible.

python
psub = await js.pull_subscribe_bind(consumer="myconsumer", stream="test")

2.6.0

Added

- Added support to ephemeral pull consumers (412)

Changed

- Changed default max control line to 4K as in the server since v2.2

Fixed

- Fixed ordered consumer implementation not being recreated when consumer deleted (510)
- Fixed accounting issue pending data which would have caused slow consumers on ordered consumers using `next_msg`
- Fixed subscribe to missing stream not raising `NotFoundError` (499 )

**Full Changelog**: https://github.com/nats-io/nats.py/compare/v2.5.0...v2.6.0

2.5.0

Added

* Add tls_handshake_first option (https://github.com/nats-io/nats.py/pull/511)

Fixed
* fix: improve types on kv/object_store updates by tekumara in https://github.com/nats-io/nats.py/pull/497
* fix: KeyWatcher.updates() returns type of Entry | None by tekumara in https://github.com/nats-io/nats.py/pull/500

New Contributors
* tekumara made their first contribution in https://github.com/nats-io/nats.py/pull/497

**Full Changelog**: https://github.com/nats-io/nats.py/compare/v2.4.0...v2.5.0

2.4.0

Fixed

* Fixed Python 3.7 compatibility: use uuid4 to gen unique task names by Lancetnik in https://github.com/nats-io/nats.py/pull/457
* Fixed websocket connection when not using TLS (https://github.com/nats-io/nats.py/pull/463)
* Remove msg from fut.cancel to ensure backward compatibility by raprek in https://github.com/nats-io/nats.py/pull/479
* Fixed `connect()` by dsodx in https://github.com/nats-io/nats.py/pull/484
* Fixed auth to respect provided server address username and password if no_auth_user is set by anthonyjacques20 in https://github.com/nats-io/nats.py/pull/488
* Fixed reconnect in websockets: CLOSED WS connection detection by sebastian-king in https://github.com/nats-io/nats.py/pull/477

Added

* Consumers info offset by raprek in https://github.com/nats-io/nats.py/pull/459
* Allow passing nkey seed as string by databasedav in https://github.com/nats-io/nats.py/pull/468

Improved
* Coherently use f-strings by floscha in https://github.com/nats-io/nats.py/pull/460
* Add main branch from nats-server to CI by wallyqs in https://github.com/nats-io/nats.py/pull/464
* Fix docstring typo by floscha in https://github.com/nats-io/nats.py/pull/473
* Add missing pull subscriber declaration to docstring by floscha in https://github.com/nats-io/nats.py/pull/476
* Add code example to Subscription.messages docstring by floscha in https://github.com/nats-io/nats.py/pull/481

New Contributors
* floscha made their first contribution in https://github.com/nats-io/nats.py/pull/460
* raprek made their first contribution in https://github.com/nats-io/nats.py/pull/459
* anthonyjacques20 made their first contribution in https://github.com/nats-io/nats.py/pull/488
* dsodx made their first contribution in https://github.com/nats-io/nats.py/pull/484
* sebastian-king made their first contribution in https://github.com/nats-io/nats.py/pull/477

**Full Changelog**: https://github.com/nats-io/nats.py/compare/v2.3.1...v2.4.0

2.3.0

pip install nats-py


Added

- Added object store feature based on initial contribution by domderen (https://github.com/nats-io/nats.py/pull/452 || https://github.com/nats-io/nats.py/pull/446)

Upload example:

python
import nats
import asyncio

async def main():
nc = await nats.connect("locahost", name="object.py")
js = nc.jetstream()
obs = await js.create_object_store("nats-py-object-store")

object_name = 'my-file.mp4'
with open(object_name) as f:
await obs.put(object_name, f)

await nc.close()

if __name__ == '__main__':
asyncio.run(main())


Download example:

python
import nats
import asyncio

async def main():
nc = await nats.connect("localhost", name="object.py")
js = nc.jetstream()
obs = await js.object_store("nats-py-object-store")

files = await obs.list()
for f in files:
print(f.name, "-", f.size)

object_name = 'my-file.mp4'
with open("copy-"+object_name, 'w') as f:
await obs.get(object_name, f)

await nc.close()

if __name__ == '__main__':
asyncio.run(main())


- Updated the `WebSocketTransport` to detect the attempt to upgrade the connection to TLS by allanbank (https://github.com/nats-io/nats.py/pull/443)

Fixed

- Fixed example from jetstream pull subscriber sample by csuriano23 (https://github.com/nats-io/nats.py/pull/366)
- Fixed issue where protocol was changed for ws and wss if no port was
provided by bvanelli (https://github.com/nats-io/nats.py/pull/371)
- Fixed untreated error callbacks when using websockets by bvanelli (https://github.com/nats-io/nats.py/issues/361 || https://github.com/nats-io/nats.py/pull/375)
- Fixes to `next_msg` and tasks cancellation (https://github.com/nats-io/nats.py/pull/446)

Changed

- Updated signatures for 'servers' and 'discovered_servers' properties by jonchammer (https://github.com/nats-io/nats.py/pull/374)
- Move configs from setup.cfg into pyproject.toml by orsinium (https://github.com/nats-io/nats.py/pull/394)
- Forbid None for Msg.Metadata fields by orsinium (https://github.com/nats-io/nats.py/pull/401)
- Convert `republish` value into dataclass by orsinium (https://github.com/nats-io/nats.py/pull/405)
- Change the type of client_id to int by kkqy (https://github.com/nats-io/nats.py/pull/435)
- Raise asyncio.CancelledError back by charbonnierg (https://github.com/nats-io/nats.py/pull/378)
- Send credentials even if no_auth_required is set on INFO (https://github.com/nats-io/nats.py/pull/399)
- Add sid property to nats.aio.msg.Msg class by charbonnierg (https://github.com/nats-io/nats.py/pull/430)
- Add custom inbox prefix support for JS pull subscribe by alparslanavci (https://github.com/nats-io/nats.py/pull/419)

Internal changes

- Sort imports by orsinium (https://github.com/nats-io/nats.py/pull/385)
- Make all type annotations lazy by orsinium (https://github.com/nats-io/nats.py/pull/386)
- Use the new type annotations syntax by orsinium (https://github.com/nats-io/nats.py/pull/388)
- Fixed incorrect formatting in `.travis.yml` by WillCodeCo (https://github.com/nats-io/nats.py/pull/420)

New Contributors
* csuriano23 made their first contribution in https://github.com/nats-io/nats.py/pull/366
* jonchammer made their first contribution in https://github.com/nats-io/nats.py/pull/374
* WillCodeCo made their first contribution in https://github.com/nats-io/nats.py/pull/420
* allanbank made their first contribution in https://github.com/nats-io/nats.py/pull/443
* kkqy made their first contribution in https://github.com/nats-io/nats.py/pull/435
* alparslanavci made their first contribution in https://github.com/nats-io/nats.py/pull/419

2.2.0

Added

* Added support sending requests with reconnected client (by charbonnierg https://github.com/nats-io/nats.py/pull/343)
* Added websockets support (by bvanelli https://github.com/nats-io/nats.py/pull/356)
* Added support for new KV features (https://github.com/nats-io/nats.py/pull/347 | https://github.com/nats-io/nats.py/pull/355)
- direct mode
- republish
* Added support to create consumers with a name (https://github.com/nats-io/nats.py/pull/358)

Changed

* Modernizes the way we package and distribute nats.py by using PEP621 (by 4383 https://github.com/nats-io/nats.py/pull/341)
* Removed the server address from reconnection logs in examples (by 4383 https://github.com/nats-io/nats.py/pull/346)
* Makes connections examples more configurable (by 4383 (https://github.com/nats-io/nats.py/pull/342)
* update account limits (https://github.com/nats-io/nats.py/pull/357)

Fixed

* Fixed typos (by 4383 https://github.com/nats-io/nats.py/pull/338)
* Fixed Client.publish docstring typo (by blablatdinov (https://github.com/nats-io/nats.py/pull/344)
* Fixed cleaning up subscriptions with message iterator (by bvanelli (https://github.com/nats-io/nats.py/pull/350)
* Fixed support v2 JS.ACK format (by bruth (https://github.com/nats-io/nats.py/pull/351)

**Full Changelog**: https://github.com/nats-io/nats.py/compare/v2.1.7...v2.2.0

Page 1 of 6

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.