Skip to content

jonathanvanleeuwen/project_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This is a code repo template for code using a command line interface

Description

The code does not have functional use. However, the template covers:

  1. Code directory layout
  2. Command line interface using "Argh"
  3. Progressbar / Parallel processing using progressbar, "tqdm"
  4. Testing using "pytest"
  5. Requirements file
  6. Documentation

Starting with this template should make an initial code repo setup faster and easier.

Install code

This guide assumes you are using windows, the instructions should be similar for other operating systems. Its assumed that you are using vscode and have python installed.

  1. Download/clone the code (where this readme is located)
  2. Open vscode and from within vscode open the main folder with the code
  3. Open a new terminal
    1. Press: Ctrl+Shift+P and type "terminal"
    2. Select: Python: create terminal
  4. In the new terminal create a new environment and activate it
    1. 'python -m venv .venv'
    2. If prompted, click yes to use the new virtual environment
    3. If not prompted, click the python/environment button i the bottom left of the blue ribbon and select the new environment
    4. Ensure that the correct environment is activated, you should see the following in the terminal
      1. ([env_name]) folderpath]>
      2. (.venv) C:\Users\testuser>
  5. Install the requirements file.
  • Ensure that you are in the correct directory and using the "[env_name]" environment
  • Run: pip install -r requirements.txt
  1. Done! you can now move on to the next section on how to use the code

How to use the code

  • Pre-requisites
    1. Ensure that you have followed all the steps to Install code
    2. Ensure that you have activated the correct virtual environment.
    3. Ensure that the dependencies in requirements.txt are installed.
    4. Ensure that you have navigated to the directory containing this code.

How to run code

Use the command line

  1. Get help
    • python main.py -h
  2. Get version information
    • python main.py version
    • python main.py version -h
  3. Run the main entry point
    • python main.py entry 5
    • python main.py entry 5 --y 10
    • python main.py entry -h

How to run tests

Use the command line

  1. Run all tests
    • pytest
  2. Run all tests in specific folder
    • pytest tests/unit
  3. Run all tests in specific test file
    • pytest tests/unit/src/test_myprojectcode.py
  4. Run single specific test in file
    • pytest tests/unit/src/test_myprojectcode.py::test_is_even

Folder structure

Describe the folder structure and file content

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages