From 90c33ef0b36b74cd59cc6c9a55b848dfe6179e94 Mon Sep 17 00:00:00 2001 From: Riley Clement Date: Thu, 25 Apr 2024 20:11:01 +1000 Subject: [PATCH] tox setup + env as requirements file --- .github/workflows/python-tox.yml | 25 ++++++++ requirements_test.txt | 106 +++++++++++++++++++++++++++++++ tox.ini | 87 +++++++++++++++++++++++++ 3 files changed, 218 insertions(+) create mode 100644 .github/workflows/python-tox.yml create mode 100644 requirements_test.txt create mode 100644 tox.ini diff --git a/.github/workflows/python-tox.yml b/.github/workflows/python-tox.yml new file mode 100644 index 0000000..987ce21 --- /dev/null +++ b/.github/workflows/python-tox.yml @@ -0,0 +1,25 @@ +name: Test notebooks + +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test notebooks with tox + run: tox -e testnb \ No newline at end of file diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 0000000..6983869 --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1,106 @@ +appdirs==1.4.4 +appnope==0.1.4 +asttokens==2.4.1 +attrs==23.2.0 +beautifulsoup4==4.12.3 +branca==0.7.1 +certifi==2024.2.2 +charset-normalizer==3.3.2 +click==8.1.7 +cmdstanpy==1.2.2 +comm==0.2.2 +contourpy==1.2.1 +cycler==0.12.1 +debugpy==1.8.1 +decorator==5.1.1 +et-xmlfile==1.1.0 +executing==2.0.1 +fastjsonschema==2.19.1 +folium==0.16.0 +fonttools==4.51.0 +frozendict==2.4.2 +gensim==4.3.2 +gurobi-machinelearning==1.5.0 +gurobipy==11.0.1 +gurobipy-pandas==1.1.1 +holidays==0.47 +html5lib==1.1 +idna==3.7 +importlib_resources==6.4.0 +iniconfig==2.0.0 +ipykernel==6.29.4 +ipython==8.23.0 +ipywidgets==8.1.2 +jedi==0.19.1 +Jinja2==3.1.3 +joblib==1.4.0 +jsonschema==4.21.1 +jsonschema-specifications==2023.12.1 +jupyter_client==8.6.1 +jupyter_core==5.7.2 +jupyterlab_widgets==3.0.10 +kiwisolver==1.4.5 +lightfm==1.17 +lxml==5.2.1 +MarkupSafe==2.1.5 +matplotlib==3.8.4 +matplotlib-inline==0.1.7 +multitasking==0.0.11 +names==0.3.0 +nbclient==0.6.8 +nbformat==5.10.4 +nest-asyncio==1.6.0 +networkx==3.3 +nltk==3.8.1 +numpy==1.26.4 +openpyxl==3.1.2 +packaging==24.0 +pandas==2.2.2 +parso==0.8.4 +patsy==0.5.6 +peewee==3.17.3 +pexpect==4.9.0 +pillow==10.3.0 +platformdirs==4.2.1 +plotly==5.21.0 +pluggy==1.5.0 +prompt-toolkit==3.0.43 +prophet==1.1.5 +psutil==5.9.8 +ptyprocess==0.7.0 +pure-eval==0.2.2 +pydot==2.0.0 +Pygments==2.17.2 +pyparsing==3.1.2 +python-dateutil==2.9.0.post0 +pytz==2024.1 +pyzmq==26.0.2 +referencing==0.35.0 +regex==2024.4.16 +requests==2.31.0 +rpds-py==0.18.0 +scikit-learn==1.4.2 +scipy==1.12.0 +seaborn==0.13.2 +six==1.16.0 +smart-open==7.0.4 +soupsieve==2.5 +stack-data==0.6.3 +stanio==0.5.0 +statsmodels==0.14.2 +tenacity==8.2.3 +threadpoolctl==3.4.0 +tornado==6.4 +tqdm==4.66.2 +traitlets==5.14.3 +typing_extensions==4.11.0 +tzdata==2024.1 +urllib3==2.2.1 +wcwidth==0.2.13 +webencodings==0.5.1 +widgetsnbextension==4.0.10 +wordcloud==1.9.3 +wrapt==1.16.0 +xgboost==2.0.3 +xyzservices==2024.4.0 +yfinance==0.2.38 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..30b368e --- /dev/null +++ b/tox.ini @@ -0,0 +1,87 @@ +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = testnb +isolated_build = True + +[gh-actions] +python = + 3.12: py312 + +[testenv:testnb] +deps = + pytest + nbmake + -rrequirements_test.txt +commands = + python -m pip install --upgrade pip setuptools wheel + pytest --nbmake --nbmake-kernel=python3 --nbmake-timeout=2000 \ + ./3d_tic_tac_toe/3d_tic_tac_toe.ipynb \ + ./agricultural_pricing/agricultural_pricing.ipynb \ + ./aviation_planning/airlineplanning.ipynb \ + ./burrito_optimization_game/burrito_optimization_game.ipynb \ + ./car_rental/car_rental_1.ipynb \ + ./car_rental/car_rental_2.ipynb \ + ./cell_tower_coverage/cell_tower.ipynb \ + ./colgen-cutting_stock/colgen-cutting_stock.ipynb \ + ./constraint_optimization/constraint_optimization.ipynb \ + ./covid19_facility_location/covid19_facility_location.ipynb \ + ./curve_fitting/curve_fitting.ipynb \ + ./customer_assignment/customer_assignment.ipynb \ + ./decentralization_planning/decentralization_planning.ipynb \ + ./drone_network/drone_network.ipynb \ + ./economic_planning/economic_planning.ipynb \ + ./efficiency_analysis/efficiency_analysis.ipynb \ + ./electrical_power_generation/electrical_power_1.ipynb \ + ./electrical_power_generation/electrical_power_2.ipynb \ + ./facility_location/facility_location.ipynb \ + ./factory_planning/factory_planning_1.ipynb \ + ./factory_planning/factory_planning_2.ipynb \ + ./fantasy_basketball/fantasy_basketball_part1.ipynb \ + ./fantasy_basketball/fantasy_basketball_part2.ipynb \ + ./farm_planning/farm_planning.ipynb \ + ./food_manufacturing/food_manufacture_1.ipynb \ + ./food_manufacturing/food_manufacture_2.ipynb \ + ./gurobi_days_digital_2023/intro_to_gurobipy/intro_to_gurobipy.ipynb \ + ./linear_regression/l0_regression.ipynb \ + ./logical_design/logical_design.ipynb \ + ./lost_luggage_distribution/lost_luggage_distribution.ipynb \ + ./manpower_planning/manpower_planning.ipynb \ + ./market_sharing/market_sharing.ipynb \ + ./marketing_campaign_optimization/marketing_campaign_optimization.ipynb \ + ./milk_collection/milk_collection.ipynb \ + ./milp_tutorial/introduction_to_modeling.ipynb \ + ./milp_tutorial/milp_tutorial_RAP_problem_001.ipynb \ + ./milp_tutorial/milp_tutorial_RAP_problem_002.ipynb \ + ./milp_tutorial/milp_tutorial_RAP_problem_003.ipynb \ + ./mining/mining.ipynb \ + ./music_recommendation/music_recommendation.ipynb \ + ./offshore_wind_farming/offshore_wind_farming.ipynb \ + ./opencast_mining/opencast_mining.ipynb \ + ./optimization101/Modeling_Session_1/completed_modeling1.ipynb \ + ./optimization101/Modeling_Session_2/completed_Exercise_Set2.ipynb \ + ./optimization101/Modeling_Session_2/completed_modeling2.ipynb \ + ./optimization101/Modeling_Session_2/energy_storage_ML.ipynb \ + ./optimization201/Modeling_Session_1/completed_modeling1.ipynb \ + ./optimization201/Modeling_Session_2/completed_modeling2.ipynb \ + ./optimization201/technician_assignment/resource_assignment_complete.ipynb \ + ./optimization201/technician_assignment/technician_routing.ipynb \ + ./pooling/std_pooling.ipynb \ + ./portfolio_selection_optimization/portfolio_selection_optimization.ipynb \ + ./power_generation/optimize_power_schedule.ipynb \ + ./price_optimization/price_optimization.ipynb \ + ./price_optimization/price_optimization_gurobiML.ipynb \ + ./pricing_competing_products/generate_data.ipynb \ + ./pricing_competing_products/price_optimization_with_competing_products.ipynb \ + ./protein_comparison/protein_comparison.ipynb \ + ./protein_folding/protein_folding.ipynb \ + ./refinery/refinery.ipynb \ + ./supply_network_design/supply_network_design_1.ipynb \ + ./supply_network_design/supply_network_design_2.ipynb \ + ./technician_routing_scheduling/technician_routing_scheduling.ipynb \ + ./text_dissimilarity/text_dissimilarity.ipynb \ + ./traveling_salesman/tsp.ipynb \ + ./workforce/workforce_scheduling.ipynb \ + ./yield_management/yield_management.ipynb \ No newline at end of file