Welcome back,
let's get started with this process.
0:00
You can see I'm already here in GitHub.
0:04
I'm already logged in and
I'm at github.com/new,
0:06
which is where you
create a new repository.
0:09
And I'm just going to go through all of
the fields just like you would creating
0:12
a brand new Python project.
0:16
So first, your repository name.
0:19
Now these should be descriptive
of what this project is.
0:21
So that in the future, if any potential
employer were to be looking at your work
0:26
here in GitHub, they would see what
projects you've worked on and get
0:30
a little bit more information than just,
say, something that says Python project.
0:34
So I'm going to pretend that this
0:40
is a number-guessing-game.
0:44
And then in the description,
0:49
this is also a great place to just write
a little bit about what this project is.
0:51
I'm just gonna put a Python
number guessing game.
1:05
Next, you'll wanna determine if
you want this public or private.
1:07
If it is public, then that means anyone
can view it, like potential employers,
1:11
other friendly coders, things like that.
1:16
Private means that you can see it and only
people you permit will be able to see it.
1:19
So if it's something you don't really
want anyone to see, then keep it private.
1:26
If it doesn't matter to you,
then you can do public.
1:30
I'm gonna come down here, and then you can
choose to add a README and .getignore and
1:35
a license, if you would like.
1:39
I'm gonna go ahead and do the first two.
1:41
And then you can see for .gitignore
you can actually, if I scroll down,
1:45
you can see there's a lot of options here,
and
1:49
you're probably noticing some
languages like C and C++.
1:52
So if I start typing in Python you can
see it has kind of a general template
1:56
already for you for Python.
2:01
Choose Create repository, and here it is,
and you can see it's just going
2:04
to add in the README, the name of our
repo, and the description that you input.
2:10
And then the .gitignore just
has a bunch of things that
2:16
you might find in a really
large Python project.
2:20
For a project you might be working
on you probably won't need really
2:24
much of any of these except for
that pycache way up here at the top.
2:29
Cuz that can happen quite
a bit in larger projects.
2:34
But I wanted to show it to you so that
you could see it was an option as well.
2:38
So now that we have our repo created and
our readme and .gitignore,
2:44
I'm going to open our project
locally using GitHub Desktop.
2:48
And I can do that by clicking Code.
2:53
So you can also choose to do it
over your terminal in the console,
2:56
but I'm gonna open with GitHub Desktop.
3:02
So I'm gonna click, you can choose
if you want this to always happen,
3:05
and then open it here.
3:10
So you can see it has the URL for
the repo and then the local path.
3:12
So you may wanna change the local path,
so it's going to put this folder maybe
3:19
inside of a Python Projects folder or
inside of a Coding Projects folder,
3:24
wherever you wanna put it so
that keeps up with your organization.
3:28
Okay, so I have moved mine over
to Documents/python_projects, and
3:34
then I'm gonna click Clone.
3:38
And see it takes a little bit and
3:39
then it doesn't look like
much has happened but it has.
3:42
It's now on your computer and
I can open it here in Visual Studio Code.
3:48
I'm gonna do that next so
3:53
we can do the rest of the local changes.
3:57
There we go, it wasn't letting me
move this over for a second there.
4:05
Okay, so first thing,
let's set up our local environment.
4:09
So you can see I have a different
kind of terminal installed,
4:14
it's called zsh, Z-S-H, here.
4:19
You can see it there on the right.
4:22
But it shows that I am on my main branch,
which also helps me know that I am,
4:25
in fact,
in a repository that's linked to GitHub.
4:30
Now to set up my virtual environment
I'm gonna run the steps for a Mac.
4:34
The steps on a Windows will be in
the teacher's notes right below.
4:39
So I'm gonna do python3 -m, and
4:45
you can see I've typed this lots
of times so it pops it up for me.
4:47
V-E-N-V and then this E-N-V here
at the end is actually going to be
4:53
the name of the environment folder.
4:58
So you can change that if you want to,
env is kind of just the typical pattern,
5:01
which does make it easier for
others to know what that is.
5:06
Okay, so you can see it created the
environment folder up here on the left.
5:16
And it's also asking if we
want to use the virtual
5:20
environment that we just created,
which, yes, we do.
5:24
Perfect, now the next thing we need
to do is we need to activate it.
5:29
So this can be easily forgotten.
5:33
A lot of people will remember
the part about doing
5:36
the python3 -m venv env and
then forget to activate it.
5:40
So, again, this is how you do it on a Mac,
source and then you do env/bin/activate.
5:46
And you can see how my command here,
not my command, but
5:54
you can see how this line changed.
5:58
It now shows that I'm inside
of my environment and
6:01
I'm still inside of my repo as well.
6:05
Now I'm going to add my app.py
file just to practice some
6:09
typical conventions since that's
typically what you call your file.
6:14
And you can see it has this little,
it's green it has this little U file
6:21
because that is something that
will be added up to your GitHub.
6:25
That's something Visual Studio code does,
it's super helpful.
6:30
And you can see this environment folder,
let me zoom in just a little bit more so
6:33
it's super clear, is kind of grayed out.
6:38
That means this folder will
not be pushed up to GitHub,
6:41
which we don't want it to
get pushed up to GitHub.
6:45
So in environment, or
inside of .gitignore.
6:49
There's quite a few things.
6:56
So you can see it has some of
these typical environments already
6:58
in this .gitignore that we got
the template off of GitHub.
7:03
So it's automatically going
to ignore that for us.
7:08
But in case you forget, you wanna make
sure you get your environment folder.
7:12
And also way up here at the top
if I scroll, your pycache.
7:18
For some of the more entry
level Python projects those
7:21
are the good two to always grab.
7:26
Okay, next up we're going
to install SQL Alchemy.
7:29
So that's going to be python3
7:33
-m pip install sqlalchemy.
7:40
You can see it's running it here locally,
perfect.
7:46
That warning there in green is just
letting me know there's a new version of
7:55
pip that I can upgrade it to.
7:58
And then next I need to freeze
my project requirements and
8:02
that is done with pip freeze, a little
caret to the right, requirements.txt.
8:07
Again, the name of the file,
the requirements.txt,
8:15
can be named really anything, but
requirements.txt is the pattern and
8:19
is what other developers
will be looking for.
8:23
So I would stick with the conventions and
leave it as requirements.txt.
8:27
Run that and you can see it pops up over
here on the left and it's also green,
8:33
which lets you know it's ready to
be added up to your GitHub repo.
8:38
And when we install SQLAlchemy you can
see it also installs greenlets, so
8:43
it will be there for other developers
who want to run your project.
8:48
Perfect, now the final step is
to push our work up to GitHub.
8:55
Now we can do this here in the command,
or sorry, in the console in the terminal.
8:59
But I'm gonna do it,
since we are already using GitHub Desktop,
9:05
I'm gonna continue to use Github Desktop.
9:09
So I'm gonna pull that up, and you can
see it shows us the changed files and
9:12
then I can actually click on each and
app.py is empty.
9:17
There's what's in requirements.txt,
so it's all ready for us.
9:21
Here's where you will write the name
of your commit, and since this is
9:26
an initial commit this is kind of like
we're just getting things sped up.
9:31
Most developers still use initial commit
as the name of their commit, and then
9:37
in the description if you wanna add more
information you could say something like,
9:43
Setting up repo for a Python project.
9:56
Then we're going to commit
it to our main branch.
9:59
And you can see we have one commit
that's ready to go up to GitHub and
10:02
you can either push from here or
from up here at the top.
10:07
And then it's all done.
10:15
We can click View on GitHub.
10:16
We open up our GitHub here.
10:22
If I refresh you can see
we have .gitignore and
10:27
our README still but
now we have app.py and requirements.txt.
10:31
You can click into it just to see that
the items inside of those files are there.
10:37
Great job, you're all set up for
a new Python project.
10:44
The more you practice this
process the easier it will be.
10:48
Keep it up, Pythonistas.
10:52