Feature request: Refactoring to rename a model attribute changes the name in initializers
See original GitHub issueThis would bring it in-line with how doing a refactor on the __init__
signature works for normal classes. I could imagine this being hard to accomplish, in which case it may not be worth it, but it would be a very nice capability to have.
Neither the attrs nor dataclass plugins support this now, so it’s by no means a need-to-have, but that didn’t stop you from solving #4 ! And again, I think it would be very useful!
More concretely, right now, when you do a refactor, you go from this:
to this:
I would like it to instead go to this:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:18 (18 by maintainers)
Top Results From Across the Web
Change model attribute name based on status? - Stack Overflow
I have a Match model that has 3 users: an observer , a player1 , and a player2 , and a status enum...
Read more >Java refactoring and Source Actions - Visual Studio Code
Refactoring. The goal of the Java program refactoring is to make system-wide code changes without affecting behavior of the program.
Read more >How to Test Rails Models with RSpec - Semaphore CI
By the end of this tutorial you will know how to test your Rails models using RSpec and the Behaviour-driven Development approach.
Read more >Everyday Refactorings in IntelliJ IDEA - The JetBrains Blog
Renaming something manually by changing its name directly in a class file is not safe. For example, if we rename our Bug class...
Read more >Language Server Protocol Specification - 3.17
This document describes the 3.17.x version of the language server protocol. An implementation for node of the 3.17.x version of the protocol can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, I think that’s right. I personally never use
pydantic.dataclasses.dataclass
, but there are enough issues about it on the pydantic github that it seems worth supporting (eventually).Regardless, I think this plugin is already useful enough (and bug-free enough) to be worth 1) including in the PyCharm plugin store (or whatever it is called), and 2) including somewhere in the pydantic docs.
Thank you for all your effort on this!!
I’m going to close this and open a more specific issue, given this now works.