Effective PyCharm Transcripts
Chapter: The Editor
Lecture: Code formatting for teams
Login or purchase this course to watch this video and the rest of the course contents.
0:00 When we ran reformat file, what we were really doing is applying the default settings the default PyCharm formatting settings,
0:08 those are probably fine for you, but they might not be, you know,
0:11 maybe you're working on a team that has different conventions about how long a line should
0:15 be before it wraps. How do you wrap parentheses and parameters around say a function call or something like that. So we can go over to the preferences,
0:32 but right now we've got Python selected and across the top. You can see that there are six different tabs.
0:38 Right? How this huge along section is just unwrapping and races. You can go in here and check things off and on and you can work with
0:46 them and control them as you see fit. Which is really, really awesome. So that will help you get going in terms of getting the code formatted the way
0:54 you like. What if you're working on a team if the settings of one user and the settings of another user differ.
1:01 This is going to be a super annoyance because what's going to happen is someone is going to say all right, I'm done writing code for this file,
1:08 let's reformat it and check it into source control and the parentheses will move around and the commas will move around and whatnot.
1:14 And then the other person checks it out and they work on it and they're like all right, I'm all done,
1:19 let's clean it up. They re format it shifts all of those things back around They check it in and it looks like all these different lines have changed.
1:26 They haven't if you're lucky, you'll just see them fighting back and forth highlighting many
1:31 many meaningless changes. But if you're unlucky what that's going to actually be is
1:35 a merge conflict. But we can export these settings and share them with our team
1:41 and that's super helpful. So if we go over there and do this little gear drop down thing, we can export it,
1:47 give it a name, then everyone can agree to load it up. So that's really nice. But what if you're working at home on an open source
1:56 project that has its own coding styles? You're working on the same computer, but on a work project during the day that has different files,
2:03 different settings. You don't want to be loading up that files config and then the other config and swapping back and forth.
2:09 That's not going to be fun. So, notice that the top here says copy to project so we can actually store the settings on a per project basis.
2:18 So what is in source control for the open source project can have common settings for
2:23 everyone using PyCharm and then your work project can have its possibly different settings stored inside of its project, which will be really,
2:31 really helpful for everyone picking it up and using it right that way they don't even need to export and import and remember to configure it,
2:39 it'll just be part of the project.