This repository contains code examples of projects written using Python and other related technologies: Django, HTML, CSS, SQLite, PostgreSQL, Redis, Celery, Git, etc. Here is just a brief description of each project. For more information, go to the appropriate folder.
Sections: Apps, Bots, Utils, Tests.
-
/socialblog
— Test task for creating a blog platform with social media capabilities. The version is implemented using Python and Django. -
/smarthome
— An example of the interaction between Smart Home systems that supports real-time state configuration. The application is written in Python. The following tools are used: Django, SQLite, Celery, Redis. -
/somemart
— Realization of a simple API for an online store: add a product, add a review to the product, get a product description and all reviews for it. All actions are performed via GET or POST requests using JSON. Unauthorized users can get a product description or add a review to the product. Admin's rights allow to add new products. User authentication is performed via HTTP Basic Auth. Data validation is performed usingdjango.forms
,jsonschema
andmarshmallow
. The project is made using Django. For testing usedpytest
. -
/herokuapp
— Step-by-step guide to creating a simple web application that shows the number of page views in Python and Django using Redis. It also shows how to roll out the application to Heroku hosting using Git. -
/gameoflife
— Console utility for demonstrating the famous "Conway's Game of Life". The implementation is made using the Python language and OOP principles. -
/asyncsocket
— A system for collecting and storing metrics based on a client-server architecture. Examples of such systems are Graphite and InfluxDB. The clients and server communicate with each other over a simple text protocol via TCP-sockets. To implement an asynchronous server, the following popular Python-library is used: asyncio. To implement clients, the other popular library is used: socket.
Bots are written in Python, can be run locally and prepared for rolling out to Heroku-hosting. Data is stored using PostgreSQL or locally (in-memory and files).
-
/geotelebot
— Prototype of a working Telegram Bot. Helps the user to save and view interesting places (name, address, geo-position and photo). When sending a location, it shows which of these places are within a 500-meter radius. -
/facevoicebot
— The bot has two features. One of them is to detect faces in a photos and save only photo with faces (using OpenCV). The second feature is getting voice messages, process the frame rate to 16 kHz (256 kbps) and saving it in this form for later use (using PyDub).
This section contains single-file utilities that perform simple actions. They can be modified and they will be useful in development.
-
/cipher
— Implementation of the Caesar cipher and its two variations Rot13 and Vigenere. The performance of each of the ciphers is checked by using unit testing. -
/kvstore
— Simple key-value storage. Saves data in JSON-format to a file with the following command$ python keyvaluestorage.py --key KEY --val VAL
. When writing, the new value is added to the previous one. For reading value, you only need to specify the key as a parameterpython keyvaluestorage.py --key KEY
.
This section is dedicated to code testing, approaches to testing, examples, etc.
-
/utestapproaches
— Using the implementation of sorting algorithm are considered different unit testing approaches: doctest, contracts, self-writing tests, unittest, pytest. -
/primefactor
— TDD on the example of implementation prime factor algorithm. -
/evenfibonacci
— Function returns even elements of Fibonacci sequence. Covered by contract tests, doctests, unit tests.
Note. If the project contains a projectname-git.zip
-archive (the full contents of the project and .git
-folder), you can download and unzip it. As a result you will get the files and commit history of this project.