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
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
- Start VSCode, install Remote extention.
- Attach to your container : myproj-devenv in VSCode
- Open terminal. Your project folder attached to container already. Just run
.vscode/install-vscode-extensions.sh
- 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
- Set up two envs:
TWINE_USERNAME=<your pypi username>
TWINE_PASSWORD=<your pypi password>
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pyquick-0.0.1a6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2b2133a38f9ff503ca6c6d79754dd0ebcf3c68d4b556538c118c5b2323a6891 |
|
MD5 | 58a6e0512cb8dd5caf5dfea5500bb541 |
|
BLAKE2b-256 | ad7d39ae2a5a1a219a6bf05f0ee95054d4ee14662dc30597910d878fbb956a83 |