Type hint most export files#6216
Conversation
|
I'm looking through this, and I'm seeing a lot of reformatting files to styles I find ugly, like wrapping lines too short, and adding things like: Which isn't something I want to see in Ren'Py. (I'm considering using black to reformat Ren'Py, but with much longer line lengths, and probably with the preview style.) |
|
I'm using black to format the files. Should I configure it within this pr so it follows your style more closely? |
|
Also if you mean where it says _ = call()I added that to shut up basedpyright's linter. I figured out a better way that doesn't disrupt the code, namely |
|
Yes on using black, though I need to figure out what I want the line length to be. I've been playing around with 120. I'm leaning on doing a massive reformat of the Python code towards the end of the current release cycle, after I've merged all of the pending PRs. So this would wait for that to be merged. (Hopefully I'll be switching into release mode after I finish the current work on speeding up rendering.) I'll also need to audit these, so making it clear is going to be important. |
|
Ok, I did as much as I could. I'm not terribly familiar with the codebase, so some of these are my best guess, but I tried to make it as coherent as possible |
|
Any updates abt this? |
|
Scheduled to go in when I get some time to review it. |
|
Question about this - did you write the types yourself, was this generated with a tool, or something else? Part of this is trying to figure out the right way to to deal with some of the formatting changes that are introduced in this PR. They make it a bit hard to review, and also I don't love some of the choices the formatter made. So I'm trying to figure out the right way to deal with that. I'm liking the general idea of this, it's just a huge contribution that touches a lot of things. |
|
Yeah, I annotated the types myself, using my best guess based on how the function/class/variable is used. I apologise for the formatting. I use black for automatic formatting, which I imagine isn't ideal since it's very opinionated and allows for little configuration. On the other hand, ruff allows for fine grained configuring, so it would be more ideal for what you're trying to do. |
|
Were you able to run this, especially on Python 3.12? I'm noticing a number of errors, ranging from undefined types being used to syntax errors, like: |
|
Yeah, I think it would be best if I split this up in a bunch of smaller PRs, so it's easier to manage on both ends |
|
I'd suggest waiting on that. We're putting together some guidelines as to how Ren'Py typing should work, as we need a typing scheme that can last for a long time. That's going to be required for typing work to continue. |
|
Alrighty And I'll test the changes and roll out fixes for typos like these. Sorry for the inconvenience |
Version 2 of this. I'd borrowed a friend's laptop to make the previous PR, but had forgotten to set myself as author 😅
Anyway I'll be adding to this bit by bit as I keep finding things that need annotating