This is a start towards having fully automatic updating of the flintlib .pxd files.
I have made a few improvements to the bin/rst_to_pxd.py script so that it can generate the files fully without editing by commenting out functions with unrecognised types.
I also added a script bin/all_rst_to_pxd.sh like:
#!/usr/bin/env bash
FLINT_DOC_DIR=$1
set -e
modules="\
fmpz\
fmpz_factor\
fmpz_poly\
fmpz_poly_factor\
fmpz_mat\
fmpz_lll\
"
for module in $modules; do
echo "Processing $module"
bin/rst_to_pxd.py flint/$module --flint-doc-dir=$FLINT_DOC_DIR > src/flint/flintlib/$module.pxd
done
The idea would be for that modules list to end up having all of the FLINT modules and generating all of the .pxd files.
The script only extracts functions from the docs but not structs or macros. I moved one macro to flint.pxd but otherwise I factored out the structs from these files into a flint_types.pxd. The structs still need to be edited manually but we should organise them according to the way they are in the flint headers:
I checked the structs against the FLINT code and updating some things like long -> slong or mp_limb -> ulong.
There was one function missing from the docs fmpz_factor_expand which I manually added to flint_types.pxd.
Running the script like this has also update the types and names in a bunch of function definitions.
We should do this for all of the auto-generated files so that they can be kept up to date in a single command and then we can just add the entire lot in one go.
This is a start towards having fully automatic updating of the flintlib .pxd files.
I have made a few improvements to the
bin/rst_to_pxd.py
script so that it can generate the files fully without editing by commenting out functions with unrecognised types.I also added a script
bin/all_rst_to_pxd.sh
like:The idea would be for that
modules
list to end up having all of the FLINT modules and generating all of the .pxd files.The script only extracts functions from the docs but not structs or macros. I moved one macro to
flint.pxd
but otherwise I factored out the structs from these files into aflint_types.pxd
. The structs still need to be edited manually but we should organise them according to the way they are in the flint headers:I checked the structs against the FLINT code and updating some things like
long -> slong
ormp_limb -> ulong
.There was one function missing from the docs
fmpz_factor_expand
which I manually added toflint_types.pxd
.Running the script like this has also update the types and names in a bunch of function definitions.
We should do this for all of the auto-generated files so that they can be kept up to date in a single command and then we can just add the entire lot in one go.
See also https://github.com/flintlib/python-flint/issues/54 which discusses auto-generating cython bindings for every Flint function.