U-Shift / Transport-Demand-Modelling

Supporting materials for the Transport Demand Modeling course, lectured by Prof. Filipe Moura.
MIT License
23 stars 15 forks source link

Run Jupyter notebooks in CI #21

Closed EwoutH closed 7 months ago

EwoutH commented 7 months ago

Run the Jupyter notebooks in CI to make sure they keep working with the latest versions of packages. On every change to a notebook, this workflow is ran, as well as once a month.

EwoutH commented 7 months ago

Hi @mncosta, @filmoura and @temospena!

First of all, thanks for these amazing resources! They're really useful.

I've created an automatic workflow with GitHub Actions that tests all the Jupyter notebooks periodically. This way, broken notebooks are detected, which means they can be updated to work with the latest versions.

It already found it's first error:

ImportError                               Traceback (most recent call last)
Cell In[1], line 7
      5 import biogeme.models as models
      6 import biogeme.optimization as opt
----> 7 from biogeme.expressions import Beta, DefineVariable, bioNormalCdf, log, Elem
      8 import seaborn as sns
      9 import matplotlib.pyplot as plt

ImportError: cannot import name 'DefineVariable' from 'biogeme.expressions' (/home/runner/.local/lib/python3.10/site-packages/biogeme/expressions/__init__.py)

If we look at the Biogeme docs, we see that DefineVariable has moved, and is now part of biogeme.expressions.elementary_expressions.DefineVariable. Which means it can be fixed!

I hope this is useful, let me know what you think!

temospena commented 7 months ago

Thank you @EwoutH ! This is great work :) 🙌 I will merge the PR, and meanwhile @mncosta can look after that error.