alan-turing-institute / p2lab-pokemon

A Python library for running genetic algorithms to optimize Pokemon teams!
BSD 3-Clause "New" or "Revised" License
8 stars 1 forks source link

External data strategy needs decided! #43

Closed AoifeHughes closed 1 year ago

AoifeHughes commented 1 year ago

We're about to start needing external data sources. E.g., the Pokédex. Do we want to say that everything needs to be run from the root directory. Or do we want to support the library being more portable? If the later then we need to configure how pip install will setup and copy across data files.

@phinate how would you like this done?


Examples of data needed to be usable by the library:

hsahovic commented 1 year ago

@AoifeHughes in case you missed it, this data is accessible without any other required work from poke-env, through:

from poke_env.data import GenData

gen_9_dex = GenData.from_gen(9).pokedex

It's lazy loaded and cached for further use. Ditto for moves, natures and type charts. Learnsets are not included yet, but can be added if you need it.

AoifeHughes commented 1 year ago

@hsahovic this was my plan originally, but it doesn't seem to include the learnsets?

hsahovic commented 1 year ago

No, not yet. The data is included in the static folder though.

You could add it through something like:

def load_learnsets(self) -> Dict[str, Dict[str, Union[int, float]]]:
        with open(os.path.join(self._static_files_root, "learnsets.json")) as f:
            return orjson.loads(f.read())

and adding learnsets in GenData's init - if you want to open a PR to poke-env I would happily merge it.

AoifeHughes commented 1 year ago

Good shout! Yeah I'll do that. Thanks!

AoifeHughes commented 1 year ago

Think this is done with recent PR #44