Installing H2Integrate#

Install H2Integrate via PyPI#

If you just want to use H2Integrate and aren't developing new models, you can install it from PyPI using pip:

pip install h2integrate

Installing from Source#

If you want to develop new models or contribute to H2Integrate, you can install it from source.

NREL Resource Data#

  1. The functions which download resource data require an NREL API key. Obtain a key from:

    https://developer.nrel.gov/signup/

  2. To set up the NREL_API_KEY and NREL_API_EMAIL required for resource downloads, you can create Environment Variables called NREL_API_KEY and NREL_API_EMAIL. Otherwise, you can keep the key in a new file called ".env" in the root directory of this project.

    Create a file ".env" that contains the single line:

    NREL_API_KEY=key
    NREL_API_EMAIL=your.name@email.com
    

Manual steps#

  1. Using Git, navigate to a local target directory and clone repository:

    git clone https://github.com/NREL/H2Integrate.git
    
  2. Navigate to H2Integrate

    cd H2Integrate
    
  3. Create a new virtual environment and change to it. Using Conda Python 3.11 (choose your favorite supported version) and naming it 'h2integrate' (choose your desired name):

    conda create --name h2integrate python=3.11 -y
    conda activate h2integrate
    
  4. Install H2Integrate and its dependencies:

    conda install -y -c conda-forge glpk
    

    Note

    Unix users should install Cbc via:

    conda install -y -c conda-forge coin-or-cbc=2.10.8
    

    Windows users should install Cbc manually according to coin-or/Cbc.

    • If you want to just use H2Integrate:

      pip install .
      
    • If you want to work with the examples:

      pip install ".[examples]"
      
    • If you also want development dependencies for running tests and building docs:

      pip install -e ".[develop]"
      
    • In one step, all dependencies can be installed as:

      pip install -e ".[all]"
      

Developer Notes#

Developers should add install using pip install -e ".[all]" to ensure documentation testing, and linting can be done without any additional installation steps.

Please be sure to also install the pre-commit hooks if contributing code back to the main repository via the following. This enables a series of automated formatting and code linting (style and correctness checking) to ensure the code is stylistically consistent.

pre-commit install

If a check (or multiple) fails (commit is blocked), and reformatting was done, then restage (git add) your files and commit them again to see if all issues were resolved without user intervention. If changes are required follow the suggested fix, or resolve the stated issue(s). Restaging and committing may take multiple attempts steps if errors are unaddressed or insufficiently addressed. Please see pre-commit, ruff, or isort for more information.