Skip to content

Project Initial Setup

John Yoon edited this page Apr 22, 2023 · 4 revisions

Project Initial Setup

Environment Setup

  1. Open bash or zsh terminal
    • Use terminal (zsh) if you are using MacOS
    • Use terminal (bash) if you are using Linux
    • Use git bash (bash) if you are using Windows
  2. Use cd <path> to move to the desired directory where you want to set up the project
  3. Run git clone https://github.com/fedele7008/MNIST_DNN.git to clone the project into your local computer
  4. Use cd MNIST_DNN to move into the project directory
  5. Run source env_setup.sh to set up the development environment - you may use specific python version to setup using source env_setup.sh --python-version <python>. Otherwise, the script will automatically try to detect valid python (It may take 5 - 10 minutes to set up for the first time)

For example, if you use python 3.9 when running python3, run source env_setup.sh --python-version python3 to use python 3.9 for setup. For more information about env_setup.sh, try source env_setup --help

You should run source env_setup.sh every time you start working on the project

After environment setup

After you complete the source env_setup.sh, it will provide useful tools to work on our project.

These tools are only provided after running source env_setup.sh; you should run this script whenever you open a new shell terminal.

If you want to skip running the script, add the script into your shell profile depending on your environment (not recommended - this may confuse if you have multiple clones of this project)

The setup contents are saved in a folder named dev/ - this folder is included in the .gitignore list by default, it should not be uploaded to GitHub by any chance.

Useful tools

There are three virtual python environments:

publish-venv

You would probably never use publish-venv manually. It is used for upload.sh script to deploy the package production to PyPI.

mnist-dnn-venv

This virtual environment is used for mnist_dnn package.

  • If you would like to turn this environment on, use enter dnn or enter d
  • If you would like to turn this environment off, use enter off or enter o or enter
  • To move into the package location, use dnn You should turn on the environment before developing mnist_dnn package

mnist-api-venv

This virtual environment is used for mnist_dnn_api package.

  • If you would like to turn this environment on, use enter api or enter a
  • If you would like to turn this environment off, use enter off or enter o or enter
  • To move into the package location, use api You should turn on the environment before developing mnist_dnn_api package

Please use enter off or enter o or enter to turn off the environment rather than deactivating manually using deactivate - this may cause an error in further use of tools

If you installed a new library in pip, use update_package dnn or update_package api to update requirements.txt in the selected package.

If you want to move to your MNIST_DNN project root directory, use root.


Example

  1. Run cd <path-to-project-root>
  2. Run source env_setup.sh
  3. Run enter dnn
  4. Run python -m mnist_dnn to run __main__.py of mnist_dnn package