Installing Your Project
It’s time to install! You’ll also learn about editable installs.
00:00
So, how do we install this? We’re in the snakesay
project. We’re in the snakesay
project, we’re inside the virtual environment we created, and now we can just use more or less the same pip install
command we usually use, so python -m pip install
.
00:16
And now we come to the difference because here, typically we’d now just say something like pip install pandas
, pip install django
, and so on.
00:22
Right. Now we want to pip install
our directory, so we should pip install
the directory name, and since we’re inside the directory that we want to install—inside the directory that contains the pyproject.toml
file—we just use a dot (.
).
00:39
So we’re in this project here, the snakesay-project
, and this is the project that has the pyproject.toml
. And inside this folder, there is the snakesay
, the actual package that we want to install. There’s the code, right. Right. Okay.
00:53
So refer to that with a dot. Yep, and then there is one difference that we might come into with a project that we’re writing ourselves versus something like pandas
, and that’s that we might want to change the source code of it. Right, once we’ve been using it for a while, we might say, “Oh, actually we want to, we want to change this.” Right. So that might mean we have to reinstall this.
01:15 Yes. So typically, that would mean that you then need to reinstall it to get those changes, but while we’re developing, that’s not very convenient. Right, yeah, that’s a bit of a pain. Yeah, we’re kind of back to almost like compiling in other languages. Right.
01:28
So, pip
has a flag called --editable
, or just -e
typically. So we can throw in a -e
in front of the dot, and this means that it’s not kind of freezing our projects, so instead it’s referring directly to our source code, so any change we make there will pop up immediately in our project. Okay, so now we’re ready to just install it.
01:52
So now we can see that it’s saying it’s installing build dependencies, and this is based on this build system thing that we defined in our pyproject.toml
.
02:01
And if we look into here, we can see that some places it says editable
. That’s coming from our -e
flag.
02:09
But in the end you can see that it installed snakesay-1.0.0
. Great.
Become a Member to join the conversation.