Closed smmaurer closed 5 years ago
More info from @sablanchard: UrbanSim is pinned at Pandana v0.3 in part because 0.4.0 had installation problems in Windows. v0.4.1. fixed this, but UrbanSim hasn't been updated yet to reflect that.
Fixed in PR #116, thanks @alephcero!
Pandana 0.4 made some changes to the API that cause older user code to crash. We're still running into this in UrbanSim models, and it's hard for people to diagnose the errors if they're not expecting them.
In the next point release, I think we should make some small adjustments to allow older code to continue running, raising deprecation warnings to explain the changes that need to be made:
1.
pandana.network.reserve_num_graphs()
This was removed in 0.4 because improvements to the memory management mean that it's no longer necessary. But it appears frequently in older user code.
Current behavior:
AttributeError
, because the function no longer existsProposed behavior:
DeprecationWarning
alerting users that it's no longer necessary2.
pandana.Network().init_pois()
andset_pois()
In 0.4
init_pois()
was removed, and two of its arguments were shifted toset_pois()
.Current behavior:
init_pois()
crashesset_pois()
expecting the older API crashes with aTypeError
because not enough arguments are providedProposed behavior:
init_pois()
, save the two relevant arguments as class attributes, and raise aDeprecationWarning
alerting users of the API changeset_pois()
should read those two arguments from the class attributes if they're not provided, and raise aDeprecationWarning
explaining that they shouldn't be provided throughinit_pois()
any moreDiscussion
Making these changes would allow code written for Pandana 0.3 to continue running, while explaining to users how to make the appropriate updates. I think this would be pretty valuable and save some headaches.
For example, it looks like
urbansim
itself still pins itspandana
requirement at 0.3, presumably because of the API changes -- this should make migration easier.