Skip to content

Commit f57f41a

Browse files
committed
Implement CI workflow
1 parent 27837b3 commit f57f41a

9 files changed

Lines changed: 219 additions & 46 deletions

File tree

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ updates:
1010
directory: "/"
1111
schedule:
1212
interval: weekly
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: weekly

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
workflow_call:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
concurrency:
11+
group: ci-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
lint:
19+
name: Lint and type check
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v6
23+
with:
24+
persist-credentials: false
25+
26+
- uses: astral-sh/setup-uv@v6
27+
with:
28+
python-version: "3.13"
29+
30+
- name: Install dependencies
31+
run: uv sync --all-extras --all-groups
32+
33+
- name: Format check
34+
run: uv run ruff format --check .
35+
36+
- name: Lint
37+
run: uv run ruff check .
38+
39+
- name: Type check
40+
run: uv run pyright
41+
42+
test:
43+
name: Test (Python ${{ matrix.python-version }})
44+
runs-on: ubuntu-latest
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
python-version: ["3.13", "3.14"]
49+
continue-on-error: ${{ matrix.python-version != '3.13' }}
50+
steps:
51+
- uses: actions/checkout@v6
52+
with:
53+
persist-credentials: false
54+
55+
- uses: astral-sh/setup-uv@v6
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
59+
- name: Install dependencies
60+
run: uv sync --all-extras --all-groups
61+
62+
- name: Run tests
63+
run: uv run pytest -q
64+
65+
build:
66+
name: Build distribution
67+
needs: [lint, test]
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v6
71+
with:
72+
persist-credentials: false
73+
74+
- uses: astral-sh/setup-uv@v6
75+
76+
- name: Build sdist and wheel
77+
run: uv build
78+
79+
- name: Upload distribution artifacts
80+
uses: actions/upload-artifact@v6
81+
with:
82+
name: python-package-distributions
83+
path: dist/

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
ci:
13+
name: CI
14+
uses: ./.github/workflows/ci.yml
15+
16+
publish:
17+
name: Publish to PyPI
18+
needs: ci
19+
runs-on: ubuntu-latest
20+
environment:
21+
name: pypi
22+
url: https://pypi.org/p/nighthawk-python
23+
permissions:
24+
id-token: write
25+
steps:
26+
- name: Download distribution artifacts
27+
uses: actions/download-artifact@v6
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
32+
- name: Publish to PyPI
33+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
[![PyPI](https://img.shields.io/pypi/v/nighthawk-python)](https://pypi.org/project/nighthawk-python)
2+
![PyPI - Downloads](https://img.shields.io/pypi/dm/nighthawk-python)
3+
[![license](https://img.shields.io/github/license/psg-mit/nighthawk-python.svg)](https://github.com/kurusugawa-computer/nighthawk-python/tree/main/LICENSE)
4+
[![issue resolution](https://img.shields.io/github/issues-closed-raw/kurusugawa-computer/nighthawk-python)](https://github.com/kurusugawa-computer/nighthawk-python/issues)
5+
16
# Nighthawk
27

38
<div align="center">
4-
<img src="docs/assets/nighthawk_logo-128x128.png" alt="logo" width="128px" margin="10px"></img>
9+
<img src="https://github.com/kurusugawa-computer/nighthawk-python/raw/main/docs/assets/nighthawk_logo-128x128.png" alt="nighthawk-logo" width="128px" margin="10px"></img>
510
</div>
611

712
Nighthawk is an experimental Python library exploring a clear separation between **hard control** (Python code) for strict procedure and deterministic flow, and **soft reasoning** (an LLM) for semantic interpretation inside small embedded "Natural blocks". It is a compact reimplementation of the core ideas of [Nightjar](https://github.com/psg-mit/nightjarpy).
@@ -13,7 +18,7 @@ Prerequisites: Python 3.13+
1318
Install Nighthawk and a provider:
1419

1520
```bash
16-
pip install "nighthawk @ git+https://github.com/kurusugawa-computer/nighthawk-python" pydantic-ai-slim[openai]
21+
pip install nighthawk-python pydantic-ai-slim[openai]
1722
```
1823

1924
Save as `quickstart.py`:

docs/coding-agent-backends.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The `claude-code-sdk` backend uses the [Claude Agent SDK](https://docs.anthropic
5050
### Installation
5151

5252
```bash
53-
pip install nighthawk[claude-code-sdk]
53+
pip install nighthawk-python[claude-code-sdk]
5454
```
5555

5656
### Environment
@@ -93,7 +93,7 @@ The `claude-code-cli` backend invokes `claude -p` directly as a subprocess, with
9393
### Installation
9494

9595
```bash
96-
pip install nighthawk[claude-code-cli]
96+
pip install nighthawk-python[claude-code-cli]
9797
```
9898

9999
The `claude` CLI must be installed separately (it is a system tool, not a Python package).
@@ -140,7 +140,7 @@ The `codex` backend runs Codex CLI as a subprocess via `codex exec` and communic
140140
### Installation
141141

142142
```bash
143-
pip install nighthawk[codex]
143+
pip install nighthawk-python[codex]
144144
```
145145

146146
### Environment

docs/quickstart.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Prerequisites: Python 3.13+
99
Install Nighthawk and a provider:
1010

1111
```bash
12-
pip install "nighthawk @ git+https://github.com/kurusugawa-computer/nighthawk-python" pydantic-ai-slim[openai]
12+
pip install nighthawk-python pydantic-ai-slim[openai]
1313
```
1414

1515
For other providers, see [Backends and model identifiers](#backends-and-model-identifiers) below.
@@ -67,9 +67,9 @@ Nighthawk-specific backends (not backed by Pydantic AI):
6767

6868
| Extra | Install | Example identifier |
6969
|---|---|---|
70-
| `claude-code-sdk` | `pip install nighthawk[claude-code-sdk]` | `claude-code-sdk:default` |
71-
| `claude-code-cli` | `pip install nighthawk[claude-code-cli]` | `claude-code-cli:default` |
72-
| `codex` | `pip install nighthawk[codex]` | `codex:default` |
70+
| `claude-code-sdk` | `pip install nighthawk-python[claude-code-sdk]` | `claude-code-sdk:default` |
71+
| `claude-code-cli` | `pip install nighthawk-python[claude-code-cli]` | `claude-code-cli:default` |
72+
| `codex` | `pip install nighthawk-python[codex]` | `codex:default` |
7373

7474
See [Providers](providers.md) for the default and recommended models.
7575

@@ -103,7 +103,7 @@ Set the environment variable before running: `export OPENAI_API_KEY=sk-xxxxxxxxx
103103

104104
**`ModuleNotFoundError` for a provider**
105105

106-
Install the required provider package. For Pydantic AI providers: `pip install pydantic-ai-slim[openai]`. For coding agent backends: `pip install nighthawk[claude-code-sdk]`.
106+
Install the required provider package. For Pydantic AI providers: `pip install pydantic-ai-slim[openai]`. For coding agent backends: `pip install nighthawk-python[claude-code-sdk]`.
107107

108108
## Next Steps
109109

pyproject.toml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
[project]
2-
name = "nighthawk"
2+
name = "nighthawk-python"
33
version = "0.1.0"
44
description = "An experimental Python library that embeds Natural blocks inside Python functions and executes them using an LLM."
55
readme = "README.md"
66
requires-python = ">=3.13"
7+
license = "MIT"
8+
license-files = ["LICENSE"]
9+
authors = [
10+
{name = "Kurusugawa Computer Inc.", email = "oss@kurusugawa.jp"},
11+
]
12+
keywords = ["llm", "natural-language", "interoperability", "pydantic-ai", "embedded-dsl"]
13+
classifiers = [
14+
"Development Status :: 3 - Alpha",
15+
"Intended Audience :: Developers",
16+
"License :: OSI Approved :: MIT License",
17+
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3.13",
19+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
20+
"Topic :: Software Development :: Libraries :: Python Modules",
21+
"Typing :: Typed",
22+
]
23+
724
dependencies = [
825
"headson>=0.16.1",
926
"pydantic>=2",
@@ -12,6 +29,11 @@ dependencies = [
1229
"tiktoken>=0.12",
1330
]
1431

32+
[project.urls]
33+
Repository = "https://github.com/kurusugawa-computer/nighthawk-python"
34+
Documentation = "https://kurusugawa-computer.github.io/nighthawk-python/"
35+
"Bug Tracker" = "https://github.com/kurusugawa-computer/nighthawk-python/issues"
36+
1537
[project.optional-dependencies]
1638
claude-code-sdk = [
1739
"claude-agent-sdk>=0.1",
@@ -26,6 +48,7 @@ codex = [
2648
[dependency-groups]
2749
dev = [
2850
"logfire>=4",
51+
"pyright>=1.1",
2952
"pytest>=9",
3053
"pytest-asyncio>=1.3.0",
3154
"ruff>=0.15",
@@ -44,7 +67,7 @@ build-backend = "hatchling.build"
4467
packages = ["src/nighthawk"]
4568

4669
[tool.ruff]
47-
target-version = "py313"
70+
target-version = "py312"
4871
line-length = 150
4972

5073
[tool.ruff.lint]

src/nighthawk/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def _normalize_model_settings(cls, value: Any) -> dict[str, Any] | None:
180180
if isinstance(value, BaseModel):
181181
return value.model_dump()
182182
return value
183+
183184
prompts: StepPromptTemplates | None = None
184185
context_limits: StepContextLimits | None = None
185186
json_renderer_style: JsonRendererStyle | None = None

0 commit comments

Comments
 (0)