Git Product home page Git Product logo

python-dev-basics's Introduction

Basic version control

Creating a GIT repository

mkdir my-project
cd my-project
git init

Making a commit

touch README.md  # Make a file
git add .
git commit -m "My awesome message"

You can always check the status in your repository by typing git status.

Push the local commits to remote (fx. GitHub)

git remote add origin <URL to repo>
git push

Get remote commits to local

git pull

Setting up a Python environment and debugging in VSCode

Create a python 3 virtual environment

Make sure you have python version 3.x installed, then do

python3 -m venv venv

Open current folder in VScode

cd my/folder
code .

Ignore the venv files in git

It makes no sense to track your venv. To ignore it, make a file called .gitignore, and write venv in it.

Select the python interpreter in VSCode

Open the command pallette with shift+command+P (or shift+ctrl+P on linux), then look for the command Python: Select Interpreter. Pick the venv that you just created in the previous step. The VSCode debugger will use this venv.

Make a basic python script and debug it

Create a file called main.py (or whatever you want), and write some code in it:

def power(a, b):
    return a**b


print("hello world")

c = power(10, 3)

print(c)

While having this file open in VSCode, press F5 to start the debugger. If prompted, select "Current file". This will run your script.

You can also add a breakpoint by clicking in the left margin of the file. The debugger will stop when it encounters a breakpoint.

To go to the next line, press F10. To step into a function, press F11.

python-dev-basics's People

Contributors

martimors avatar

Stargazers

 avatar Kasper Primdal Lauritzen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.