Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
92 changes: 0 additions & 92 deletions .github/workflows/ci.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/job-prek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint & type check

on:
workflow_call:

jobs:
prek:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- run: uv sync --all-extras --dev

- run: uv run prek run --all-files

- run: uv run mypy src/
26 changes: 26 additions & 0 deletions .github/workflows/job-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Tests

on:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- run: uv sync --all-extras --dev

- run: uv run pytest
13 changes: 13 additions & 0 deletions .github/workflows/on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Post-merge checks

on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/job-test.yml
15 changes: 15 additions & 0 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: PR checks

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
prek:
uses: ./.github/workflows/job-prek.yml

test:
uses: ./.github/workflows/job-test.yml
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
repos:
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.2
hooks:
- id: uv-lock
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/google/yamlfmt
rev: v0.16.0
hooks:
- id: yamlfmt
- repo: https://github.com/adrienverge/yamllint
rev: v1.37.1
hooks:
- id: yamllint
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args: [--ignore-words=ignore-spelling-words.txt]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
hooks:
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
9 changes: 9 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
extends: default

rules:
document-start: disable
line-length:
max: 120
truthy:
check-keys: false
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.1] - 2026-02-13

### Added
- Comprehensive docstrings for all public methods

### Changed
- Migrated from Poetry to uv for dependency management and project tooling
- Switched build backend from poetry-core to hatchling (PEP 621)
- Replaced pre-commit with prek as the hook runner
- Expanded pre-commit hooks: added codespell, yamllint, yamlfmt, trailing-whitespace, end-of-file-fixer, check-merge-conflict, check-toml, check-yaml, check-added-large-files
- Added `"B"` (flake8-bugbear) to ruff lint rules
- Restructured CI from single workflow to reusable workflow pattern (on-pr, on-merge, job-prek, job-test)
- CI now uses `astral-sh/setup-uv@v5` instead of `snok/install-poetry@v1`
- Improved documentation formatting for `order_by` parameters

## [0.1.0] - 2024-02-09
Expand Down Expand Up @@ -38,8 +47,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Development
- Ruff for linting and formatting
- Strict mypy type checking
- Poetry for dependency management
- uv for dependency management
- httpx for HTTP client (sync + async)

[Unreleased]: https://github.com/nansen-ai/nansen-python-sdk/compare/v0.1.0...HEAD
[Unreleased]: https://github.com/nansen-ai/nansen-python-sdk/compare/v0.1.1...HEAD
[0.1.1]: https://github.com/nansen-ai/nansen-python-sdk/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/nansen-ai/nansen-python-sdk/releases/tag/v0.1.0
13 changes: 7 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ tests/ — pytest test suite with respx mocks
## Commands

```bash
poetry install # Install dependencies
poetry run pytest # Run all tests
poetry run ruff check . # Lint
poetry run mypy src/ # Type check
uv sync --all-extras --dev # Install dependencies
uv run pytest # Run all tests
uv run ruff check . # Lint
uv run mypy src/ # Type check
uv run prek run --all-files # Run all pre-commit hooks
```

## Adding a New Endpoint
Expand All @@ -55,7 +56,7 @@ The `examples/` directory has a runnable `try_*.py` script for every SDK endpoin

```bash
export NANSEN_API_KEY="your-key"
poetry run python examples/try_token_screener.py
uv run python examples/try_token_screener.py
```

## Conventions
Expand All @@ -69,7 +70,7 @@ poetry run python examples/try_token_screener.py

Follow [semantic versioning](https://semver.org/): **MAJOR.MINOR.PATCH**

Version is managed in `pyproject.toml` (line 3). When making changes that warrant a version bump:
Version is managed in `pyproject.toml`. When making changes that warrant a version bump:

1. **Suggest the appropriate version bump** based on the changes made
2. **Ask for user approval** before updating `pyproject.toml`
Expand Down
23 changes: 13 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ Thank you for considering contributing to the Nansen Python SDK! This document p

2. **Install dependencies**
```bash
poetry install
uv sync --all-extras --dev
```

3. **Set up pre-commit hooks**
```bash
poetry run pre-commit install
uv run prek install
```

## Running Tests

```bash
# Run all tests
poetry run pytest
uv run pytest

# Run with coverage
poetry run pytest --cov=src/nansen
uv run pytest --cov=src/nansen

# Run specific test file
poetry run pytest tests/test_resources/test_tgm.py
uv run pytest tests/test_resources/test_tgm.py
```

## Code Quality
Expand All @@ -39,16 +39,19 @@ Before submitting a PR, ensure your code passes all checks:

```bash
# Lint with Ruff
poetry run ruff check .
uv run ruff check .

# Format with Ruff
poetry run ruff format .
uv run ruff format .

# Type check with mypy
poetry run mypy src/
uv run mypy src/

# Run all pre-commit hooks
uv run prek run --all-files
```

Pre-commit hooks will automatically run these checks, but you can run them manually as well.
Pre-commit hooks (via prek) will automatically run these checks, but you can run them manually as well.

## Code Style

Expand Down Expand Up @@ -122,7 +125,7 @@ If you've added a new endpoint, test it manually:

```bash
export NANSEN_API_KEY="your-key"
poetry run python examples/try_your_endpoint.py
uv run python examples/try_your_endpoint.py
```

## Questions?
Expand Down
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ Python SDK for the [Nansen](https://docs.nansen.ai/) blockchain analytics API.

## Installation

```bash
poetry add nansen
```

Or with pip:

```bash
pip install nansen
```
Expand All @@ -19,7 +13,7 @@ pip install nansen
```bash
git clone https://github.com/nansen-ai/nansen-python-sdk.git
cd nansen-python-sdk
poetry install
uv sync --all-extras --dev
```

## Quick Start
Expand Down Expand Up @@ -183,9 +177,9 @@ The `examples/` directory contains runnable scripts for every SDK endpoint. Each

```bash
export NANSEN_API_KEY="your-key"
poetry run python examples/try_token_screener.py
poetry run python examples/try_smart_money_netflow.py
poetry run python examples/try_address_balance.py
uv run python examples/try_token_screener.py
uv run python examples/try_smart_money_netflow.py
uv run python examples/try_address_balance.py
# ... etc
```

Expand Down
20 changes: 20 additions & 0 deletions ignore-spelling-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
nansen
httpx
pydantic
defi
pnl
tgm
dcas
perp
perps
netflow
cex
dex
leaderboard
screener
hashi
untradeable
respx
anyio
testpaths
asyncio
Loading
Loading