0% found this document useful (0 votes)
39 views12 pages

Python Environment Setup and Git, Github

Python environment set up

Uploaded by

tonysatrk21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views12 pages

Python Environment Setup and Git, Github

Python environment set up

Uploaded by

tonysatrk21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Python Environment Setup

and Git, Github


Installing Python
macOS
brew install python3
Video: How to Install Python on Mac YouTube

Windows
Download from python.org, add to PATH
Video: How to Install Python on Windows YouTube

Ubuntu
sudo apt update && sudo apt install python3 python3-venv python3-pip
Video: How to Install Python on Ubuntu YouTube
Python Virtual Environments
● Why Use Them?
Isolates project dependencies to avoid conflicts.
● Creating with venv
○ macOS/Linux: python3 -m venv .venv
○ Windows: python -m venv .venv
● Activating
○ macOS/Linux: source .venv/bin/activate
○ Windows: .venv\Scripts\activate
● Deactivating: deactivate

● IDEs and Editors: VSCode and Cursor for general development, and PyCharm for a more
advanced setup.
Git and GitHub
● Git is a distributed version control system used for tracking changes in source
code during software development.

● Allows multiple developers to work on the same project simultaneously


without conflicting with each other's work.

● GitHub is a web-based platform for hosting Git repositories.


Installing Git
macOS

● brew install git


● Video: How to Install Git on Mac | Configure Git and GitHub on Mac (2024) YouTube

Ubuntu

● sudo apt install git


● Video: How to Install and Configure Git and GitHub on Ubuntu 22.04 LTS YouTube

Windows

● Download Git for Windows (Git Bash)


● Video: How to Install and Configure Git and GitHub on Windows YouTube

Configuring Git

● Set username: git config --global user.name "Your Name"


● Set email: git config --global user.email "[email protected]"

Cloning the Repository


● What is Cloning?
Downloading a copy of the repository to your local machine.
● Command
git clone https://github.com/your-username/solar-challenge-week1.git
Getting Started with Git
Git Basics & Workflow
● Initialize: git init
● Clone: git clone <repo-url>
● Staging: git add . → git commit -m "chore: init"
● Pushing: git push -u origin main
● Videos:
○ Git & GitHub Crash Course 2025 YouTube
○ Git and GitHub Full Course For Beginners 2024 YouTube
Cont.
Branching & Commits
● Create branch: git checkout -b setup-task
● Merge back: open Pull Request on GitHub → Merge
● Branching demo video: Git Branches Tutorial | Master Git Branching in 10 Minutes YouTube
● Commit message style:
○ init: add .gitignore
○ chore: venv setup
○ ci: add GitHub Actions workflow

.gitignore & requirements.txt


● .gitignore: exclude data/, *.csv, .ipynb_checkpoints/
● Purpose
Prevents tracking of unnecessary files (e.g., data, temp files).
● requirements.txt: pip freeze > requirements.txt
● Video: Automate all the things with CI/CD in GitHub Actions YouTube (walks through workflow setup including ignore
files)
Cont.
Managing Dependencies with requirements.txt
● What is it?
Lists project dependencies for easy installation.
● Steps
○ Activate virtual environment.
○ Generate: pip freeze > requirements.txt
○ Install: pip install -r requirements.txt

CI/CD
● What is CI/CD?
Automates testing (CI) and deployment (CD) for better code quality.
● Why GitHub Actions?
Built into GitHub, easy to set up, and customizable.
● Workflow Basics
A set of automated tasks triggered by events (e.g., push).
Cont.
Example:

name: CI

on: [push, pull_request]

jobs:

build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v4

- name: Set up Python

uses: actions/setup-python@v4

with: python-version: '3.x'

- name: Install deps

run: pip install -r requirements.txt

- name: Run tests

run: python --version

● Demo video: GitHub Actions CICD Tutorial With Live Project YouTube
Writing a README.md File
Purpose: Documents the project and setup instructions.

Example:

# Solar Challenge Week 1

A project for learning Git and CI/CD.

## Setup

1. Clone: `git clone https://github.com/your-username/solar-challenge-week1.git`

2. Create venv: `python3 -m venv .venv`

3. Activate: `source .venv/bin/activate` (macOS/Linux) or `.venv\Scripts\activate` (Windows)

4. Install: `pip install -r requirements.txt`


Resources & Links

● Python Setup
○ Mac: YouTube
○ Ubuntu: YouTube
● venv
○ Easy Guide: YouTube
○ VSCode macOS: YouTube
○ Ubuntu: YouTube
● Conda
○ YouTube · YouTube · YouTube · YouTube
● Git & GitHub
○ Install: YouTube · YouTube · YouTube
○ Basics: YouTube · YouTube
○ Branching: YouTube
● CI/CD
○ CI/CD 101: YouTube
Any questions?

You might also like