Contents
elementary_math
is a project to demonstrate: how to setup environment and toolsets for a python library project on github, includes these powerful components:
- virtual environment setup (one command install everything)
- setup.py file (one click install/uninstall)
- auto Google stylize your code
- fancy sphinx document (one click build/view/deploy)
- unittest suits with pytest
- code coverage test with coverall
- multi python version test with tox
- integration with https://travis-ci.org/
- integration with https://codecov.io/
- auto deploy to AWS S3
- publish to PyPI
- GitHub Homepage
- Online Documentation
- PyPI download
- Install
- Issue submit and feature request
- API reference and source code
- Clone the repo.
- Navigate to
elementary_math-project/start-a-project
, editinit_project.py
and run it. - A
<repo-name>
directory will be created, you can use this as your github repo directory. - Take a look at
Makefile
, all magic happens here!
Use AWS S3 to host your doc site is a good idea!
We need awscli to automate the deployment.
- Install awscli, just
pip install awscli
. - Configure your API token, just
aws configure
and follow the instruction.
If you want to publish your package to PyPI or new PyPI, you need a pypi account and Configure your credential.
Create a
${HOME}/.pypirc
file.put these contents:
[distutils] index-servers = pypi [pypi] username:<username> password:<password>
- Test with travis-ci, basically you just need to:
- sign in using GitHub account.
- toggle on your repo.
- Code Coverage Test with codecov.
Because Windows doesn't have shell script
and make
command, so we have to install some third-party software to make it works.
Install Git Bash as shell emulator
- Download and install git.
- Now you can use
C:\Program Files\Git\git-bash.exe
like the terminal in MacOS/Linux.
Install MinGW
- Download and install, use the installer to install
MinGW Base
. - Find
C:\MinGW\bin\mingw32-make.exe
, copy and paste and rename asC:\MinGW\bin\make.exe
. - Add
C:\MinGW\bin
to $PATH (environment variable).
Now you can use make <target>
in git-bash.exe
now.
You have to make sure:
- HomeBrew is installed.
There's two way of using virtualenv in MacOS:
- Use generic virtualenv.
- Use pyenv + pyenv-virtualenv.
I prefer pyenv
+ pyenv-virtualenv
, because it allows you:
- use tox to test against multiple python version locally before using cloud CI (continues integration).
- will not mess up your global python environment.
- the
Makefile
will do thepyenv
+pyenv-virtualenv
setup for you, just make sure that you have HomeBrew installed.
elementary_math
is released on PyPI, so all you need is:
$ pip install elementary_math
To upgrade to latest version:
$ pip install --upgrade elementary_math