DrInfy / sharpy-sc2

Python framework for rapid development of Starcraft 2 AI bots
MIT License
69 stars 28 forks source link

POC of how we can change and deprecate class names #34

Closed merfolk closed 4 years ago

merfolk commented 4 years ago

This is how we can change class names without breaking any old bots.

A deprecated class looks like this in PyCharm: kuva

And results in warnings like this in console:

C:\Dev\sc2\sharpy-sc2\dummies\terran\bio.py:201: DeprecationWarning: 'RequiredUnitExists' is deprecated, use 'UnitExists' instead
  worker_scout = Step(None, WorkerScout(), skip_until=RequiredUnitExists(UnitTypeId.SUPPLYDEPOT, 1))
C:\Dev\sc2\sharpy-sc2\sharpy\plans\build_order.py:68: DeprecationWarning: 'RequiredEnemyUnitExists' is deprecated, use 'EnemyUnitExists' instead
  require_list.append(RequiredEnemyUnitExists(unit_type, count))

To test this PR, these dummies are a good option since they use both of the renamed classes:

 py run_custom.py -p1 adept -p2 bio