A friendly fork of autopxd https://github.com/tarruda/python-autopxd
It generates .pxd
files automatically from .h
files.
- Python 3.10
- Python 3.11
- Python 3.12
- Python 3.13
pip install autopxd2
Usage: autopxd [OPTIONS] [INFILE] [OUTFILE]
Generate a Cython pxd file from a C header file.
Options:
-v, --version Print program version and exit.
-I, --include-dir <dir> Allow the C preprocessor to search for files
in <dir>.
-D, --compiler-directive <directive>
Additional directives for the C compiler.
--debug / --no-debug Dump preprocessor output to stderr.
-h, --help Show this message and exit.
Contributions are welcome! Please ensure that your code includes unit tests. To install the package in development mode and run tests, use the following commands:
python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
pytest
Additionally, we use pre-commit to ensure code quality. To install pre-commit and run it, use the following commands:
pip install pre-commit
pre-commit install
pre-commit run --all-files
- Greatly improve time taken by
vswhere.exe
to findcl.exe
on Windows #55 - Refactor installation to use only pyproject.toml. #53
- Update linting to use pre-commit #53
- Add contribution guidelines #53
- Improve handling of non-literal-as-value in enum parsing #52
- Fix parsing crash when using binary operation in enum #51
- Fix use configuration of
vswhere.exe
to findcl.exe
on Windows #49
- Add: Support for Python 3.12 from Michael Milton #45
- Add: Support for char and binary expression in enum from Poiuzy & Emmanuel Leblond #47
- Release now also provide a Wheel on Pypi from Emmanuel Leblond ##46
- Add: Support for const & volatile qualifiers from Emmanuel Leblond #42
- Add: Microsoft Visual C++ support from Steve Dower #40
- Add:
--regex
for arbitrary conversions - Fix: Various other fixes and improvements from Mads Ynddal in #38
- Fix: Windows CRLF issue (#24)
- Fix: remove unnecessary
importlib_resources
frominstall_requires
- Migrate to
setup.cfg
- Add:
--compiler-directive
option to pass along to the compiler - Add: some type annotations (
nodes.py
) - Deprecation: Drop support for Python 2
- Add: linting, format with black
- Add: Migrate from Travis CI to Github Actions
- Add: Support for macOS
- Refactoring of the code DONE
- Adding tests for PEP8 DONE
- Uploading to PyPi DONE
- Check that the generated code is correct by comparing it to the libc in Cython
- More tests
- Merge it into Cython so that the
.pxd
files aren't necessary anymore? Maybe.
It's difficult to catch all the corner cases.
To prevent generating Cython code for #include <foo>
system headers, python-autopxd2 uses stubbed headers. These are installed with the package and are located in the autopxd/stubs
directory.
To regenerate the stub headers, use the regenerate_stubs.py
script. This script downloads the necessary libc stub headers and optionally generates macOS stub headers. This is rarely necessary: only when libc or macOS introduce new header files. Submit a pull request with the updated files.