π Platform-Specific Setup Scripts¶
-
π¦ Ready-to-Use Scripts for All Platforms: We have prepared setup scripts for Linux, MacOS, and Windows platforms to ensure that the virtual environment is set up consistently across all platforms. These scripts will save you time and effort in setting up your project.
-
π¦ Package Installation: To simplify package installation and maintainence, we use pipenv instead of pip. For more details, please refer to the Pipenv documentation.
-
π Proxy Support: If you work behind a proxy, you may need to configure your proxy url in the
.env
file that gets generated once you run the setup scripts and pass the relevant argument to the setup script to enable pacakge installation. For more details, check out our documentation on working with .env -
ποΈ Readme Cleanup: Utilize relevant argument in the setup script to automatically clear the content of template Readme.MD file. More detailed instructions on usage below.
-
π‘ Virtual Environment: Upon successful execution of the setup script, your terminal will automatically activate a virtual environment named
.venv
.
Setup script usage¶
For Linux/MacOS¶
source project_setup.sh [OPTIONS]
For Windows OS¶
project_setup.bat [OPTIONS]
Replace [OPTIONS] with any combination of the following supported arguments:
-
--install
: Required argument. If nothing is passed, a help message is displayed by default. -
--install-dev
: Use this flag along with--install
flag to install development packages. -
--use-proxy
: Use this flag to enable installation of python packages behind proxy. -
--unset-proxy
: Use this flag to disable proxy. -
--clear-readme
: Use this flag to clear the contents ofREADME.md
file after setting up the project.- π£ Caution: This should be used only once when you are setting up the project for the first time.
-
--remove-cache
: Use this flag to removepip
andpipenv
cache files.- π‘ Use this to clear cache files generated during package installation
-
--help
: Use this flag to display the help message.
Detailed steps¶
For setting up the project on these platforms, project_setup.sh
script has been provided along with some options. Check Setup script usage section for details.
π§βπ» Steps for Linux/MacOS:¶
-
Open terminal and navigate to your project directory.
-
If you are setting up the project inside development environment, use:
source project_setup.sh --install --install-dev
-
Incase you are working behind a proxy, use the following command instead:
source project_setup.sh --install --install-dev --use-proxy
-
-
If you are setting up the project first time using this template, then you should replace contents of the README.md with the name of your project:
source project_setup.sh --clear-readme
β οΈ *** Use this command only once in the development environment. DO NOT run this once you write your own readme. ***
-
If you are setting up the project inside production environment, you may only require base packages, use:
source project_setup.sh --install
-
Incase you are working behind a proxy, use the following command instead:
source project_setup.sh --install --use-proxy
-
Important Note
-
β½ If want to install any other package inside this newly created virtual environment, please use the following command:
pipenv install package_name
-
β If you have configured proxy details in the
.env
file but later on you are not working behind proxy, you'd get package installation error as by default,pipenv
loads all the.env
variables, therefore you need to unset the proxy first.Use the following command:
source project_setup.sh --unset-proxy
You should then be able to install packages using pipenv as stated above.
-
β»οΈ During package installation, the packages are downloaded and cached. This consumes a lot of disk, hence you should clear pip and pipenv cache from time to time.
Use the following command:
This would remove all the cached files during package installation.source project_setup.sh --remove-cache
-
β To ensure a conflict-free environment setup, it is strongly recommended to always run the
project_setup.sh
script to create a virtual environment for your project. -
βYou should run the script ONLY using the
source
command to ensure that the virtual environment.venv
is automatically activated at the end of setup in the current shell session. -
β Ideally, you should see a
.venv
virtual environment already activated in the terminal. However, if it's not activated, please follow these steps to activate it before installing any package using pipenv:-
Open terminal.
-
Navigate to the project directory.
-
Activate the virtual environment by running the following command:
source .venv/bin/activate
. This command will activate the virtual environment and change your prompt to indicate that you're now working within it. -
You can now proceed with installing packages using
pipenv
-
-
For setting up the project on Windows, project_setup.bat
script has been provided along with some options.
π§βπ» Steps for Windows:¶
-
Open Command Prompt (CMD) and navigate to your project directory.
-
If you are setting up the project inside development environment, use:
project_setup.bat --install --install-dev
-
Incase you are working behind a proxy, use the following command instead:
project_setup.bat --install --install-dev --use-proxy
-
-
If you are setting up the project first time using this template, then you should replace contents of the README.md with the name of your project:
project_setup.bat --clear-readme
β οΈ Use this command only once in the development environment. DO NOT run this once you write your own readme.
-
If you are setting up the project inside production environment, you may only require base packages to be installaed, use:
project_setup.bat --install
-
Incase you are working behind a proxy, use the following command instead:
project_setup.bat --install --use-proxy
-
Important Note
-
β½ If want to install any other package inside this newly created virtual environment, please use the following command:
pipenv install package_name
-
β If you have configured proxy details in the
.env
file but later on you are not working behind proxy, you'd get package installation error as by default,pipenv
loads all the.env
variables, therefore you need to unset the proxy first.Use the following command:
project_setup.bat --unset-proxy
You should then be able to install packages using pipenv as stated above.
-
β»οΈ During package installation, the packages are downloaded and cached. This consumes a lot of disk, hence you should clear pip and pipenv cache from time to time.
Use the following command:
This would remove all the cached files during package installation.project_setup.bat --remove-cache
-
β To ensure a conflict-free environment setup, it is strongly recommended to always run the
project_setup.bat
script to create a virtual environment for your project. -
βFor security reasons, organizations may prevent running .bat scripts on PowerShell. You should run the script ONLY on Command Prompt (CMD) to ensure that everything runs without any errors.
-
β Ideally, you should see a
.venv
virtual environment already activated in the Command Prompt (CMD). However, if it's not activated, please follow these steps to activate it before installing any package usingpipenv
:- Open the Command Prompt (CMD).
- Navigate to the project directory.
-
Activate the virtual environment by running the following command:
.venv\Scripts\Activate
. This command will activate the virtual environment and change your prompt to indicate that you're now working within it. -
You can now proceed with installing packages using
pipenv
-
π₯ Demo¶
-
π This demo assumes that you've cloned the project which you created using the Python Machine Learning Template on your machine. For the purposes of this demonstration, we'll refer to this project as
Demo Project
. -
π The video tutorial will guide you through the necessary steps for setting up your project.