Skip to content

Conversation

jmccardle
Copy link

I attempted to make each tutorial a minimal change over the 2021 version.

Copy link
Collaborator

@HexDecimal HexDecimal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the linters of this repo have been ignored, causing several blatantly incorrect changes to be mode to the source (broken type-hints and incorrect whitespace). The linter configuration is also outdated and should be bumped to target Python 3.11 or later.

Always ensure that Ruff and Mypy are happy with the source before committing changes.

Even if I approved this then it'd still have to coincide with updates to the website repository before it can be merged. Unless @TStand90 comments on this then that isn't happening.

@jmccardle
Copy link
Author

Thanks for the quick review. I've retraced the tutorial path and hit every step with black / ruff / mypy, and added all missing type annotations. Let's see if github's run of the linter agrees...

@HexDecimal
Copy link
Collaborator

It appears that you've attempted to move files, but they've been copied instead. game/components/ is a copy of the components/ directory which was removed.

@HexDecimal
Copy link
Collaborator

Also your linter scripts do not cover main.py.

If I were setting up automated linter scripts then I'd use pre-commit.

@HexDecimal
Copy link
Collaborator

Were these bash scripts intended to be committed?

@jmccardle jmccardle force-pushed the master branch 2 times, most recently from 7d56ce1 to 93d7464 Compare August 2, 2025 01:52
Copy link
Collaborator

@HexDecimal HexDecimal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As usual there are too many fundamental flaws with the tutorial to make a "minimal" fix to it. I've run into this issue many times myself.

@jmccardle
Copy link
Author

alright, think I've got it now -

  • no more shell scripts (those were accidental git add -A inclusions)
  • copy instead of moved files corrected
  • linted at each step
  • main.py included in the linting

I did eventually enhance my routine with pre-commit, but didn't include my .pre-commit-config.yaml.

@HexDecimal
Copy link
Collaborator

I did eventually enhance my routine with pre-commit, but didn't include my .pre-commit-config.yaml.

Feel free to commit the file.

@jmccardle
Copy link
Author

jmccardle commented Aug 5, 2025

this pass removed tcod.image in favor of directly using pillow

I have some thoughts on improving the aesthetics of how modules are imported, I'm not entirely happy with what's here, but I can also feel that I'm running out of inertia.

At the very least my fork is something I can share to help people using the tutorial get their code to execute with modern tcod and without the refactoring steps of tutorials 6, 8, and 10.

I think the way forward is with evaluating larger rewrites, like reordering lessons, going all-in on ECS, etc

@HexDecimal
Copy link
Collaborator

this pass removed tcod.image in favor of directly using pillow

The current file changes show the opposite.

I have some thoughts on improving the aesthetics of how modules are imported, I'm not entirely happy with what's here, but I can also feel that I'm running out of inertia.

I also have options on this. My current concern is that abstract classes should never be in the same module as their subclasses like they are now (main offenders being state and action base classes which are not even abstract when they should be). Doing this would cut down on cyclic imports (which I'd attempt to ban in the tutorial source code).

I'd also like to hear your specific thoughts on imports.

At the very least my fork is something I can share to help people using the tutorial get their code to execute with modern tcod and without the refactoring steps of tutorials 6, 8, and 10.

Great job. I know that isn't easy.

I think the way forward is with evaluating larger rewrites, like reordering lessons, going all-in on ECS, etc

I've had thoughts on this too, and a lot of time to think about this in general. I wouldn't mind collaborating on a new tutorial if you're interested.

self.width, self.height = width, height
self.entities = set(entities)
self.tiles = np.full((width, height), fill_value=tile_types.wall, order="F")
self.entities: Set[game.entity.Entity] = set(entities)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible redundant type-hint here. set(entities) already defines this hint.

Even if you wanted to explicitly hint this, typing.Set is known to be deprecated, replaced by collections.abc.Set.

@jmccardle
Copy link
Author

jmccardle commented Aug 5, 2025

this pass removed tcod.image in favor of directly using pillow

The current file changes show the opposite.

Yikes, my bad. This was changed in part 10 then immediately overwritten in part 11, probably a clumsy checkout --theirs at some point

I've had thoughts on this too, and a lot of time to think about this in general. I wouldn't mind collaborating on a new tutorial if you're interested.

Absolutely, I think that would be a great deal of fun. I've been a consumer of libtcod for some time now and it's been exciting to work with you just on these little updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants