Install Pycharm and Python: Clone a github project

Installing python

Executing clone github repo should be easy click here to skip this! Are you eager to delve into Python coding but unsure how to quickly set up on Windows 10? In this step-by-step guide, I’ll walk you through the process of installing Python 3.10 in just three easy steps. By the end of this tutorial, you’ll have Python up and running, ready to kickstart your coding journey.

Python is a high-level, versatile programming language known for its simplicity and readability. Created by Guido van Rossum and first released in 1991, Python has gained immense popularity due to its clean syntax, ease of learning, and extensive community support.

Key characteristics of Python include:

Readability:

  • Python emphasizes code readability with its clear and intuitive syntax, making it easier to write and understand code.

Versatility:

  • It’s a versatile language used in various domains such as web development, data analysis, artificial intelligence, scientific computing, automation, and more.

Interpreted and Interactive:

  • Python is an interpreted language, which means the code is executed line by line by an interpreter, allowing for easier debugging and faster development. It also offers interactive modes where code can be executed line by line, allowing for experimentation and learning.

Large Standard Library:

  • Python comes with a comprehensive standard library, providing a wide range of modules and packages to perform different tasks without needing additional downloads.

Community and Ecosystem:

  • Python has a vast and active community that contributes to its growth. It offers numerous third-party libraries and frameworks like Django, Flask, NumPy, Pandas, TensorFlow, and more, catering to various needs of developers.

Python’s simplicity and flexibility make it an excellent choice for beginners and professionals alike. This enables them to create a wide array of applications, from simple scripts to complex software systems.

Step 1: Access Python.org and Download Python 3.10 To begin, open your preferred browser and search for “Python.” Navigate to the official website, python.org.

Once on the site, locate the ‘Downloads’ section and click on “3.10.1 for Windows” button. This action initiates the download of the Python executable (exe) file.

Note: For installing a different version of python click on all releases

Use the release section and scroll down/up and click on the ‘download’ for the desired version.

Once the download is complete, access the download bar and click to open the downloaded file. During the installation process, ensure that the option to ‘Add Python 3.10 to PATH’ is checked.

Opt for a custom installation and ensure all optional features, such as pip and idle, are selected.

Click on ‘Advanced Options,’ choose ‘Install for all users,’ and proceed by clicking the ‘Install’ button.

Check Install Python version

Step 2: Verifying Python Installation As the installation progresses, patiently wait for the green progress bar to complete. Once done, it’s time to verify that Python has been successfully installed on your system. Access the Start menu, type ‘cmd,’ and open the Command Prompt. In the command prompt, type ‘python –version.’

If Python has been installed correctly, you’ll receive a confirmation message displaying the installed Python version.

Install Pycharm

PyCharm is an Integrated Development Environment (IDE) specifically designed for Python development. Developed by JetBrains, it offers a range of features like code assistance, intelligent code completion, debugging tools, and project navigation, enhancing the efficiency of Python programming.

There are two main editions of PyCharm:

  1. PyCharm Community Edition: This version is free and open-source. It includes fundamental features for Python development, making it suitable for individuals, beginners, and small projects.
  2. PyCharm Professional Edition: This version offers advanced features tailored for professional developers and larger projects. It includes additional tools for web development, database integration, scientific tools, and frameworks beyond the capabilities of the Community Edition. The Professional Edition is a paid version, but JetBrains offers free trials.

The choice between the Community and Professional editions depends on the complexity of your projects and the specific features you require. For most Python developers, the Community Edition provides ample functionality at no cost.

pycharm sourc = https://www.jetbrains.com/pycharm/download/download-thanks.html?platform=windows&code=PCC

once downloaded: click on the file to start ithe installisation:

image

the Installation program will start click on the deafult options. If applicable uninstall any previous version and ‘Uninstall Silently to ensure no settings are lost by checking the boxes:

image

Make sure to check the boxes for updating the PATH Variable and create associations, anything else is optional:

image

Next reboot pc to ensure pycharm is fully installed:

image

Download and Install Git

Git is a distributed version control system used for tracking changes in source code during software development. It was created by Linus Torvalds in 2005 and has since become one of the most widely used version control systems in the world. In to order execute clone github repo we need git.

Key aspects of Git include:

  1. Version Control: Git tracks changes made to files, allowing developers to collaborate on projects, revert to previous versions, and manage different versions of their code.
  2. Distributed: Unlike centralized version control systems, Git is distributed, meaning every developer working on a project has a complete copy of the repository, including its history. This allows for offline work and more flexible collaboration.
  3. Branching and Merging: Git allows developers to create branches to work on new features or fixes independently. These branches can be merged back into the main codebase when ready, facilitating parallel development and experimentation.
  4. Speed and Performance: Git is known for its speed in handling version control operations, even with large projects and extensive histories.
  5. Security: Git uses cryptographic techniques to ensure the integrity of data. Each change made to the codebase is tracked by a unique hash, ensuring the history’s security.

Git is commonly used in software development but can also be used for managing any type of files where tracking changes and collaboration among multiple contributors are essential. Platforms like GitHub, GitLab, and Bitbucket provide hosting services for Git repositories, enabling collaboration, code review, and project management features on top of Git’s version control capabilities.

Source: https://git-scm.com/downloads

Go to this page then click on download based on your operating system this guide will be for windows

https://git-scm.com/downloads and download os version of git

Once the file is downloaded open the file and go through the installation instructions and unless otherwise needed use the default options.

open the git installation file and go through the installation instructions

Cloning the github project (clone github repo)

GitHub is a web-based platform built around Git, the distributed version control system. It provides a collaborative environment for developers to host, manage, and review code, enabling seamless collaboration on software projects. This is where actions that involve clone github repo take place and can be successfully completed using github.

Key features of GitHub include:

  1. Repository Hosting: GitHub allows users to create Git repositories for their projects. These repositories store code, files, and a complete version history, making it easy to manage and track changes.
  2. Collaboration: It facilitates collaboration among teams by allowing multiple developers to work on the same project concurrently. Features like pull requests, issues, and discussions enable efficient communication and code review.
  3. Community and Social Coding: GitHub has a vast community of developers who can discover, contribute to, and collaborate on open-source projects. It encourages social coding by allowing users to follow projects, star repositories, and contribute via forks and pull requests.
  4. Project Management: It offers project management tools like boards, milestones, and task tracking to organize and prioritize work within a project.
  5. Integration and Extensibility: GitHub integrates with various third-party services, tools, and continuous integration systems, enhancing its functionality and allowing for seamless workflows.

GitHub has become a central hub for open-source collaboration, serving as a repository hosting service and a social network for developers. It’s widely used by individuals, teams, and organizations to manage software projects, foster collaboration, and contribute to the open-source community.

Open Pycharm and close any existing projects and select ‘Get from VCS’

select 'Get from VCS'

In the URL entry box type: https://github.com/<project author>/<name of Project>

Then Select ‘Clone’.

This also means we have executed the clone github repo command.

n the URL entry box type: https://github.com/slyautomation/<name of Project>

alternatively if using the terminal commands, make sure the terminal is at the right directory. Then type:

git clone https://github.com/<project author>/<name of Project>

Ensure python interpreter is setup in project

Setting up a Python interpreter in your project has several benefits:

  1. Portability: When you specify a Python interpreter for your project, it ensures consistency across different environments. This means that regardless of where the project is run, it will use the specified interpreter, reducing compatibility issues.
  2. Dependency Management: Different projects may require different versions of Python or specific packages. Specifying the interpreter helps manage dependencies, ensuring that the correct version of Python and required packages are used.
  3. Virtual Environments: Using a specified interpreter allows you to create virtual environments for your project. Virtual environments isolate dependencies, preventing conflicts between different projects that might require different package versions.

Once the Project is open, using the top banner; go to ‘File’, then ‘Settings’.

go to 'File', then 'Settings'.

On the settings window, under the section ‘Project’, select Python Intrepreter and click on the cog icon

select Python Intrepreter and click on the cog icon

Select ‘New environment’ option, make sure the location is the same as the project’s and then click ok.

make sure the location is the same as the project's and then click ok

click ‘Add…’

add python interpreter

Select the option ‘New Environment’, make sure the address is the same as the Project’s and click ok on both windows.

Select the option 'New Environment'

Ensure venv (virtual environment) is active

A virtual environment in programming, particularly in languages like Python, creates an isolated environment for a project or application. It helps manage dependencies, packages, and their versions separately from other projects on the same system.

Here’s what a virtual environment does:

  1. Isolation: It creates a self-contained directory that houses a specific Python interpreter and its associated libraries, ensuring that the dependencies installed within this environment do not interfere with other projects or the system’s global Python installation.
  2. Dependency Management: Virtual environments allow you to install and manage project-specific dependencies and libraries without affecting other projects. This ensures that each project can have its own set of required packages and versions.
  3. Version Control: By having separate virtual environments for different projects, developers can ensure that each project uses the specific versions of libraries and packages it needs, preventing conflicts that may arise from version differences.
  4. Portability: Virtual environments can be easily shared or replicated across different machines or with other developers. This portability ensures consistency in the development environment, regardless of the system used.
  5. Testing and Development: Virtual environments are valuable in testing new libraries, experimenting with different versions, and ensuring that the application runs consistently across different environments.

In summary, virtual environments provide a controlled, isolated space for managing dependencies and creating a consistent and reproducible development environment for individual projects, ensuring they have the required packages and versions without affecting other projects or the system as a whole.

Commands to activate venv

Terminal commands can be very useful within PyCharm for various reasons:

  1. Package Management: You can use terminal commands to install, update, or remove packages using tools like pip or conda. This allows you to manage project-specific dependencies easily.
  2. Version Control: Terminal commands integrate well with version control systems like Git. You can commit changes, create branches, merge code, and perform other version control operations directly from the terminal.
  3. Project Setup: Certain tasks, like initializing a new Git repository, setting up virtual environments, running scripts, or executing custom commands, can be efficiently done through the terminal.
  4. Debugging: You can run Python scripts or debug code directly from the terminal, which might be necessary for specific debugging configurations or when dealing with complex command-line arguments.
  5. Custom Scripts: Terminal commands enable the execution of custom scripts or automation tasks that are not directly supported by PyCharm’s interface.

PyCharm offers an integrated terminal where you can execute these commands without leaving the IDE, providing a seamless workflow for both coding and managing the project environment. It allows developers to leverage the power of the terminal alongside PyCharm’s features, enhancing productivity and flexibility.

in the terminal type:

cd venv

cd scripts

activate

There should be (venv) in front of your project’s location in the terminal:

Commands to activate venv
cd venv
cd scripts
activate

revert location back to default in terminal by typing:

cd ../

cd ../

revert location back to default in terminal by typing cd ../

This will ensure all code is executed within the project.

make sure venv is not in the excluded folders, go to settings under Project and project structure:

Click the x to remove excluded folders and click apply, then ok.

image

Here’s a video guide that goes through installing python, pycharm and clone github repo:

Pulling a Repo (Updates)

Pulling a repository, commonly referred to as “pulling a repo,” involves fetching the latest changes from a remote repository (like GitHub, GitLab, etc.) and merging them into your local repository. Alos similar to clone github repo but is used when the project aleady contains the cloned repo. It updates your local copy with any new commits made by others since your last synchronization.

This process allows you to incorporate and sync the most recent updates and collaborate effectively within a project, ensuring everyone has access to the latest codebase.

In order to do this in pycharm click on the blue arrow in the top right hand corner of the app.

Pulling a Repo (Updates)

On the prompt select the default unless you need a specific branch (version) of the repo.

Commits (request an update to the repo with your code)

Committing to a repository involves saving changes made to files in a version control system like Git. When you commit, you’re creating a checkpoint that stores the current state of your files within the repository. Each commit typically includes a message explaining the changes made, providing a history of modifications. This allows for easy tracking, collaboration, and reverting to earlier versions if needed, ensuring a well-documented and organized development process.

In order to do this in pycharm click on the green tick in the top right hand corner of the app.

Commits (request an update to the repo with your code)

The changes will be files highlighted blue simply check or unckeck the boxes to determine what will be committed to the repo, then press commit.

If needed, the next step is to then ‘Push’ commits to overwrite any code in the report main.

Pushing to Repo (Finalise updates and update the main version of the Repo)

Pushing a repository involves uploading the committed changes from your local repository to a remote repository, such as GitHub or GitLab. This updates the clone github repo command. This action shares your local changes with others collaborating on the same project, making them accessible to team members and updating the central repository with your latest modifications.

Pushing allows for synchronization between local and remote repositories, facilitating collaboration and ensuring that everyone working on the project has access to the most up-to-date codebase.

In order to do this in pycharm click on the green arrow in the top right hand corner of the app then click the push button.

Well done on smoothly navigating the complex setup of python within Pycharm! With a fully operational clone gihub repo and the exciting possibility of customising to your needs, you’re poised to dive into an enriched coding adventure. This tailored setup beckons you to discover a personalized coding realm, finely crafted to align with your programming goals.

Need an easy python project to get started in cloning a github repo? Try How to Create an Easy Color Detection Bot: A Step-by-Step Guide!