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

Issue 1044 google colab #1061

Merged

Conversation

brosaplanella
Copy link
Sponsor Member

Description

Added an extra line to notebooks (before importing PyBaMM) to install PyBaMM (if not installed) so they can be run in Google Colab. I fixed run-tests.py to catch if a line in a notebook had magic so ipython is called (before it only caught if a whole cell had magic).

Fixes #1044

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Jun 17, 2020

Codecov Report

Merging #1061 into develop will increase coverage by 0.08%.
The diff coverage is 99.44%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1061      +/-   ##
===========================================
+ Coverage    97.63%   97.72%   +0.08%     
===========================================
  Files          237      237              
  Lines        12371    12413      +42     
===========================================
+ Hits         12078    12130      +52     
+ Misses         293      283      -10     
Impacted Files Coverage Δ
...models/full_battery_models/lead_acid/basic_full.py 100.00% <ø> (ø)
pybamm/expression_tree/binary_operators.py 94.67% <87.50%> (-0.21%) ⬇️
pybamm/discretisations/discretisation.py 99.77% <100.00%> (+<0.01%) ⬆️
pybamm/expression_tree/broadcasts.py 100.00% <100.00%> (ø)
pybamm/expression_tree/concatenations.py 97.45% <100.00%> (ø)
pybamm/expression_tree/functions.py 100.00% <100.00%> (ø)
pybamm/expression_tree/independent_variable.py 100.00% <100.00%> (ø)
pybamm/expression_tree/input_parameter.py 100.00% <100.00%> (ø)
pybamm/expression_tree/operations/simplify.py 95.14% <100.00%> (ø)
pybamm/expression_tree/symbol.py 97.44% <100.00%> (-0.02%) ⬇️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06237e9...048b82b. Read the comment docs.

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. One last thing to check is does installing pybamm overwrite the local installation or not? i.e. if the examples on develop are changed to work with only a more recent version of develop than the latest release, will that still work? Also, can you add the colab badge to the readme? And we can remove the binder badges (in readme and the notebooks readme) too

@brosaplanella
Copy link
Sponsor Member Author

I have checked and it seems that it does not overwrite the local installation. I tried it on my computer and I could still access stuff that has not been released even after running the installation command. I assume you mean adding the Google Colab badge in the main README, so that should now be fixed.

@valentinsulzer
Copy link
Member

Should the google colab link point to master or develop?

@brosaplanella
Copy link
Sponsor Member Author

I thought that, given that in Google Colab we install the latest release rather than the develop branch, it would be better to run the master branch.

@valentinsulzer
Copy link
Member

Duh! Happy to merge then, though we should do a release so that the line %pip install pybamm -q appears in master

@valentinsulzer valentinsulzer merged commit 17460e8 into pybamm-team:develop Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link notebooks to Google Colab
2 participants