Skip to content

Commit c7a48fa

Browse files
committed
Some udpates.
1 parent d56186c commit c7a48fa

File tree

6 files changed

+81
-67
lines changed

6 files changed

+81
-67
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- mypy
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v6
1717
- name: Set up Python
1818
uses: actions/setup-python@v4
1919
with:
@@ -25,7 +25,7 @@ jobs:
2525
fmt:
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v1
28+
- uses: actions/checkout@v6
2929
- uses: actions-rs/toolchain@v1
3030
with:
3131
toolchain: stable
@@ -39,7 +39,7 @@ jobs:
3939
checks: write
4040
runs-on: ubuntu-latest
4141
steps:
42-
- uses: actions/checkout@v1
42+
- uses: actions/checkout@v6
4343
- uses: actions-rs/toolchain@v1
4444
with:
4545
toolchain: stable
@@ -48,11 +48,10 @@ jobs:
4848
- uses: auguwu/clippy-action@1.4.0
4949
with:
5050
token: ${{secrets.GITHUB_TOKEN}}
51-
deny: warnings
5251
pytest:
5352
runs-on: ubuntu-latest
5453
steps:
55-
- uses: actions/checkout@v1
54+
- uses: actions/checkout@v6
5655
- uses: actions-rs/toolchain@v1
5756
with:
5857
toolchain: stable
@@ -61,21 +60,16 @@ jobs:
6160
- uses: actions/setup-python@v6
6261
with:
6362
python-version: 3.x
64-
- id: setup-uv
65-
uses: astral-sh/setup-uv@v7
66-
with:
67-
enable-cache: true
68-
version: "latest"
6963
- id: prepare-container
7064
name: Prepare docker container
7165
run: docker compose up -d --wait
7266
- id: setup-venv
7367
name: Setup virtualenv
74-
run: uv venv
75-
- name: Build wheels
68+
run: python -m venv .venv
69+
- name: Build lib
7670
uses: PyO3/maturin-action@v1
7771
with:
78-
comand: dev --uv
72+
command: dev
7973
sccache: true
8074
- name: Run pytest
8175
run: uv run pytest -vv -n auto python/tests

.pre-commit-config.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ repos:
3939
args:
4040
- fmt
4141

42-
- id: clippy
42+
- id: clippy-fix
4343
types:
4444
- rust
45-
name: rust clippy
45+
name: fixing fixable clippy
4646
language: system
4747
pass_filenames: false
4848
entry: cargo
@@ -51,6 +51,16 @@ repos:
5151
- --fix
5252
- --allow-dirty
5353

