Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
poetry-version: ["1.8.3"]
pydantic-version: ["pydantic<2", "pydantic>=2"]


services:
nats:
Expand All @@ -33,6 +34,8 @@ jobs:
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install Dependencies
run: poetry install
run: |
poetry install
pip install --upgrade "${{ matrix.pydantic-version }}"
- name: Run CI scripts
run: make ci
82 changes: 26 additions & 56 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,63 +1,33 @@
exclude: ^(blib2to3/|profiling/|tests/data/|\.mypy/|\.tox/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v2.1.0
- repo: git@github.com:pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: detect-private-key
- id: requirements-txt-fixer
- id: check-case-conflict
- id: check-json
- id: debug-statements
- id: check-merge-conflict
- id: check-symlinks
- id: end-of-file-fixer
- id: pretty-format-json
- id: requirements-txt-fixer
- id: check-case-conflict
- id: check-json
- id: debug-statements
- id: check-merge-conflict
- id: check-symlinks
- id: end-of-file-fixer
- id: check-added-large-files
- id: check-toml
- id: trailing-whitespace
- id: pretty-format-json
args:
- --autofix
- id: trailing-whitespace
- repo: local
- --autofix
- id: trailing-whitespace
- repo: local
hooks:
- id: black
args: ["-S", "-l", "120"]
name: black
language: system
entry: black
types: [python]
- id: flake8
args: ["--ignore", "F722,W503,E501,E741,W605,E203,C901,F541", "."]
name: flake8
language: system
entry: flake8
types: [python]
- repo: https://github.com/humitos/mirrors-autoflake.git
rev: v1.1
- id: black
name: black
language: system
entry: black
types: [python]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
hooks:
- id: autoflake
- id: ruff
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
]
- repo: https://github.com/timothycrosley/isort.git
rev: 5.1.4
hooks:
- id: isort
args:
[
"--multi-line=3",
"--trailing-comma",
"--force-grid-wrap=0",
"--combine-as",
"--line-width",
"120",
"--apply",
"--thirdparty",
"pydantic",
"natsapi",
]
name: isort
entry: isort
require_serial: true
language: python
types: [python]
- --fix
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
##---------- Variables --------------------------------------------------------
PREFIX = /usr/local # Default installation directory
PYTEST_GENERAL_FLAGS := -vvvx --asyncio-mode=auto
PYTEST_COV_FLAGS := --cov=natsapi --cov-append --cov-report=term-missing --cov-fail-under=92
PYTEST_COV_ENV := COV_CORE_SOURCE=natsapi COV_CORE_CONFIG=.coveragerc
PYTEST_COV_FLAGS := --cov=natsapi --cov-append --cov-report=term-missing --cov-fail-under=85
PYTEST_COV_ENV := COV_CORE_SOURCE=natsapi COV_CORE_CONFIG=.coveragerc COV_CORE_DATAFILE=.coverage.eager

##---------- Build targets ----------------------------------------------------

Expand All @@ -20,10 +20,7 @@ testr: ## Run tests with entr
find natsapi tests | entr -r poetry run pytest --disable-warnings -vvvx

lint: ## Lint checks
poetry run flake8 .

isort: ## Sort checks
poetry run isort
poetry run ruff check .

format: ## Format checks
poetry run black .
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/frontend-gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import httpx
import nats


from fastapi import FastAPI, Request
from pydantic import BaseModel

Expand Down
3 changes: 2 additions & 1 deletion examples/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from natsapi import NatsAPI
import asyncio

from natsapi import NatsAPI


async def main():
app = await NatsAPI("client").startup()
Expand Down
3 changes: 2 additions & 1 deletion examples/minimal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from natsapi import NatsAPI, SubjectRouter
from pydantic import BaseModel

from natsapi import NatsAPI, SubjectRouter


class Message(BaseModel):
message: str
Expand Down
Loading