Skip to content

Neops Task Runner for Python

This repository provides the base infrastructure and SDK to create workers for your own function blocks.

Installation

For users (pip):

pip install neops-worker-sdk

For contributors (uv):

# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository and install dependencies
uv sync --group dev --extra test
  • Use a .env file (with python-dotenv):
cp .env.test .env
python -m dotenv -f .env run -- uv run neops_worker

Run the Worker

To run the worker locally:

uv run neops_worker

If installed via pip, run it from your virtual environment:

neops_worker

You can also use the module form:

python -m neops_worker_sdk.cli.neops_worker

Development Tools

This project uses a modern Python toolchain for development:

Tool Purpose Documentation
uv Fast Python package and project manager Getting Started
ruff Extremely fast Python linter and formatter Configuration
pyrefly Fast type checker for Python Documentation

Common Commands

Action Command
Install dependencies uv sync
Install with dev deps uv sync --group dev
Install with all groups uv sync --group dev --extra test
Add a package uv add <pkg>
Add dev package uv add --group dev <pkg>
Run a command uv run <cmd>
Run the worker uv run neops_worker
Build wheel uv build
Publish package uv publish

Code Quality Commands

Action Command
Format code uv run ruff format .
Check formatting uv run ruff format --check .
Lint code uv run ruff check .
Fix lint issues uv run ruff check --fix .
Type check uv run pyrefly check

Make Targets

# Run linting (format check + lint check)
make lint

# Auto-format code
make format

# Run type checking (pyrefly)
make typeCheck

Code Style

Type Checking

We enforce strict typing for all Python files. The codebase is checked with pyrefly:

uv run pyrefly check

Formatting and Linting

Code formatting and linting are enforced by ruff:

# Check formatting
uv run ruff format --check ./neops_worker_sdk ./examples

# Auto-format
uv run ruff format ./neops_worker_sdk ./examples

# Lint
uv run ruff check ./neops_worker_sdk ./examples

# Lint and auto-fix
uv run ruff check --fix ./neops_worker_sdk ./examples

Docker

Build and run with Docker:

# Build the image
docker build -t neops-worker-sdk .

# Run the worker
docker run neops-worker-sdk

# Run linting (CI target)
docker build --target linter -t neops-worker-sdk:lint .

# Run tests (CI target)
docker build --target test -t neops-worker-sdk:test .