54+
- id: clippy-check
55+
types:
56+
- rust
57+
name: rust clippy
58+
language: system
59+
pass_filenames: false
60+
entry: cargo
61+
args:
62+
- clippy
63+
5464
- id: check
5565
types:
5666
- rust

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[![PyPI](https://img.shields.io/pypi/v/natsrpy?style=for-the-badge)](https://pypi.org/project/scyllapy/)
2+
[![PyPI - Downloads](https://img.shields.io/pypi/dm/natsrpy?style=for-the-badge)](https://pypistats.org/packages/scyllapy)
3+
14
# Nats client
25

36
This is a client library for [NATS](https://nats.io) written in rust.

pyproject.toml

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ readme = "README.md"
55
requires-python = ">=3.10"
66
license-files = ["LICENSE"]
77
classifiers = [
8+
"Development Status :: 3 - Alpha",
9+
"Intended Audience :: Developers",
10+
"License :: OSI Approved :: MIT License",
811
"Programming Language :: Python :: Implementation :: CPython",
912
"Programming Language :: Python :: Implementation :: PyPy",
1013
"Programming Language :: Rust",
14+
"Topic :: System :: Networking",
1115
]
1216
dynamic = ["version"]
1317

18+
[[project.authors]]
19+
name = "Pavel Kirilin"
20+
email = "s3riussan@gmail.com"
21+
1422
[dependency-groups]
1523
dev = [
1624
"anyio>=4,<5",
@@ -28,23 +36,21 @@ features = ["pyo3/extension-module"]
2836
module-name = "natsrpy._inner"
2937
python-source = "python"
3038

31-
[tool.pytest]
32-
anyio_mode = "auto"
33-
3439
[tool.mypy]
3540
python_version = "3.10"
3641
strict = true
3742
ignore_missing_imports = true
38-
allow_subclassing_any = true
39-
allow_untyped_calls = true
40-
packages = ["taskiq_nats"]
43+
packages = ["natsrpy"]
4144
pretty = true
4245
implicit_reexport = true
4346
allow_untyped_decorators = true
4447
warn_return_any = false
4548

49+
[tool.pytest]
50+
anyio_mode = "auto"
51+
4652
[tool.ruff]
47-
target-version="py310"
53+
target-version = "py310"
4854
exclude = [".venv/"]
4955
line-length = 88
5056

@@ -53,54 +59,54 @@ mccabe = { max-complexity = 10 }
5359
# List of enabled rulsets.
5460
# See https://docs.astral.sh/ruff/rules/ for more information.
5561
select = [
56-
"E", # Error
57-
"F", # Pyflakes
58-
"W", # Pycodestyle
59-
"C90", # McCabe complexity
60-
"I", # Isort
61-
"N", # pep8-naming
62-
"D", # Pydocstyle
63-
"ANN", # Pytype annotations
64-
"S", # Bandit
65-
"B", # Bugbear
66-
"COM", # Commas
67-
"C4", # Comprehensions
68-
"ISC", # Implicit string concat
69-
"PIE", # Unnecessary code
70-
"T20", # Catch prints
71-
"PYI", # validate pyi files
72-
"Q", # Checks for quotes
73-
"RSE", # Checks raise statements
74-
"RET", # Checks return statements
75-
"SLF", # Self checks
76-
"SIM", # Simplificator
77-
"PTH", # Pathlib checks
78-
"ERA", # Checks for commented out code
79-
"PL", # PyLint checks
80-
"RUF", # Specific to Ruff checks
81-
"UP", # Pyupgrade
62+
"E", # Error
63+
"F", # Pyflakes
64+
"W", # Pycodestyle
65+
"C90", # McCabe complexity
66+
"I", # Isort
67+
"N", # pep8-naming
68+
"D", # Pydocstyle
69+
"ANN", # Pytype annotations
70+
"S", # Bandit
71+
"B", # Bugbear
72+
"COM", # Commas
73+
"C4", # Comprehensions
74+
"ISC", # Implicit string concat
75+
"PIE", # Unnecessary code
76+
"T20", # Catch prints
77+
"PYI", # validate pyi files
78+
"Q", # Checks for quotes
79+
"RSE", # Checks raise statements
80+
"RET", # Checks return statements
81+
"SLF", # Self checks
82+
"SIM", # Simplificator
83+
"PTH", # Pathlib checks
84+
"ERA", # Checks for commented out code
85+
"PL", # PyLint checks
86+
"RUF", # Specific to Ruff checks
87+
"UP", # Pyupgrade
8288
]
8389
ignore = [
84-
"D105", # Missing docstring in magic method
85-
"D107", # Missing docstring in __init__
86-
"D212", # Multi-line docstring summary should start at the first line
87-
"D401", # First line should be in imperative mood
88-
"D104", # Missing docstring in public package
89-
"D100", # Missing docstring in public module
90-
"ANN401", # typing.Any are disallowed in `**kwargs
91-
"PLR0913", # Too many arguments for function call
92-
"D106", # Missing docstring in public nested class
93-
"PYI021", # Docstrings should not be included in stubs
90+
"D105", # Missing docstring in magic method
91+
"D107", # Missing docstring in __init__
92+
"D212", # Multi-line docstring summary should start at the first line
93+
"D401", # First line should be in imperative mood
94+
"D104", # Missing docstring in public package
95+
"D100", # Missing docstring in public module
96+
"ANN401", # typing.Any are disallowed in `**kwargs
97+
"PLR0913", # Too many arguments for function call
98+
"D106", # Missing docstring in public nested class
99+
"PYI021", # Docstrings should not be included in stubs
94100
]
95101

96102
[tool.ruff.lint.per-file-ignores]
97103
"python/tests/*" = [
98-
"S101", # Use of assert detected
99-
"S301", # Use of pickle detected
100-
"D103", # Missing docstring in public function
101-
"SLF001", # Private member accessed
102-
"S311", # Standard pseudo-random generators are not suitable for security/cryptographic purposes
103-
"D101", # Missing docstring in public class
104+
"S101", # Use of assert detected
105+
"S301", # Use of pickle detected
106+
"D103", # Missing docstring in public function
107+
"SLF001", # Private member accessed
108+
"S311", # Standard pseudo-random generators are not suitable for security/cryptographic purposes
109+
"D101", # Missing docstring in public class
104110
]
105111

106112
[tool.ruff.lint.pydocstyle]

src/js/stream.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ pub struct StreamMessage {
565565
impl StreamMessage {
566566
pub fn from_nats_message(
567567
py: Python,
568-
msg: async_nats::jetstream::message::StreamMessage,
568+
msg: &async_nats::jetstream::message::StreamMessage,
569569
) -> NatsrpyResult<Self> {
570570
let time = msg.time.to_utc();
571571
let tz_info = PyTzInfo::utc(py)?;
@@ -630,7 +630,8 @@ impl Stream {
630630
let ctx = self.stream.clone();
631631
natsrpy_future(py, async move {
632632
let message = ctx.read().await.direct_get(sequence).await?;
633-
let result = Python::attach(move |gil| StreamMessage::from_nats_message(gil, message))?;
633+
let result =
634+
Python::attach(move |gil| StreamMessage::from_nats_message(gil, &message))?;
634635
Ok(result)
635636
})
636637
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(
1+
#![deny(
22
// Base lints.
33
clippy::all,
44
// Some pedantic lints.

0 commit comments

Comments
 (0)