question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Refactoring to rename a model attribute changes the name in initializers

See original GitHub issue

This 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:

Screen Shot 2019-08-09 at 11 39 48 AM

to this:

Screen Shot 2019-08-09 at 11 39 54 AM

I would like it to instead go to this:

Screen Shot 2019-08-09 at 11 43 08 AM

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

2reactions
dmontagucommented, Aug 11, 2019

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!!

0reactions
dmontagucommented, Aug 13, 2019

I’m going to close this and open a more specific issue, given this now works.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found