Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing multiple interfaces #72

Open
ivan-pi opened this issue May 22, 2022 · 4 comments
Open

Testing multiple interfaces #72

ivan-pi opened this issue May 22, 2022 · 4 comments
Labels
question Further information is requested tests

Comments

@ivan-pi
Copy link
Member

ivan-pi commented May 22, 2022

Currently, MINPACK exports 3 API's:

  • the original Fortran API
  • the C API
  • the Python API

There are some minimal tests for each of the API's and a big messy collection of Fortran test functions.

Clearly, some minimal tests for each of the different interfaces are needed in order to test the correctness of the binding, with respect to argument passing, types, side-effects, etc. For the actual algorithms in Fortran however, it doesn't matter in which languages / interface the tests are written.

Does it make sense to write the algorithm tests (#10, #35) in Python?

This would test all three interfaces simultaneously. It also has the advantage of faster development due to dynamic typing, simpler output formatting, and other high-level properties of Python. Moreover the larger Python community could support us with their CI/CD knowledge, e.g. from SciPy and other big Python libraries.

cc @awvwgk @ilayn @certik

@ivan-pi ivan-pi added question Further information is requested tests labels May 22, 2022
@awvwgk
Copy link
Member

awvwgk commented May 22, 2022

The issue is the likelihood of the tests flagging problematic behavior, I would only run the Python tests if I work on the Python bindings, while I would always run the Fortran and C tests when working on the actual library. In the CI we will run all tests, but for local development running the Python tests can feel unpractical. Note that the fpm based tests are currently not even running the tests for the C binding because the required fpm feature is not yet released.

@certik
Copy link
Member

certik commented May 22, 2022

I personally would test Fortran in Fortran and only focus on Fortran. I don't have good development experience needing more than one language for the day to day tasks.

The Python bindings are fully separate, and yes, they need some tests, but only of those bindings. They can assume that the underlying Fortran code works correctly (if there is a bug, we fix it and add a Fortran test).

@ilayn
Copy link

ilayn commented May 23, 2022

If there is a workflow defined somewhere to setup the environment and invoke the tests, we can still help setting up the infra for that though the errors would probably make sense to you more than us.

@awvwgk
Copy link
Member

awvwgk commented May 23, 2022

If there is a workflow defined somewhere to setup the environment and invoke the tests, we can still help setting up the infra for that though the errors would probably make sense to you more than us.

See https://github.com/fortran-lang/minpack#installation for the Fortran and C based tests, if you are also interested in testing the Python bindings follow the instructions at https://github.com/fortran-lang/minpack/tree/main/python#using-pip. Let use know if something is not working as expected.

Generally, the following workflow should be sufficient

# Setup environment
mamba env create -n minpack -f config/ci/python-env.yaml
mamba activate minpack
# Install library
meson setup _build --prefix=$CONDA_PREFIX --libdir=lib
meson install -C _build
# Python bindings
pip install -e python/
pytest --pyargs minpack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested tests
Projects
None yet
Development

No branches or pull requests

4 participants