-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix CI Build matplotlib
error
#288
Conversation
4. Commit your changes to the feature branch (you should have `pre-commit` installed to ensure your code is correctly formatted when you commit changes). | ||
5. Push the branch to GitHub (`git push origin new-fix-or-feature`). | ||
6. On GitHub, create a new [pull request](https://github.com/arup-group/pam/pull/new/main) from the feature branch. | ||
1. Create a feature branch to work on in your fork (`git checkout -b new-fix-or-feature`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The numbered list looks broken from the upstream cookie cutter - any ideas @brynpickering ?
The |
As far as I can see, that's failing on a notebook check. I can't see what the failure is, nor can I see an obvious way to re-run the job. No notebooks @brynpickering - how do we interpret this? Is there a way to see debug details? Is there a way to re-run the job? I can't see a way to run it locally, given that I have no staged changes: pre-commit
check for added large files..........................(no files to check)Skipped
black................................................(no files to check)Skipped
ruff.................................................(no files to check)Skipped
nbqa-black...........................................(no files to check)Skipped
nbqa-ruff............................................(no files to check)Skipped
forbidden files......................................(no files to check)Skipped |
pre-commit.ci run |
Okay, I pip installed nbqa ruff examples/
examples/02a_tabular_read_write.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import os
3 | |
4 | | import pandas as pd
5 | | from pam import read
6 | |
7 | | # %%NBQA-CELL-SEP48762f
| |_^ I001
8 | trips = pd.read_csv(
9 | os.path.join("data", "example_data", "example_travel_diaries.csv"), index_col="uid"
|
= help: Organize imports
examples/03_read_modify_write.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import os
3 | | from collections import defaultdict
4 | |
5 | | import geopandas as gp
6 | | import pandas as pd
7 | | from matplotlib import pyplot as plt
8 | | from pam import policy, read
9 | | from pam.policy import apply_policies
10 | |
11 | | hash(0xFE7F7A94)
| |_^ I001
12 |
13 | # %%NBQA-CELL-SEP48762f
|
= help: Organize imports
examples/04_point_sampling.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import os
3 | |
4 | | import geopandas as gp
5 | | import pandas as pd
6 | | from matplotlib import pyplot as plt
7 | | from pam import read
8 | | from pam.samplers.spatial import RandomPointSampler
9 | |
10 | | # %%NBQA-CELL-SEP48762f
| |_^ I001
11 | trips = pd.read_csv(
12 | os.path.join("data", "example_data", "example_travel_diaries.csv"), index_col="uid"
|
= help: Organize imports
examples/05_activity_plots.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import os
3 | |
4 | | import pandas as pd
5 | | from pam import read
6 | | from pam.plot.stats import plot_activity_times, plot_leg_times
7 | |
8 | | # %%NBQA-CELL-SEP48762f
| |_^ I001
9 | data_path = os.path.join("data", "example_data")
10 | trips = pd.read_csv(os.path.join(data_path, "example_travel_diaries.csv"))
|
= help: Organize imports
examples/07_travel_survey_to_matsim.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import os
3 | | from copy import deepcopy
4 | |
5 | | import geopandas as gp
6 | | import pandas as pd
7 | | from pam import read, write
8 | | from pam.core import Population
9 | | from pam.plot.stats import plot_activity_times, plot_leg_times
10 | | from pam.samplers.basic import freq_sample
11 | | from pam.samplers.spatial import RandomPointSampler
12 | |
13 | | # %%NBQA-CELL-SEP48762f
| |_^ I001
14 | use_dummy_data = True
|
= help: Organize imports
examples/08_toy_matsim_population.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import os
3 | |
4 | | import geopandas as gp
5 | | import matplotlib.pyplot as plt
6 | | import numpy as np
7 | | import pandas as pd
8 | | from pam.activity import Activity, Leg
9 | | from pam.core import Household, Person, Population
10 | | from pam.plot.stats import plot_activity_times
11 | | from pam.read import load_travel_diary
12 | | from pam.report.benchmarks import distance_counts, duration_counts
13 | | from pam.samplers import facility
14 | | from pam.utils import minutes_to_datetime as mtdt
15 | | from pam.variables import END_OF_DAY
16 | | from pam.write import to_csv, write_matsim, write_od_matrices
17 | |
18 | | hash(0x40F3F06D)
| |_^ I001
19 |
20 | # %%NBQA-CELL-SEP48762f
|
= help: Organize imports
examples/10_advanced_spatial_sampling.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import logging
3 | |
4 | | import geopandas as gp
5 | | import matplotlib.pyplot as plt
6 | | import numpy as np
7 | | import pam
8 | | import pandas as pd
9 | | from pam.activity import Activity, Leg
10 | | from pam.core import Household, Person, Population
11 | | from pam.samplers import facility
12 | | from pam.utils import minutes_to_datetime
13 | | from shapely.geometry import Point, Polygon
14 | |
15 | | # %%NBQA-CELL-SEP48762f
| |_^ I001
16 | # create random spatial data
|
= help: Organize imports
examples/13_Advanced_Freight_Synthesis.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import os
3 | | from datetime import date
4 | |
5 | | import geopandas as gp
6 | | import matplotlib
7 | | import numpy as np
8 | | import pandas as pd
9 | | from matplotlib import pyplot as plt
10 | | from pam.core import Household, Person, Population
11 | | from pam.samplers import tour
12 | | from pam.samplers.facility import FacilitySampler
13 | |
14 | | matplotlib.style.use("ggplot")
| |_^ I001
15 |
16 | # %%NBQA-CELL-SEP48762f
|
= help: Organize imports
examples/14_Advanced_Plan_Cropping.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / from copy import deepcopy
3 | |
4 | | import geopandas as gp
5 | | import matplotlib.pyplot as plt
6 | | from pam.activity import Activity, Leg, Plan
7 | | from pam.core import Household, Person, Population
8 | | from pam.operations import cropping
9 | | from pam.utils import minutes_to_datetime as mtdt
10 | | from pam.variables import END_OF_DAY
11 | | from shapely.geometry import Point, Polygon
12 | |
13 | | # %%NBQA-CELL-SEP48762f
| |_^ I001
|
= help: Organize imports
examples/15_advanced_choice_modelling.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import logging
3 | | import os
4 | | import random
5 | |
6 | | import numpy as np
7 | | import pandas as pd
8 | | from pam.operations.cropping import link_population
9 | | from pam.planner import choice_location as choice
10 | | from pam.planner.od import ODFactory, ODMatrix
11 | | from pam.read import read_matsim
12 | | from prettytable import PrettyTable
13 | |
14 | | logging.basicConfig(level=logging.DEBUG)
| |_^ I001
15 | random.seed(0)
|
= help: Organize imports
examples/17_advanced_discretionary_locations.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import logging
3 | | import random
4 | | from copy import deepcopy
5 | |
6 | | import numpy as np
7 | | import pandas as pd
8 | | from pam.activity import Activity, Leg, Plan
9 | | from pam.location import Location
10 | | from pam.planner.choice_location import DiscretionaryTripOD, DiscretionaryTrips
11 | | from pam.planner.od import ODFactory, ODMatrix
12 | | from pam.planner.utils_planner import get_trip_chains_either_anchor
13 | | from pam.utils import minutes_to_datetime as mtdt
14 | | from pam.variables import END_OF_DAY
15 | | from prettytable import PrettyTable
16 | | from shapely.geometry import Point
17 | |
18 | | logging.getLogger("pam").setLevel(logging.DEBUG)
| |_^ I001
19 | random.seed(0)
|
= help: Organize imports
examples/18_advanced_ipf.ipynb:cell_1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | # %%NBQA-CELL-SEP48762f
2 | / import itertools
3 | |
4 | | import pandas as pd
5 | | from pam.core import Person, Population
6 | | from pam.planner import ipf
7 | |
8 | | # %%NBQA-CELL-SEP48762f
| |_^ I001
9 | zone_data = pd.DataFrame(
10 | {
|
= help: Organize imports
Found 12 errors.
[*] 12 fixable with the `--fix` option. All of the errors are about the formatting/sorting of import blocks. I could (auto)fix them in this branch, or we could merge this PR as is and fix them in a dedicated branch. Which do you prefer @brynpickering @KasiaKoz ? My preference is to fix that in a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could (auto)fix them in this branch, or we could merge this PR as is and fix them in a dedicated branch. Which do you prefer @brynpickering @KasiaKoz ? My preference is to fix that in a separate PR.
Yup, agree with separate PR
The fix happens in
src/pam/plot/stats.py
; all of the other changed files are a result of acruft update
.Before the Change
One of the unit tests was broken:
After the Change
The build is fixed:
Is the Change Safe?
The previous attempt to set a label on the x-axis of plots (via
axis.xaxis.set_label("")
) was:matplotlib < 3.10
, but... noisily inmatplotlib 3.10
In functional terms, we have changed nothing, but we now avoid the error caused by the breaking change in
matplotlib 3.10
.Checklist
Not Applicable
Any checks which are not relevant to the PR can be pre-checked by the PR creator.
All others should be checked by the reviewer(s).
You can add extra checklist items here if required by the PR.