Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Integration testing for downstream dependencies #15992

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

Open
ogrisel opened this issue Dec 30, 2019 · 21 comments
Open

Integration testing for downstream dependencies #15992

ogrisel opened this issue Dec 30, 2019 · 21 comments
Assignees
Labels
Build / CI Developer API Third party developer API related
Milestone

Comments

@ogrisel
Copy link
Member

ogrisel commented Dec 30, 2019

We need a new Continuous Integration configuration to launch the tests of some popular downstream projects.

Candidate projects:

  • xgboost and or lightgbm as very popular third party libraries
  • skorch
  • imbalanced-learn not necessarily as popular as others but with high use of sklearn's API
  • autosklearn?
  • any other suggestion?

Those test would not be run in PRs unless we use a specific tag in the commit message for instance. This test setup would be run by maintainers in the release branches.

We do something similar in the cloudpickle project with the [ci downstream] commit tag:

https://github.com/cloudpipe/cloudpickle/blob/master/.travis.yml#L37-L70

For scikit-learn this would probably need a bit more scripting as the build is more complex than for a pure python project such as cloudpickle but the general idea would be the same.

@chkoar
Copy link
Contributor

chkoar commented Dec 31, 2019

A cron job or something like then one you proposed would make the trick. But if a change is mandatory the maintainers need somehow to be notified early, no? But I suppose that is for internal use and to detect a potential impact of a change to the downstream libs.

@jnothman
Copy link
Member

jnothman commented Dec 31, 2019 via email

@jnothman
Copy link
Member

  • astroML

@bsipocz
Copy link
Contributor

bsipocz commented Dec 31, 2019

Frankly the downstream packages should be doing this integration testing by
testing various use cases and checking with scikit-learn master. We should
be encouraging downstream packages to include such integration tests (e.g.
various usages of their estimators with grid search).

Completely agree that it's our task downstream to test against sklearn master, personally it's on my list for a while (with a disturbingly old WIP PR), I just didn't get to the point to set up the build with the nightly build rather than pip install (which takes for ages).

@jnothman
Copy link
Member

jnothman commented Jan 1, 2020

I'd be happy to see, in the first instance, a script that runs the test suites of these downstream packages. We can look separately at how we best deploy that on CI

@glemaitre
Copy link
Member

glemaitre commented Jan 2, 2020

Frankly the downstream packages should be doing this integration testing by
testing various use cases and checking with scikit-learn master.

I think this is reasonable.

I just didn't get to the point to set up the build with the nightly build rather than pip install (which takes for ages).

@bsipocz This is something that we do in imbalanced-learn. The install is quick.

imbalanced-learn not necessarily as popular as others but with high use of sklearn's API

I would suggest the packages from the scikit-learn-contrib in general.

@cmarmo cmarmo added this to the 0.24 milestone May 25, 2020
@thomasjpfan
Copy link
Member

I have started a integration testing library to start addressing this issue: https://github.com/thomasjpfan/scikit-learn-integration-testing

@cmarmo cmarmo removed this from the 0.24 milestone Oct 15, 2020
@ogrisel ogrisel added this to the 1.0 milestone Dec 15, 2020
@ogrisel
Copy link
Member Author

ogrisel commented Dec 15, 2020

Added to the 1.0 milestone so that we do not forget about it.

@thomasjpfan
Copy link
Member

thomasjpfan commented Dec 15, 2020

Makes sense. I am thinking of moving the CI to github actions so I can integrate it into github discussions or issues to ping the maintainers of the upstream projects when there is an test failure.

@adrinjalali
Copy link
Member

Added to the 1.0 milestone so that we do not forget about it.

Seems like we did forget about it @ogrisel 😁 . With some of the changes coming in the next release, and the one after, this would be really nice to have though.

Moving to 1.1 for now.

@adrinjalali adrinjalali modified the milestones: 1.0, 1.1 Aug 22, 2021
@glemaitre
Copy link
Member

glemaitre commented Aug 30, 2021

I think that we can address the following when we have a more granular check_estimator to be sure that we are testing the right things for these third-party libraries. xref: #16241

@jeremiedbb
Copy link
Member

very unlikely to be part of 1.1, moving to 1.2

@jeremiedbb jeremiedbb modified the milestones: 1.1, 1.2 Mar 18, 2022
@glemaitre glemaitre modified the milestones: 1.2, 1.3 Nov 16, 2022
@jeremiedbb jeremiedbb modified the milestones: 1.3, 1.4 Jun 8, 2023
@jjerphan
Copy link
Member

