Adding Final Configurations to Your Project
In this lesson, you’ll dive into the following tasks:
- Making a containing folder for the whole project
- Creating a virtual environment before installing it
- Adding final details to
pyproject.toml
00:00 Let’s see. So we’ve set up our build system, and now we need to start defining some names. Okay, we’ll save it. And then now we can have a look at our directory.
00:10
So which files do we have define here? And we can see that the important ones is that we have the folder snakesay\
, and we now have the file pyproject.toml
.
00:19
And it’s outside the folder. That’s outside the snakesay\
folder. So, does it make sense to perhaps create another folder to contain all of this stuff? Yeah, typically you want to have one folder for your project.
00:33
So, we could potentially just do that as well. Right, because having this in sort of your main—right now we’re in a real Python folder, but this would be sort of your home folder where you’re building different projects. So maybe we’d want to actually create—and would we just call this the … Yeah, we could just call this snakesay\
as well, but maybe for clarity, let’s call it snakesay-project\
. Yeah, and because we already have a folder here called snakesay\
, it’s not going to let us. Right.
01:02
So I’m just going to make that and then move snakesay\
into snakesay-project\
.
01:11
And now you also want to move the pyproject.toml
into snakesay-project\
. Right. Now we also want to move the pyproject.toml
into snakesay-project\
.
01:21
Now if we go into snakesay-project\
… and we see a list here. Okay, now we have everything we need in here. Exactly. Okay,
01:31
so now we want to try to install this. Okay, typically what you want to do also is to install this into a virtual environment. So let’s create a venv
here as well.
01:42 You can just install it into your global Python install. Depending on what you want this for, then you can do that. But just for repeatability’s sake, we’re going to create a virtual environment here.
01:55
And you’ll notice the -m
flag here, which is the recommended way to call venv
and just calling the venv
venv
as is convention. Okay, so now we want to activate our venv
, and on Windows PowerShell, this is done by calling this (venv\Scripts\activate
), and on Linux it will be source venv/bin/activate
.
02:20 Okay, so now we have an activated virtual
02:26
environment. So now we’ve defined a build system, but in this PEP 621 that we looked at, we saw that there were some other things that are needed, like the name
and so on.
02:35
So if we now create a table here called project
,
02:40
and then here below it, you can just type name =
and then we’ll do a string called "snakesay"
. Yeah. So now we have defined the name our project, and there are a couple of other things that we also should define. So I guess if you just quickly jump back to the PEP, we can see here that we have name
and version
.
03:02 Both of these should be specified. Okay. But otherwise, the rest of the things are not that necessary, especially for a local version, although these are really convenient if you put stuff in PyPI. But yeah, what’s nice to add in here is a name, and then we could potentially add in a version if we want to specify that as well.
03:24
Okay. So, let’s put in a version, and how do we specify that? So that should just be a string, as you have there, and then we can kind of come up with whatever versioning scheme we’d like to use, but for now, let’s just say that we have our first version, so we’ll this version "1.0.0"
. Okay, so this is sort of fully developed.
03:42 Yeah, we’re ready to use it ourselves. We’re ready to use it ourselves because, yeah, we’re not thinking about releasing this project to the public. It’s something we want to use locally. But we are ready to do that now.
03:52 We are finished sort of main development, so we can just say that’s version one. Okay. Okay, and now let’s just save this file, and let’s try to install it.
Become a Member to join the conversation.