Mastering PyCharm Transcripts
Chapter: Packages
Lecture: Your turn: Packages

Login or purchase this course to watch this video and the rest of the course contents.
0:02 Have you created a Python package before?
0:05 Well, you're going to now,
0:07 because we're going to create a new Python package
0:09 and use the PyCharm tools to make it installable
0:13 and get the right structure, all those kinds of things.
0:15 Over here, we're going to start from just blank,
0:19 so you don't need to check out any code for this one,
0:22 but what we're going to do is we're going to create a new project,
0:24 we're going to make it into a package,
0:27 not just a random Python project,
0:29 we're going to add a silly little feature to it
0:32 so you can run some code and play with it,
0:35 we will create a setup file so that other people can install
0:37 say from PyPi or other places your package;
0:40 and finally, we're going to use that one by creating a virtual environment,
0:44 running our setup to test that there
0:47 and then importing the package to make sure it works.
0:49 So you get a little background on what packaging in Python is
0:52 we're going to come over here and see
0:55 how you can use the PyCharm tools to make it a package,
0:57 add a feature, it's just a simple little calculator app
1:01 that lets you create like an add and subtract method
1:05 so really, really simple, we're not going too far down into anything advanced here,
1:10 the code is not what's important, it's the package.
1:12 So we're going to call it Calcy, our little simple calculator,
1:15 hopefully, that doesn't conflict with anything you have installed,
1:18 I tried to name it something that probably doesn't exist.
1:20 And you see that you can import it, use its math submodule and add function.
1:26 They want to create a setup package,
1:28 beware that PyCharm may go overboard
1:33 with all the virtual environment packages in there
1:35 so you have to clean that out, that's kind of unfortunate it does that
1:39 maybe it will stop by the time you take this class, but right now it does it,
1:42 and you'll see how to activate it
1:44 notice the steps on Windows are slightly different than they are on Mac and Linux,
1:49 we're going to run the setup
1:52 and make sure you go somewhere else on your file system
1:55 not the working folder because it'll just pick up the package right there
1:59 so then we're going to run the Python REPL,
2:01 and just interact with it like you saw before.
2:04 Alright, so go and create a calculator package.