Minimize thinking when setting up your new python project. This (minimal) template project and the following set of instructions will allow you to get
- Standard python packaging structure
- Make a git-clone of your package pip installable
- Test your package automatically with pytest on Travis-ci
- Build and publish the documentation on github.io
Create your (empty) project on github: https://github.com/username_or_organization/new_project
Activate Travis-ci for your project. Follow this step of the tutorial.
To allow the auto-deployment of the documentation to github pages
- On github, in your repo settings, in the GitHub Pages section, set the
gh-pages branch
as the source - On github, in your account setting, in the developer settings, generate a
new personal access token (e.g., note
Travis-sphinx
, scoperepo
) - On Travis, in your repo settings, set a variable called
GH_TOKEN
with value equal to the token you just created
- On github, in your repo settings, in the GitHub Pages section, set the
On your local machine, clone this template and push it to your new repo
git clone --bare https://github.com/dpole/python-template.git cd python-template git reset $(git commit-tree HEAD^{tree} -m "Template") git push --mirror https://github.com/username_or_organization/new_project cd .. rm -rf python-template
Edit your package
- Edit this README. Remember to replace
dpole
withusername_or_organization
andpython-template
withnew_project
in the urls of the badges (see theimage
at the top of the file). - Rename the
package_name
folder with the name of your package, edit and/or rename the files in it (don't forget__init__.py
).
- Edit the
setup.py
file. Don't forget to add the dependencies of your package in theisntall_requires
list. - Edit every file in the
docs/source
folder and subfolders. - After the first minimal commit run
git reset $(git commit-tree HEAD^{tree} -m "First commit")
, which will erase the history of the tempalte'smaster
branch from the one of your repository - Write doctrings using the numpy sphinx syntax
- Edit this README. Remember to replace