Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2

updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
labels:
- dependencies
groups:
minor-and-patch:
update-types:
- minor
- patch

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
labels:
- dependencies
groups:
minor-and-patch:
update-types:
- minor
- patch
43 changes: 43 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Pre-commit Autoupdate

on:
schedule:
- cron: '0 8 * * 1' # Every Monday at 08:00 UTC
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
autoupdate:
name: Update pre-commit hooks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install pre-commit
run: uv pip install --system pre-commit

- name: Run pre-commit autoupdate
run: pre-commit autoupdate

- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
commit-message: 'Update pre-commit hooks'
title: 'Update pre-commit hooks'
body: |
Automated update of pre-commit hook versions via `pre-commit autoupdate`.
branch: dependabot/pre-commit-autoupdate
labels: dependencies
49 changes: 0 additions & 49 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,6 @@ name: Test
on: [push, pull_request]

jobs:
test-pycparser:
name: Test pycparser (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
python-version: '3.10'

steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

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

- name: Install dependencies
run: uv pip install --system -e .[test]

- name: Test pycparser backend
run: pytest ./test -m "not libclang"

test-libclang:
name: Test libclang (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -102,25 +75,3 @@ jobs:
- name: Test (macOS, skip real headers)
if: runner.os == 'macOS'
run: pytest ./test -m "not real_headers"

test-windows:
name: Test Windows (pycparser)
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install dependencies
run: uv pip install --system -e .[test]

- name: Test pycparser backend
run: pytest ./test -m "not libclang"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ docs/plans/
logs/
.envrc
uv.lock
.swarm/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ repos:
args: [--strict]
files: ^autopxd/
additional_dependencies:
- pycparser
- click
- headerkit @ git+https://github.com/axiomantic/headerkit.git@v0.6.1
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.0.0] - 2026-02-28

### Added
- `headerkit` as a runtime dependency

### Changed
- IR classes, PxdWriter, and type registries now provided by headerkit (re-exported via shim modules for backward compatibility)
- libclang is now the only backend
- `--backend auto` now requires libclang (no pycparser fallback)

### Removed
- `pycparser` backend and all pycparser-specific code
- `autopxd.declarations` module
- `regenerate_stubs.py` script
- `stubs/include/` and `stubs/darwin-include/` directories (pycparser fake headers)
- `pycparser` runtime dependency
- `--backend pycparser` CLI option
- Fallback from libclang to pycparser behavior
- `autopxd.cython_types` module (use `headerkit.writers._cython_types` directly)
- `autopxd.keywords` module (use `headerkit.writers._cython_keywords` directly)
- `IGNORE_DECLARATIONS` and `STDINT_DECLARATIONS` from `autopxd.declarations` (unused)
- Dead code branches in `translate()` for backends not supporting full ParserBackend protocol
- `test/test_ir.py` and `test/test_cython_types.py` (tests moved to headerkit)

## [3.2.2] - 2025-12-19

### Fixed
Expand Down Expand Up @@ -179,7 +203,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- macOS support

[Unreleased]: https://github.com/elijahr/python-autopxd2/compare/v3.2.0...HEAD
[Unreleased]: https://github.com/elijahr/python-autopxd2/compare/v4.0.0...HEAD
[4.0.0]: https://github.com/elijahr/python-autopxd2/compare/v3.2.2...v4.0.0
[3.2.2]: https://github.com/elijahr/python-autopxd2/compare/v3.2.1...v3.2.2
[3.2.1]: https://github.com/elijahr/python-autopxd2/compare/v3.2.0...v3.2.1
[3.2.0]: https://github.com/elijahr/python-autopxd2/compare/v3.1.1...v3.2.0
[3.1.1]: https://github.com/elijahr/python-autopxd2/compare/v3.1.0...v3.1.1
[3.1.0]: https://github.com/elijahr/python-autopxd2/compare/v3.0.0...v3.1.0
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ autopxd2 parses C header files and generates Cython `.pxd` files, enabling you t

### C Features

| Feature | libclang | pycparser (legacy) |
|---------|:--------:|:------------------:|
| Structs and unions | ✓ | ✓ |
| Enums (with expressions) | ✓ | ✓ |
| Typedefs | ✓ | ✓ |
| Function declarations | ✓ | ✓ |
| Function pointers | ✓ | ✓ |
| Arrays (fixed and flexible) | ✓ | ✓ |
| Pointers and const qualifiers | ✓ | ✓ |
| Forward declarations | ✓ | ✓ |
| Anonymous structs/unions | ✓ | ✓ |
| Bit fields | ✓ | ✓ |
| `#define` macros (int, float, string) | ✓ | |
| Circular type dependencies | ✓ | |
| Feature | Supported |
|---------|:---------:|
| Structs and unions | ✓ |
| Enums (with expressions) | ✓ |
| Typedefs | ✓ |
| Function declarations | ✓ |
| Function pointers | ✓ |
| Arrays (fixed and flexible) | ✓ |
| Pointers and const qualifiers | ✓ |
| Forward declarations | ✓ |
| Anonymous structs/unions | ✓ |
| Bit fields | ✓ |
| `#define` macros (int, float, string) | ✓ |
| Circular type dependencies | ✓ |

### C++ Features (libclang only)

Expand Down Expand Up @@ -69,7 +69,7 @@ llvm-config --version # e.g., 18.1.3 means you need clang2==18.*
pip install "clang2==18.*"
```

Without `clang2`, autopxd2 falls back to the legacy pycparser backend (C99 only, no macros, no circular dependency handling). If clang2 is missing, autopxd2 will detect your LLVM version and show the exact install command.
Without `clang2`, autopxd2 cannot parse headers. You can also install libclang with headerkit: `python -m headerkit.install_libclang`. If clang2 is missing, autopxd2 will detect your LLVM version and show the exact install command.

See the [installation docs](https://elijahr.github.io/python-autopxd2/dev/getting-started/installation/) for platform-specific LLVM setup (macOS with Homebrew, Ubuntu/Debian, Windows).

Expand Down Expand Up @@ -177,7 +177,7 @@ cdef extern from "input.hpp":
vector[string] get_items()
```

**Note:** Auto-import requires the libclang backend for header detection. The pycparser backend does not track included headers.
**Note:** Auto-import uses the libclang backend for header detection.

## Documentation

Expand Down
Loading
Loading