A virtual environment is a self-contained directory that contains its own Python interpreter and packages. This allows you to manage project dependencies separately. In this tutorial, we will learn how to create a Python virtual environment in a specific location using the venv
module.
Before you begin, make sure you have Python installed on your system. If not, you can download and install Python from python.org.
Open your terminal or command prompt. The steps may vary depending on your operating system.
- Press
Win + R
, typecmd
, and press Enter.
- Press
Cmd + Space
, typeTerminal
, and press Enter.
- Use the keyboard shortcut to open the terminal (e.g.,
Ctrl + Alt + T
).
Use the cd
command to navigate to the directory where you want to create your virtual environment.
cd /path/to/your/desired/location
Replace /path/to/your/desired/location
with the actual path where you want to create the virtual environment.
Run the following command to create a virtual environment named venv
:
python -m venv venv
If you're using Python 3.3 or newer, you can use the python3
command:
python3 -m venv venv
This command creates a directory named venv
containing the virtual environment.
Activate the virtual environment. The activation command may differ based on your operating system.
venv\Scripts\activate
source venv/bin/activate
Once activated, you will see the virtual environment's name in your command prompt or terminal.
When you're done working in the virtual environment, you can deactivate it:
deactivate
This returns you to the global Python environment.
Congratulations! You have successfully created and activated a Python virtual environment in a specific location.
In this tutorial, we will cover the fundamental concepts of version control using Git and how to collaborate with GitHub. These skills are essential for managing and tracking changes in your projects.
If you haven't installed Git on your machine, you can download and install it from here.
Configure your Git username and email with the following commands (please use GitHub credentials). Replace "Your Name" and "your.email@example.com" with your actual name and email.
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
- Create and log in to your GitHub account.
- Set up GitHub token - https://github.com/settings/tokens.
- Click on the "+" sign in the top right corner and select "New repository."
- Name your repository and provide a description.
- Optionally, initialize this repository with a README file.
- Click "Create repository."
Copy the URL of the repository you just created on GitHub. Open the terminal, navigate to the directory where you want to clone the repository, and run:
git clone https://github.com/your-username/your-repository.git
Replace the URL with the one you copied.
cd your-repository
After making changes to your project, stage the changes and make a commit.
git add .
git commit -m "Your commit message here"
Repeat these steps whenever you make changes to your project.
Create a new branch to work on features or fixes without affecting the main codebase.
git branch feature-branch
git checkout feature-branch
Alternatively, you can use a shortcut:
git checkout -b feature-branch
Fetch changes from a remote repository (like GitHub) to update your local repository.
git fetch
Pull changes from a remote repository into your current branch.
git pull origin master
Replace "master" with the branch you want to pull changes from.
Push your changes to a remote repository, such as GitHub.
git push origin feature-branch
Replace "feature-branch" with the name of your branch.
Merge changes from one branch into another.
git checkout master
git merge feature-branch
If there are conflicts during a merge, resolve them manually, then commit the changes.
Congratulations! You've covered the basics of Git and GitHub. These commands will help you manage and collaborate on projects effectively. Here you can find decent git tutorial which will cover all necessary commands and concepts: https://www.atlassian.com/git/tutorials.
Kedro is an open-source Python framework to create reproducible, maintainable, and modular data science code. It uses software engineering best practices to help you build production-ready data science pipelines.
Demo: https://demo.kedro.org/
Official project documentation: https://docs.kedro.org/en/stable/index.html
We will follow Kedro's brilliant documentation and tutorials:
- Kedro concepts: https://docs.kedro.org/en/stable/get_started/kedro_concepts.html
- Set up Kedro: https://docs.kedro.org/en/stable/get_started/install.html
- Create new Kedro project: https://docs.kedro.org/en/stable/get_started/new_project.html
- Tutorial: https://docs.kedro.org/en/stable/tutorial/spaceflights_tutorial.html
- Kedro with Jupyter Notebooks: https://docs.kedro.org/en/stable/notebooks_and_ipython/kedro_and_notebooks.html
- Kedro viz: 5.1 introduction: https://docs.kedro.org/projects/kedro-viz/en/stable/kedro-viz_visualisation.html 5.2 charts visualization: https://docs.kedro.org/projects/kedro-viz/en/stable/visualise_charts_with_plotly.html 5.3 experiments tracking: https://docs.kedro.org/projects/kedro-viz/en/stable/experiment_tracking.html
- More details: https://docs.kedro.org/en/stable/starters/index.html and https://docs.kedro.org/en/stable/kedro_project_setup/index.html
- More advanced stuff - kedro-mlflow: https://kedro-mlflow.readthedocs.io/en/stable/source/03_getting_started/01_example_project.html