Skip to main content

A Python Demo

Project description

PyQuick

This is a python app/lib generator that creates a 'empty' python app/lib. And the app/lib 100% uses docker as base for development, test and build. Of course, this project itself 100% on docker :D

Demo

Generate A New Empty Python App

pyquick-demo

Why PyQuick Created?

Python's Pain Points

  • Python is interpreted language. Using latest python version's feature may make your code not work in environments of old versions.
  • Install Python is boring. Linux distrubutions may have different python packages available. For e.g. installatin of python 3.7 on Centos 7 is not convenient. Though pyenv was invented for this but you still need to install pyenv firstly :).
  • Python package management slightly sucks. Yes, virtualenv and pipenv are great for isolation. However, some python packages may need conflict binaries, which is not handled by either virtualenv or pipenv.
  • Deployment is painful. Target system must have reuqired python version installed. This is not elegant for CI: Jenkins node has to have multiple python versions installed.

Docker Saves

  • Docker can provide nearly system-level isolation.
  • No need to install others apart from docker
  • Dev/Pod environments keeo consistent - prefect for CI/CD.

PyQuick Helps

Though this is a super tiny python program but =>

  • It gengerates a start-up python app/lib for you with Dockerfiles, SetUp Tools, Makefiles, Requirements and others ready.
  • The project it generated is 100% based on Docker.
  • You can immediately start VSCode to remotely code your project in container!
  • Your development environment all in code. Push it to any VCS then you will be able to restore it in a few minutes by one command.

Usage

Run As Docker

The docker image is pretty small - only 40+M. So it will not take much time for you to pull it.

# pull docker image

docker pull jingweizhu/pyquick

# generate a new python app in local path: ./myproj

docker run --rm -it -u $(id -u $USER):$(id -g $USER) \
    -v ${PWD}:/tmp/local jingweizhu/pyquick \
    app /tmp/local/myproj

####  OR  ###
# generate a new python lib in local path: ./myproj

docker run --rm -it -u $(id -u $USER):$(id -g $USER) \
    -v ${PWD}:/tmp/local jingweizhu/pyquick \
    lib /tmp/local/myproj

---- OR ----

Intall From PyPi And Run It

Note: python>=3.7 required

pip install pyquick

# generate a new python app in ./myproj

pyquick app ./myproj

####  OR  ###
# generate a new python lib in ./myproj

pyquick lib ./myproj

Try Generated Project

You must have:

  • docker: ">= 17.06"
  • docker-compose: ">= 1.26" installed

Assume in above you input project name as mypy

Make It

cd ./myproj
make

Then check your containers

docker ps -a

A container named mypy-devenv should be running.

Run It (app only)

cd ./myproj
make run
make run ARGS='-h'

Then check your containers

docker ps -a

A container named mypy-prod should be running.

Intall To Local

If have python environment in local machine, you can install it:

cd ./myproj
make install

Build A Python Package

cd ./myproj
make dist
ls dist/*

Use VSCode To Develop Generated Project

  1. Start VSCode, install Remote extention.
  2. Attach to your container : myproj-devenv in VSCode
  3. Open terminal. Your project folder attached to container already. Just run
    .vscode/install-vscode-extensions.sh
    
  4. Reload widdow. Then python extension and other cool extensions available.

And Even More ...

Format Codes Of Your Project

cd ./myproj
make autopep8

Distribute Your Project To PyPi

  1. Set up two envs:
TWINE_USERNAME=<your pypi username>
TWINE_PASSWORD=<your pypi password>
  1. Run
cd ./myproj
make dist-upload

Source code

Prerequisition

  • docker: ">= 17.06"
  • docker-compose: ">= 1.26"

Install From Code

make install

Run

make run
make run ARGS="-h"

Dist

make dist

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyquick-0.0.1a6.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

pyquick-0.0.1a6-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file pyquick-0.0.1a6.tar.gz.

File metadata

  • Download URL: pyquick-0.0.1a6.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for pyquick-0.0.1a6.tar.gz
Algorithm Hash digest
SHA256 184c730d087192213345f9f1dc43cfbb4c984ec6efb517cfa23f9d7646ea3696
MD5 4a5f3b47fe31641fa4ab87509bbb917e
BLAKE2b-256 e4ec2e61e4f1ed88993d00be68337908922b428cb14f9b6154a6c1817efd9c42

See more details on using hashes here.

File details

Details for the file pyquick-0.0.1a6-py3-none-any.whl.

File metadata

  • Download URL: pyquick-0.0.1a6-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for pyquick-0.0.1a6-py3-none-any.whl
Algorithm Hash digest
SHA256 c2b2133a38f9ff503ca6c6d79754dd0ebcf3c68d4b556538c118c5b2323a6891
MD5 58a6e0512cb8dd5caf5dfea5500bb541
BLAKE2b-256 ad7d39ae2a5a1a219a6bf05f0ee95054d4ee14662dc30597910d878fbb956a83

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page