-
Notifications
You must be signed in to change notification settings - Fork 0
Tools I
- Goals: Brief introduction to Github. Learn how to use the pycharm IDE
- Time: 2h
- Date: Tuesday, Jan-22nd-2019
Modern programming projects have thousand of lines of code and hundred of developers working on them. It is necessary to use powerful tools to manage it: The revision control systems. The projects are located into a repository
Currently, the two most used controls systems are Github and GitLab. Both are based on the opensource engine called git, developed in 2005 by Linux Torvalds, the creator of the Linux Kernel
In this subject we will focus on the use of Github
Currently Github stores more than 90 Millions of projects. These projects are Opensource and we are granted permission for studying, using and modifying them. You can find more information in the Octoverse page
- Question 1: Which are the Top 3 OpenSource projects? Find the answer in Octoverse
- Question 2: Which are the Top 3 programming languages?
Let's have a look, for example, at the tensor flow project. In the Github page you will find a lot of useful information about the project: How it is organized in folder, the README file, the contributors, the source code
Spend some time navigating through the project
- Question 3: How many contributors are there up to now?
- Question 4: How many contributions? (Commits)
- Question 5: When was the latest contribution? By whom?
- Question 6: Can you find some python files?
All the projects are stored in Repositories. Github let us navigate through the projects using a webpage. Let's have a look to the FreeCAD project. It is a tool for designing objects in 3D, for later printing them using a 3D printer
- Demo 1: A simple demo of use of Freecad: Showing the Silicon Athoms and crystals
- Exercise 1: Can you find the Freecad project in Github?
- Question 7: How many contributors are there up to now?
- Question 8: When was the latest contribution? By whom?
- Question 9: What programming language is used mostly?
An organization is a group of repos. For example, the FreeCAD project shown before, has different repositories, all of them belongs to the FreeCAD organization
Let's have a look at one of those repos: FreeCAD-library. It contains a lot of 3D models, contributed by people from all around the wold
Github can render different type of files, making it easier to find the information you are looking for. For example, if you move to this folder: soft-drink-can.stl you will the 3D model of a soft-drink can. You can also download the file very easily
What you are reading now, this session, is located in a wiki page of a Github Repo. Check the top of the page. You will see that you are in the wiki tab, but there are more tabs. If you want to see the folders, go to the Code tab
Wiki pages allow us to write the documentation of a project, very easily. The pages should be written using the Markdown format
A complete repo can be downloaded into your local machine in two ways:
-
Direct downloading: Going to the code tap and clicking on the green button that says: Clone or Download. Then click on Download ZIP. You will get a compress file with all the project. You only have to decompress it into your computer
-
Cloning a repo: The other way is called Clone. It is the method we will use in the next sessions for linking our local proyect with the one located in Github
Download the repo asociated to this documentation (2018-19-PNE). Unzip it into your computer and have a look at the contents of the folders
Congrats! You've downloaded your first project from Github!
-
Exercise 3: Search the github repositories for finding interesting projects related to biomedicine (use the keywords biomedicine, dna, drugs...)
-
Exercise 4: Have a look at this project
- Question 4-1: What's this project about?
- Question 4-2: How many contributors are there?
- Question 4-3: When was the last contribution done?
- Question 4-4: Which program language is used?
Each developer has its own github page in wich you can see the repos, activity and the organizations in which he/she is involved
This is my github page
- Exercise 4: Create your account in github. Then go to Aula Virtual and find the forum messaged with the subject: "Your account in Github". Response with your complete name and your github user
¡Welcome! ¡You are now ready to start using Github!
For developing in python we are going to use the PyCharm IDE (Community edition) It is already install in the Linux machines in the 106 Lab
Follow the instructions given by the teacher
-
Open the pycharm environment (Go to actividades and write pycharm. Select the Pycharm community edition (PC))
-
Create a new project: PNE_session-1
-
Example 1: Hello world (hello.py)
- Execute it serveral times
- Debug the hello world program step by step (Using the STEP OVER button)
-
Example 2: Print the numbers from 1 to 20. One number per line (print_numbers.py)
- Execute it
- Execute it step by step (Using the STEP OVER button)
-
Exercise 3: Write a python program, using pycharm, that perform the sum of the first 100 integer numbers (1+2+3...+100). Do it from the main program (sum.py)
-
Exercise 4: Create a function called sum(n), which calculates the sum of the n first integers and returns the result. The main program should ask the user for the numbers to sum, and print the result (sumN.py)
- Execute with different values of n
- Execute step by step
-
Learning about the STEP INTO: Execute step by step, but using the step INTO button
-
Execute it using a Breakpoint inside the sum function
-
Exercise 5: Write a program, called fibonacci.py, that calculates the nth term of the fibonacci series. You should implement the function fibonacci(n) and call it from the main program. The user should introduce the number of term to calculate
-
Exercise 6: Write a program (fibonacci_sum.py) for adding all the fibonacci terms from 1 to n. It should call the previous fibonacci function. Ask the user to input the n value
At the end of this session you should have the following python programs:
- hello.py
- print_numbers.py
- sum.py
- sumN.py
- fibonacci.py
- fibonacci_sum.py
Keep them. In the next session we will upload them into github
-
You should also know the following:
- How to create a new project with pycharm
- How to add new python files to a pycharm project
- How to execute python program from pycharm
- How to execute python programs step by step (debugging)
-
Juan González-Gómez (Obijuan)
- Alvaro del Castillo. He designed and created the original content of this subject. Thanks a lot :-)
S0: Introducction
S1: Tools I
S2: Tools II
S7: Client-Server-1
S8: Client-Server-2
S9: Client-server-3
S10: Client-server-4
S11: HTTP protocol-1
S12: HTTP protocol-2
S13: HTTP module
S14: HTTP module
S15: HTML forms
S16: HTML forms
S17: JSON and API REST
S18: JSON and API REST