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

CLN, CI: check notebooks follow black formatting #4095

Closed
5 of 44 tasks
MarcoGorelli opened this issue Sep 10, 2020 · 8 comments · Fixed by #4168
Closed
5 of 44 tasks

CLN, CI: check notebooks follow black formatting #4095

MarcoGorelli opened this issue Sep 10, 2020 · 8 comments · Fixed by #4168

Comments

@MarcoGorelli
Copy link
Contributor

MarcoGorelli commented Sep 10, 2020

Suggested by @AlexAndorra here, opening this as a placeholder so I don't forget.

Any preferences on black formatting, or are the defaults OK? Will you be looking to applying it to the rest of the codebase as well in the future?

to-do list (updated 2020-10-12)

  • docs/source/notebooks/GLM-negative-binomial-regression.ipynb
  • docs/source/notebooks/SMC2_gaussians.ipynb
  • docs/source/notebooks/bayes_param_survival_pymc3.ipynb
  • docs/source/notebooks/bayesian_neural_network_advi.ipynb
  • docs/source/notebooks/blackbox_external_likelihood.ipynb
  • docs/source/notebooks/data_container.ipynb
  • docs/source/notebooks/empirical-approx-overview.ipynb
  • docs/source/notebooks/api_quickstart.ipynb
  • docs/source/notebooks/convolutional_vae_keras_advi.ipynb
  • docs/source/notebooks/dependent_density_regression.ipynb
  • docs/source/notebooks/gaussian_mixture_model.ipynb
  • docs/source/notebooks/ODE_with_manual_gradients.ipynb
  • docs/source/notebooks/factor_analysis.ipynb
  • docs/source/notebooks/conditional-autoregressive-model.ipynb
  • docs/source/notebooks/hierarchical_partial_pooling.ipynb
  • docs/source/notebooks/MLDA_gravity_surveying.ipynb
  • docs/source/notebooks/lasso_block_update.ipynb
  • docs/source/notebooks/GP-MeansAndCovs.ipynb
  • docs/source/notebooks/gaussian_process.ipynb
  • docs/source/notebooks/howto_debugging.ipynb
  • docs/source/notebooks/marginalized_gaussian_mixture_model.ipynb
  • docs/source/notebooks/model_comparison.ipynb
  • docs/source/notebooks/model_averaging.ipynb
  • docs/source/notebooks/dp_mix.ipynb
  • docs/source/notebooks/gaussian-mixture-model-advi.ipynb
  • docs/source/notebooks/GP-MaunaLoa2.ipynb
  • docs/source/notebooks/log-gaussian-cox-process.ipynb
  • docs/source/notebooks/sampler-stats.ipynb
  • docs/source/notebooks/getting_started.ipynb
  • docs/source/notebooks/sampling_callback.ipynb
  • docs/source/notebooks/sampling_compound_step.ipynb
  • docs/source/notebooks/lda-advi-aevb.ipynb
  • docs/source/notebooks/posterior_predictive.ipynb
  • docs/source/notebooks/stochastic_volatility.ipynb
  • docs/source/notebooks/weibull_aft.ipynb
  • docs/source/notebooks/updating_priors.ipynb
  • docs/source/notebooks/normalizing_flows_overview.ipynb
  • docs/source/notebooks/rugby_analytics.ipynb
  • docs/source/notebooks/variational_api_quickstart.ipynb
  • docs/source/notebooks/probabilistic_matrix_factorization.ipynb
  • docs/source/notebooks/survival_analysis.ipynb
  • docs/source/notebooks/putting_workflow.ipynb
  • docs/source/notebooks/multilevel_modeling.ipynb
  • docs/source/notebooks/cox_model.ipynb

This is a begginer-friendly issue, all you need to do is:

pip install -U nbqa
nbqa black notebook1.ipynb notebook2.ipynb

replacing notebook1.ipynb notebook2.ipynb with some notebooks from above. You should then check over the diff to make sure nothing unexpected has been changed - please report any errors/issues with nbqa to https://github.com/nbQA-dev/nbQA . Feel free to ping me if you want/need help with this

NOTE: sometimes, you may need to disable black for a block of code - see the style guide for how to do that

@AlexAndorra
Copy link
Contributor

Thanks for the initiative! No real preference per se, we just set the line length to 100 instead of the default 88 in pyproject.toml, as we did on ArviZ.
I don't know about applying it to the rest of the codebase, as reviewing these changes is quite hard. We tend to do it gradually, on a file by file basis but I'm not aware of a concerted effort to do it on all the codebase.

@MarcoGorelli
Copy link
Contributor Author

@AlexAndorra do you want to add the beginner-friendly tag here?

@AlexAndorra
Copy link
Contributor

Done @MarcoGorelli 😉

@satrio-hw
Copy link
Contributor

Hi, I'd like to help here.. So, just to make sure.. I need to reformat given notebook using nbqa black, isn't it?

@MarcoGorelli
Copy link
Contributor Author

Hi, I'd like to help here

Thanks!

.. So, just to make sure.. I need to reformat given notebook using nbqa black, isn't it?

Yup - but because these notebooks are user-facing, you may sometimes need/want to use "# fmt: off and "# fmt: on - see docs/source/notebooks/BEST.ipynb from https://github.com/pymc-devs/pymc3/pull/4148/files for an example

@satrio-hw
Copy link
Contributor

noted, I'll try to working on this files first:

  • docs/source/notebooks/AR.ipynb
  • docs/source/notebooks/Bayes_factor.ipynb
  • docs/source/notebooks/BEST.ipynb
  • docs/source/notebooks/GLM-hierarchical-advi-minibatch.ipynb
  • docs/source/notebooks/GLM-linear.ipynb
  • docs/source/notebooks/Euler-Maruyama_and_SDEs.ipynb
  • docs/source/notebooks/GLM-hierarchical.ipynb
  • docs/source/notebooks/GLM.ipynb
  • docs/source/notebooks/DEMetropolisZ_EfficiencyComparison.ipynb
  • docs/source/notebooks/DEMetropolisZ_tune_drop_fraction.ipynb

@MarcoGorelli
Copy link
Contributor Author

@satrio-hw sorry, I didn't get round to checking these off yet, I've taken on many of them in #4148

I'll check them off now, feel free to take any of the rest

@satrio-hw
Copy link
Contributor

understood, than I'll take :

  • docs/source/notebooks/GLM.ipynb
  • docs/source/notebooks/GLM-robust.ipynb
  • docs/source/notebooks/GLM-rolling-regression.ipynb
  • docs/source/notebooks/GP-Marginal.ipynb
  • docs/source/notebooks/GP-Kron.ipynb
  • docs/source/notebooks/GP-smoothing.ipynb
  • docs/source/notebooks/GP-TProcess.ipynb
  • docs/source/notebooks/GP-SparseApprox.ipynb
  • docs/source/notebooks/MLDA_simple_linear_regression.ipynb
  • docs/source/notebooks/GP-Latent.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants