Effective 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? Well, you're going to now, because we're going to create a new Python package
0:10 and use the PyCharm tools to make it installable and get the right structure, all those kinds of things.
0:16 Over here, we're going to start from just blank, so you don't need to check out any code for this one,
0:23 but what we're going to do is we're going to create a new project, we're going to make it into a package, not just a random Python project,
0:30 we're going to add a silly little feature to it so you can run some code and play with it, we will create a setup file so that other people can install
0:38 say from PyPi or other places your package; and finally, we're going to use that one by creating a virtual environment,
0:45 running our setup to test that there and then importing the package to make sure it works.
0:50 So you get a little background on what packaging in Python is we're going to come over here and see
0:56 how you can use the PyCharm tools to make it a package, add a feature, it's just a simple little calculator app
1:02 that lets you create like an add and subtract method so really, really simple, we're not going too far down into anything advanced here,
1:11 the code is not what's important, it's the package. So we're going to call it Calcy, our little simple calculator,
1:16 hopefully, that doesn't conflict with anything you have installed, I tried to name it something that probably doesn't exist.
1:21 And you see that you can import it, use its math submodule and add function. They want to create a setup package, beware that PyCharm may go overboard
1:34 with all the virtual environment packages in there so you have to clean that out, that's kind of unfortunate it does that
1:40 maybe it will stop by the time you take this class, but right now it does it, and you'll see how to activate it
1:45 notice the steps on Windows are slightly different than they are on Mac and Linux, we're going to run the setup
1:53 and make sure you go somewhere else on your file system not the working folder because it'll just pick up the package right there
2:00 so then we're going to run the Python REPL, and just interact with it like you saw before. Alright, so go and create a calculator package.


Talk Python's Mastodon Michael Kennedy's Mastodon