Initialization of a new Project

Introduction

This tutorial documents my workflow for creating a new project from scratch, and creates a documented, version-controlled, pip-intsallable module with an automated build, test, and deploy pipeline.

Setting up Github Repository and Development Pipeline

  1. Initialize and setup a new github repository

    • Add .gitignore, .environment.yml, LICENSE.txt, MANIFEST.in, README.md, .coveragerc, and setup.py files to main directory (can copy these from other directory)

    • Modify the module names / paths for each of these files: README.md, setup.py

    • Create a new github repository

    • Add the github repository remote with: git remote add origin main followed by git remote origin set-url <URL>.

    • Modify conf.py and setup.py to contain your project-specific information

    • Create subdirectory with your module name, and directories inside that called ‘docs’, ‘source’, and ‘test’.

    • Copy all docs files from a previous project

  2. Setup test suite, codebase - Copy context.py files from the source, test, and main directories - Copy fullRunner.py, single test file from test directory - Copy shorthandTest.py file from test directory - Create basic test and try to run fullRunner.py using coverage: coverage run fullRunner.py

  3. Upload repository to test pyPi and pyPi

    • Attempt to build install files: python setup.py sdist bdist_wheel

    • run twine upload --repository testpypi dist/*, put in your username / password

    • Create a new authentication key on test PyPi for the project you just uploaded

    • Create a github secret pypi_test_password in your new repository

    • run twine upload --repository pypi dist/*, put in your username / password

    • Create a new authentication key on test PyPi for the project you just uploaded

    • Create a github secret pypi_test_password in your new repository

  4. Setup documentation - Configure github pages source in the “Settings” section of the repository to be the “/docs” folder.

  5. Setup github actions

    • Create .github/workflows/ directory in root directory

    • Move .yml file from previous project into that directory

    • Change .yml file references to your module name

    • Attempt to lint main directory by running flake8

    • Push to github and check that all actions run

  6. Setup stickers

    • Go to coveralls and add your repository

    • Change the markdown file for your github build to whatever the name of your repository is