pythonpackagetemplate

Test python package with documentation and CI


License
MIT
Install
pip install pythonpackagetemplate==0.1.5

Documentation

my_python_package

cheatsheet and template for a python package

the result is a python package that can be installed using pip install mypackage and conda install mypackage and has proper documentation and testing. For testing we use Travis CI and for the documentation we use readthedocs.

Pre-Requisites:

  1. Git and Github
  2. Python
  3. Basic command line

Python Package

follow this and this guide. Do not use sdist to upload your script. Use Twine for a secure way. Summary below:

Pypi

  1. Install requirements
    pip install wheel
    pip install twine

  2. Create an account on the PyPi website (verify email): https://pypi.org/account/register/

install-requires-vs-requirements

  1. Fork and clone this repository to your (virtual) machine.
  2. Rename folders to a newname that is unique to pypi and conda cloud.
  3. cd to repo (folder with setup.py)
  4. cp -r pypi_template pypi_template_built
  5. cp -r conda_template conda_template_built
  6. cd pypi_template_built/
  7. Create Source Distribution python setup.py sdist
  8. Create the wheel
    python setup.py bdist_wheel --universal
  9. Upload built package to pypi twine upload dist/*

Conda

follow this guide. Summary below:

  1. Install anaconda or miniconda

  2. Install anaconda-client conda install anaconda-client

  3. Register at anaconda cloud

  4. Login
    anaconda login

  5. cd to conda_template

  6. Create conda skeleton (meta.yaml) conda skeleton pypi pythonpackagetemplate

  7. Build package conda-build pythonpackagetemplate

anaconda upload /opt/anaconda3/conda-bld/linux-64/pythonpackagetemplate-0.1.5-py36_0.tar.bz2

To have conda build upload to anaconda.org automatically, use

$ conda config --set anaconda_upload yes

  1. Convert to other platforms
    conda convert --platform all /opt/anaconda3/conda-bld/linux-64/pythonpackagetemplate-0.1.5-py36_0.tar.bz2 -o outputdir/

Documentation

Testing