I think https://github.com/scientific-python/reverse-dependency-testing from @martinfleis is a good candidate to test downstream dependencies. What do you think?

@martinfleis
Copy link

@jjerphan it may work for a subset of packages out of the box. Packages organised like imbalanced-learn will work since they have tests included inside the package itself. But for example scikit-matter will not as it does not ship tests. For the latter, we shall find another way of getting the tests within the action but I haven't looked into that yet.

@bsipocz
Copy link
Contributor

bsipocz commented Jun 13, 2023

As a workaround, is there any way that the action could git clone the repo (assuming it's provided and is not a huge pile of hack to get the project links from PyPI)? Or we, as a community, should just strongly recommend including the test suite in the packaging, too?

@martinfleis
Copy link

As a workaround, is there any way that the action could git clone the repo (assuming it's provided and is not a huge pile of hack to get the project links from PyPI)?

That is not complicated, just not implemented at the moment.

Or we, as a community, should just strongly recommend including the test suite in the packaging, too?

I don't think so. @henryiii was advising against that (though I personally do see a certain value in that) while suggesting that tests should be in the sdist. We should then fetch the sdist from PyPI and run the tests. Though in practice, I am not sure how common that practice is. I bet that it is currently more likely that tests are shipped with the package than that they're in the sdist and not in the package.

@henryiii
Copy link

Though in practice, I am not sure how common that practice is.

Some packages that have a top-level "tests" that is not in the wheel:

  • pip
  • build
  • requests
  • urllib3
  • pytest
  • wheel
  • packaging

Also most (or all) of Scikit-HEP. Every package I'm involved with uses this structure.

@bsipocz
Copy link
Contributor

bsipocz commented Jun 13, 2023

I feel the ones listed above are more generic, and part of the basic infrastructure than the end-user libraries we try to tackle with downstream testing. E.g. occasionally, we found it rather useful to be able to ask the users to run astropy.test() to decipher what really goes wrong for them. Same for all (at least the ones I'm involved with) the packages in that sub-ecosystem.

Similarly, here for downstream testing it could be useful to be super easily just run the tests.

@henryiii
Copy link

henryiii commented Jun 13, 2023

I'm not against <package>.test(), but that doesn't need to be your entire test suite - it could be a simple smoke check. A good full test suite, for example, should have extra dependencies (pytest, for example), often has some data (which should not be in every single wheel or in production systems!), and should run with all warnings as errors, which doesn't affect a user, but is critical for both you and package managers (which is what the full test suite is for). If you ship the whole test suite as .test(), then you'll tend to a) want it to work without test-only dependencies, b) provide data, and c) only fail if there's a real problem, not a deprecation warning or something similar. Also d) run quickly. Providing a "I'm working" smoke check solves all those issues without causing you to be tempted toward bad designs in your main test suite. You could even implement the smoke check in unittest.

Also, pytest's config doesn't ship in the wheel.

PS: Those "simple" packages are in the top 10 or so most downloaded packages or from the PyPA, by the way.

@bsipocz
Copy link
Contributor

bsipocz commented Jun 13, 2023

Oh, we fully agree on most of the things. Also, I didn't mean "simple" to say they are not important, those are indeed the most important infrastructure in the whole ecosystem. However, I feel this issue about downstream dependencies are targeting less well-engineered or maintained projects to see the effect of deprecation and changes introduced in core projects, which in practice means testing not those most relied-on libraries but those further down the chain, so the design choices of the core infrastructure libraries have little relevance.

@glemaitre
Copy link
Member

We had some IRL discussions with @jeremiedbb regarding some expectations.

I am not sure that getting the latest release from PyPI is actually enough. I would expect to use the main branch to actually be able to report issues to the downstream software. The issue that we could detect might be potentially solved either on the downstream package or the parent package: if the issue is solved in the parent package then using the latest release "might" be enough; if the issue is in the downstream package then the changes will happen in main and using the latest release is not enough (or you will get a broken CI until the release of the downstream package).

If we want to get the main branch then the nightly builds could be a good candidate (until we can test it in someway). I don't see it feasible to rely on cloning a GitHub repository and build a downstream project. Each project might have a different build stack (pure Python package, Cython package, C++ package relying on CMake) that would make it super challenging.

@jeremiedbb jeremiedbb modified the milestones: 1.4, 1.5 Dec 21, 2023
@jeremiedbb jeremiedbb modified the milestones: 1.5, 2.0 May 13, 2024
@adrinjalali adrinjalali added the Developer API Third party developer API related label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build / CI Developer API Third party developer API related
Projects
None yet
Development

No branches or pull requests