r/learnpython 3d ago

Hexagon in arcade not loading example code

I'm using the arcade framework and would like to make a hex map game. The provided tutorial code (on this page https://api.arcade.academy/en/latest/tutorials/hex_map/index.html)does not work for import reasons and I'm wondering:

  1. Is this documentation drift (which I've already seen in other parts of the project) where code has been refactored but the examples didn't get rewritten.

  2. How do you import this part of the library to make the example code work properly

  3. How can I get a manifest of importable components of a library? This could have had it's name changed and I wouldn't know.

Any help would be appreciated.

2 Upvotes

5 comments sorted by

2

u/carcigenicate Carcigenicate 3d ago edited 3d ago

I don't know why the tutorial is mentioning that module without explaining anything. The hexagon module was introduced in version 4.0.0.dev4:

New hexagon utilities module. See #2695

But the latest release build is 3.3.3, so that's what you get if you run pip install arcade. To download pre-release versions, you need:

pip install --pre arcade

But, this is deliberately marked as a pre-release build, so it may have new bugs, so use at your own risk.

1

u/SparklingSubsidy6 3d ago

docs being out of date is the worst, especially when you're just trying to follow along and nothing lines up. i'd crack open the library's `__init__.py` or main module and just `print(dir(arcade))` to see what's actually there, usually the quickest way to spot a renamed class or moved function without digging through changelogs

2

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 3d ago

I fixed the link for anyone else visiting this discussion: https://api.arcade.academy/en/latest/tutorials/hex_map/index.html

Basically this particular tutorial is new to the currently-in-beta 4.0 build of Arcade, and the "latest" branch of the docs happens to include things for that. If you want to stick to stable versions, change the docs to 3.3.3 - although this tutorial isn't available there, so if this is exactly what you need you may want to use the pre-release versions of Arcade if you're willing to deal with possible changes before the stable release.

2

u/Screaming_Candle 2d ago

Ok, now that tracks. Thanks.