Python-Packaging-Taco-Niet-BuildCLEWsModel 0
This package creates MoManI Models through Command Line Interface
Requires Python: >=3.6

This package creates MoManI models through Command Line Interface (CLI).

Follow the steps below to create any MoMonI model.

Note: This folder contains multiple files/folders. Depending on the type of model, ‘data’ folder would contain different Excel files.



Step 1: (Create a virtual environment and run all codes in there)
    * Open Command Prompt (Windows) or Terminal (Mac)
    * Go to the directory where this project is cloned/downloaded into
    * Create a virtual environment:
        * Mac: python3 -m venv tutorial-env
        * Windows: python -m venv tutorial-env
    * Activate the virtual environment
        * Mac: source tutorial-env/bin/activate
        * Windows: tutorial-env\Scripts\activate.bat
    * Install the following packages:
        * pip install pyyaml
        * pip  install pymongo
        * pip install colorama


Step 2: (Create new model on MoManI website)
    * Make sure the name you have selected for the MoManI model matches the ‘Model’ value in the yaml file
        * example: In the yaml file, if the first line is —> Model: Model_Name, make sure name of the MoManI model is also ‘Model_Name’
    * Select ‘Create new model’
    * Choose the right Name and add Description
    * Select the following boxes:
        * OFS_Cost
        * Common_Equations 
        * Short_Code_Equations
        * Then Save
    * Now you have an empty model that will be filled with data after running the code on CLI
    * Type the following in CLI to build the model:
        * python BuildCLEWsModel.py test.yaml
        * select y --> then enter 



Note: Steps 3-7  include instructions of creating the python package, uploading  the package on Python Package Index and installing it with pip.

Step 3: (Categorize functions and have them in separate python files )
    * It is always necessary to have a python file named ‘__initi__.py’ in the directory where you want to create a project locally —> can be an empty file
    * In this project, the python file that builds MoManI model is called ‘BuildCLEWsModel.py’ —> make sure to import all functions at the beginning of the file 
        * example: from function.Fill_Empty_Sets import Fill_Set as Fill_Set


Step 4: (setup.py)
    * This file contains key information about the python project ==> change name, email, etc, accordingly 


Step 5: (Creating LICENCE.txt)
    * visit "https://choosealicense.com" and choose the appropriate open source licence that matches your project


Step 6: (Create distribution packages that can be uploaded to Python Package Index)
Note: For Windows users, type ‘Python’ instead of ‘Python 3’
    * Type the following in CLI
        * python3 -m pip install --user --upgrade setuptools wheel 
        * python3 setup.py sdist bdist_wheel


Step 7: (Uploading your project on test.pypi.org)
Note: For Windows users, type ‘Python’ instead of ‘Python 3’
    * Type the following on CLI
        * python3 -m pip install --user --upgrade twine
        * python3 -m twine upload --repository testpypi dist/*
    * Then test.pypi will give you instructions on how to run the package with pip
        * Open a different folder (preferably different from the main folder used in steps 1-2)
        * Create a virtual environment —> step 1
        * install the package:
            * python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps example-pkg-YOUR-USERNAME-HERE
    * Test that it was installed correctly by importing the package
        * example: import example_pkg

For more information, visit:
https://packaging.python.org/tutorials/packaging-projects/#packaging-python-projects