00:0.14 We want to work with an existing package in PyCharm.
00:3.05 We just opened up the package directory.
00:6.24 Probably the one that contains the setup py is the top level is the best way
00:10.11 to go and when we do PyCharm automatically detect things we need to do to get
00:15.04 the package set up and ready to go.
00:16.6 For example, it will say look there's all these dependencies.
00:19.12 You're going to need to install these into your virtual environment that you've created.
00:22.45 You used a virtual environment. Right?
00:24.54 So it's going to just give us a button click to get this set up and
00:27.84 then we'll have at least most of the dependencies installed.
00:31.14 We'll also be able to say things like 'from.exceptions'.
00:34.24 The dot relative import works really well in packages.
00:39.04 One of the things you often need to do is install the package locally in development
00:43.38 mode so you can go over your tools,
00:44.89 click run setup py task pops up a dialog in here,
00:48.72 you can type all sorts of things we did to we start out by saying developed
00:52.77 to set up the package to work on and then later when we were ready to
00:57.12 ship it, we said 'bdist wheel' and that actually created a distribution version of wheel
01:2.39 that we could upload with twine to 'pypi.org'.
01:6.44 Miracle that was working with an existing package.
01:9.79 What if we want to create 'zapify'
01:11.09 an amazing package that will zap the bugs using abstract syntax trees somehow magically
01:16.65 Well we're going to create that package.
01:19.47 So what we can do is we can create a new python project that's empty with
01:23.96 a virtual environment so called it Zapify.
01:25.82  and have an empty Venv here when I talked about it,
01:30.2 I did this on the terminal or the command prompt.
01:32.91 I went over and I actually created the structure for us just because I was talking
01:37.12 about what constitutes a package. There's actually an option new python package here in 
01:42.41 PyCharm It doesn't do a lot for you If I want to create a python
01:45.55 package called zapify it will create a directory called zapify.
01:48.79 and put a Dunder 'init.py' in it.
01:50.96 That's empty. That's all we did over on the finder and command prompt.
01:56.04 Once we have that though, we need a setup_py to do real package things
01:59.83 Of course we can work with the package locally long as the pass the ride.
02:3.94 But we can't share it.
02:5.39 We can't upload it up to PyPI we can have someone else download init
02:8.46 and install it into their virtual environment for that.
02:11.22 We're going to need a setup py file and there's a couple of things you always
02:14.18 have to specify. Luckily PyCharm has a nice little dialogue for that.
02:18.17 So what we can do is if we select the top level of the project and
02:22.27 you do not already have a setup.py
02:24.12 You go to tools and you'll have this option there click that
02:26.83 It gives you this dialogue to fill out all the pieces.
02:29.12 Like what's your author email? What's the description which the version,
02:33.07 what's the author kind of odd.
02:34.71 The author and emailer visually separated but you know it doesn't matter.
02:38.14 You fill this dialogue out and then boom it creates this setup. py.
02:44.2 Use even set up tools so it sets the name the version the packages.
02:47.76 If you have sub packages when you do this,
02:49.94 we didn't have any when I click the button but if you did it usually automatically
02:54.05 detects them for you which is fantastic.
02:56.44 So it fills this out and then we can do all the nice setup operations like
03:0.02 create the distribution, the wheel for distribution and so on.
03:4.24 Really cool way to get up and running quickly with PyCharm and new packages.
