The current way of saving/loading files is a bit cumbersome:
from elma.packing import unpack_level
with open('mylevel.lev', 'rb') as f:
level = unpack_level(f.read())
I would rather like to use API such as
from elma import Level
level = Level('mylevel.lev')
or maybe
from elma import Level
level = Level.load('mylevel.lev')
Currently implementing this would require some refactoring, since packing.py imports models such as Level and Replay, so it would create a circular dependency, if you tried to import packing to be used in the models.
Perhaps it would make sense to just move the packing code to the Level and Replay classes instead?
The current way of saving/loading files is a bit cumbersome:
I would rather like to use API such as
or maybe
Currently implementing this would require some refactoring, since
packing.py
imports models such asLevel
andReplay
, so it would create a circular dependency, if you tried to import packing to be used in the models.Perhaps it would make sense to just move the packing code to the Level and Replay classes instead?