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
0:04 the default PyCharm formatting settings,
0:07 those are probably fine for you,
0:09 but they might not be, you know,
0:10 maybe you're working on a team that has different conventions about how long a line should
0:14 be before it wraps. How do you wrap parentheses and parameters around say a function
0:21 call or something like that. So we can go over to the preferences,
0:25 go to the editor, python or whatever other language you like.
0:28 We've got SQL, we've got Javascript all the things,
0:31 but right now we've got python selected and across the top.
0:34 You can see that there are six different tabs.
0:37 Right? How this huge along section is just unwrapping and races.
0:41 You can go in here and check things off and on and you can work with
0:45 them and control them as you see fit.
0:47 Which is really, really awesome.
0:49 So that will help you get going in terms of getting the code formatted the way
0:53 you like. What if you're working on a team if the settings of one user
0:58 and the settings of another user differ.
1:00 This is going to be a super annoyance because what's going to happen is someone is
1:04 going to say all right, I'm done writing code for this file,
1:07 let's reformat it and check it into source control and the parentheses will move around and
1:11 the commas will move around and whatnot.
1:13 And then the other person checks it out and they work on it and they're like
1:17 all right, I'm all done,
1:18 let's clean it up. They re format it shifts all of those things back around
1:22 They check it in and it looks like all these different lines have changed.
1:25 They haven't if you're lucky, you'll just see them fighting back and forth highlighting many
1:30 many meaningless changes. But if you're unlucky what that's going to actually be is
1:34 a merge conflict. But we can export these settings and share them with our team
1:40 and that's super helpful. So if we go over there and do this little gear
1:44 drop down thing, we can export it,
1:46 give it a name, then everyone can agree to load it up.
1:50 So that's really nice. But what if you're working at home on an open source
1:55 project that has its own coding styles?
1:57 You're working on the same computer,
1:59 but on a work project during the day that has different files,
2:02 different settings. You don't want to be loading up that files config and then the
2:06 other config and swapping back and forth.
2:08 That's not going to be fun.
2:10 So, notice that the top here says copy to project so we can actually store
2:15 the settings on a per project basis.
2:17 So what is in source control for the open source project can have common settings for
2:22 everyone using PyCharm and then your work project can have its possibly different settings stored
2:28 inside of its project, which will be really,
2:30 really helpful for everyone picking it up and using it right that way they don't even
2:35 need to export and import and remember to configure it,
2:38 it'll just be part of the project.