Skip to content

sylhare/Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python projects

Build Status

Introduction

Some miscellaneous Python projects that I created or worked on. Mainly tests on some functionality or example that I can reuse for other works as tutorials.

Installing Python

There are currently two versions of python currently in use, I would suggest going with the latest Python 3 (3.x.x) because it is the future but there's no wrong choice here and you can switch from one to the other easily.

The Anaconda distribution is the easiest way to get you started with python, it comes with built in package, IDE and a lot of great stuffs.

You can also do it the classic way, by downloading python directly from there website here and then start coding on a text editor.

Python should have already been installed if you're using a linux distribution. You can always check which version is installed:

python --version

Python on Windows

Assuming that you've installed python via Anaconda, or manually (setting the environment path as well).

Start a python prompt on the command prompt:

python

Install dependencies via pip on a command prompt:

python -m pip install <package>

Uninstall with pip through:

python -m pip uninstall <package>

Install dependencies through a proxy

python -m pip install --proxy http://user:password@proxyserver:port <package>
  • Replace Package by the package you want to install
  • the -m means module
  • user and password are the ones you use to connect to your session (most probably)
  • The proxy server and port are in
    • Control Panel > Internet Options > Connections > Lan Settings button

Run a python script on a command prompt (windows):

python.exe script.py arg1

Creating Python packages

A Python package is simply an organized collection of python modules. A python module is simply a single python file.

To create a python package, create a directory and then add a __init__.py file. Creating a package with __init__.py is all about making it easier to develop large Python projects. It provides an easy way for you to group large folders of many separate python scripts into a single importable module.

PyPI is the Python Package Index a repository of software for the Python programming language. You can find a seed template at sylhare/python-seed

Read more about Publish a pyhton package

Create a webserver in Python

You can simply create a webserver at localhost:8000 in python thanks to this module:

  • Python 2
python –m SimpleHTTPServer 9000 # You can change the port
  • Python 3
python -m http.server 8000 

Sources