vinostroud / nfl_analytics

MIT License
0 stars 0 forks source link

Fix questions 1_2_3 #22

Closed vinostroud closed 6 months ago

bbelderbos commented 6 months ago

So you can this when doing a poetry run pytest?

    from apps.analytics_py import load_data, get_mean_epa_down1, get_mean_epa_down1and2, get_game_by_game_data, prepare_data, train_and_plot_regression
E   ModuleNotFoundError: No module named 'apps'
bbelderbos commented 6 months ago

@vinostroud see commit above (https://github.com/vinostroud/nfl_analytics/pull/22/commits/3f8a679baf41bf3a10c7de6189c7f545a55294c2) - you need a relative import here

vinostroud commented 6 months ago

OK. This is now working and I should have plenty to do between now and the next time we speak.

Was the relative import the problem with pytest? Or was the issue pytest was in included in poetry.lock file (which is strange because I used poetry add for pytest).

Anyway - I will merge working branch into main. Then create new branch to work on tests for the analytics file.

Thank you very much, this was super helpful.

bbelderbos commented 6 months ago

Yes the issue was the import, to import from one module into another, in the same package, it's best to use relative import (see fix). Also apps.analytics_py - I don't see any package or module in this project that is named apps? So what were you referring to there?

vinostroud commented 6 months ago

Yes the issue was the import, to import from one module into another, in the same package, it's best to use relative import (see fix). Also apps.analytics_py - I don't see any package or module in this project that is named apps? So what were you referring to there?

Ah, sorry - I tried different folder names (going back and forth between 'apps' folder and 'src' folder to see if I could get the folder recognized. That is an artifact that I will fix.