holoviz-topics / examples

Visualization-focused examples of using HoloViz for specific topics
https://examples.holoviz.org
Creative Commons Attribution 4.0 International
82 stars 24 forks source link

Remotely lint and test projects #252

Closed maximlt closed 1 year ago

maximlt commented 1 year ago

I'm submitting this PR to get feedback on this proposal (cc @jlstevens, @jbednar). Currently all the projects have an additional test environment that just adds pytest and nbsmoke. Projects define the lint and test commands that run pytest --nbsmoke-lint and pytest --nbsmoke-run, respectively. These two commands are executed before building a project, a project can't be built if any of them fails.

Linting and testing projects is valuable and we should keep doing that. However I started to wonder whether it makes more sense to perform these tests remotely rather than locally. By saying remotely, I mean that instead of each project having to include an additional test environment and two commands, projects would no longer have to do that and the linting and testing would be controlled by code living in dodo.py. This is basically what I've implemented in this PR, as a maintainer or contributor of examples you would need to install a managing environment (this will be anyway recommended, for contributors to run all the linters we've added before submitting a PR) and then simply run doit test:<projectname>:

  1. the small test dataset is setup, if available
  2. the project is prepared
  3. nbqa is used to lint the project's notebooks,
  4. nbval is used to test the project's notebooks (I'm using a feature that was just released to target the project's kernel, feature that I believe was implemented by Chris a couple of years ago, thanks!)

nbqa and nbval being both installed in the managing environment, not in the project's environment.

I find this approach interesting as:

But really what I prefer is the removal of the per-project test environment!

Drawbacks include:

Overall:

jbednar commented 1 year ago

I'm happy with all those proposals, except that I'm not certain of the feasibility of having a separate test environment. Will the linting really succeed fully even if packages needed for the notebook are not installed? My understanding of nbsmoke was that it did depend on such an environment, but if it doesn't (and/or if nbval doesn't), then sure! I definitely do want the notebook evaluation to be in a different environment from the website building, which is crucial for getting the website to build reliably, but that's a separate topic.

maximlt commented 1 year ago

Will the linting really succeed fully even if packages needed for the notebook are not installed? My understanding of nbsmoke was that it did depend on such an environment, but if it doesn't (and/or if nbval doesn't), then sure!

Thanks for the good feedback! So as it stands:

I definitely do want the notebook evaluation to be in a different environment from the website building, which is crucial for getting the website to build reliably, but that's a separate topic.

Yep this is already implemented, now we'll have to see how well it works across all the projects.

jbednar commented 1 year ago

That all sounds great, thanks!