Skip to content

Commit

Permalink
New entry points and docs updates
Browse files Browse the repository at this point in the history
  • Loading branch information
anamileva committed Oct 27, 2023
1 parent 85e53ba commit 068c596
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 81 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include gridpath/project/operations/operational_types/opchar_param_requirements.csv
include db/db_schema.sql
40 changes: 12 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
# Welcome to GridPath

<p align="center" width="100%">
<img src="doc/graphics/gridpath_logo.png" width="20%"/>
<img src="https://github.com/blue-marble/gridpath/blob/main/doc/graphics/gridpath_logo.png?raw=true" width="20%"/>
</p>

![Approaches](doc/graphics/approaches.png)
![Approaches](https://github.com/blue-marble/gridpath/blob/main/doc/graphics/approaches.png?raw=true)


GridPath is a versatile power-system planning platform capable of a range of
Expand All @@ -24,28 +24,27 @@ GridPath's documentation is hosted on [Read the Docs](https://gridpath.readthedo
# Installation

## Python
GridPath is tested on Python 3.8, 3.9, and 3.10. We recommend using Python 3.9. Get
Python
[here](https://www.python.org/downloads/ "Python download").
GridPath is tested on Python 3.9, 3.10, and 3.11. Get one of those Python versions [here](https://www.python.org/downloads/ "Python download").

## GridPath Python environment
You should create a Python environment for your GridPath installation, e.g. via
`venv`, [a lightweight environment manager](https://docs.python.org/3/library/venv.html "venv")
that is part of the standard Python distribution. Make sure to [create](https://docs.python.org/3/library/venv.html#creating-virtual-environments "create") [activate](https://docs.python.org/3/library/venv.html#how-venvs-work "activate") the environment before installing GridPath.

## Install GridPath
## Install GridPath from PyPi

Once you have _created and activated_ the GridPath Python environment, you can install GridPath and the Python packages it uses.
Once you have _created and activated_ the GridPath Python environment, you
can install the latest version of GridPath from PyPi with:

For most users, installing GridPath's base set of Python packages and those needed
to use the graphical user interface would be sufficient. You can do so by navigating to the GridPath root
directory (which is where this `README.md` file is located) and running:
```bash
pip install .[ui]
pip install GridPath
```

You can install all needed Python
packages, including the developer extras by running:
## Install GridPath from source

You can alternatively download the GridPath source code and install from
source.

```bash
pip install .[all]
```
Expand All @@ -56,13 +55,6 @@ pip install .[all]
You will need a solver to use this platform. GridPath assumes you will be using Cbc (Coin-or branch and cut) by default, but you can specify a
different solver.

## Testing your installation

To test the GridPath codebase, [make sure the GridPath environment you installed to
is activated](https://docs.python.org/3/library/venv.html#how-venvs-work "activate") and use the unittest module as follows from the root directory:
```bash
python -m unittest discover tests
```

# Usage

Expand Down Expand Up @@ -90,11 +82,3 @@ solver, check the help menu, e.g.:
```bash
gridpath_run --help
```


## Help
In general, you can check usage of GridPath's scripts by calling the `--help`
option, e.g.:
```bash
python get_scenario_inputs.py --help
```
6 changes: 3 additions & 3 deletions db/create_database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2020 Blue Marble Analytics LLC.
# Copyright 2016-2023 Blue Marble Analytics LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,12 +13,12 @@
# limitations under the License.

"""
This script create an empty GridPath database with the appropriate table structure.
Create an empty GridPath database with the appropriate table structure.
The user may specify the name and location of the GridPath database path using the
*--database* flag.
>>> python create_database.py --database PATH/DO/DB
>>> gridpath_create_database --database PATH/DO/DB
The default schema for the GridPath SQLite database is in db_schema.sql.
Expand Down
16 changes: 8 additions & 8 deletions db/utilities/port_csvs_to_db.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Copyright 2016-2020 Blue Marble Analytics LLC. All rights reserved.
# Copyright 2016-2023 Blue Marble Analytics LLC. All rights reserved.

"""
The *port_csvs_to_db.py* script in the db directory ports the input data
provided through CSV files to the GridPath SQLite database. This script
assumes that the user has already created the database file and loaded
the GridPath schema using the *create_database.py* script.
The *gridpath_load_csvs* command ports the input data provided through CSV
files to the GridPath SQLite database. It assumes that the user has
already created the database file and loaded the GridPath schema using the
*gridpath_create_database* command.
The *port_csvs_to_db.py* script takes several arguments. For usage info, run:
The gridpath_load_csvs command takes several arguments. For usage info, run:
>>> python port_csvs_to_db.py --help
>>> gridpath_load_csvs --help
The user must specify the GridPath database path using the *--database* flag
and the path to the directory where the CSVs are located using the
*--csv_location* flag.
>>> python port_csvs_to_db.py --database PATH/DO/DB --csv_location PATH/TO/CSVS
>>> gridpath_load_csvs --database PATH/DO/DB --csv_location PATH/TO/CSVS
Running the command above will look for the *csv_structure.csv* file in
Expand Down
17 changes: 9 additions & 8 deletions db/utilities/scenario.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# Copyright 2016-2023 Blue Marble Analytics LLC. All rights reserved.

"""
The *scenario.py* script in the db directory contains functions for creating, updating,
and deleting a scenario. You can create a single or multiple scenarios from a CSV.
This script assumes that the user has already created the database file using the
*create_database.py* script and loaded input data for the scenario using the
*port_csvs_to_db.py* script.
You can use the *gridpath_load_scenarios* command to create, update, or delete
a scenario. You can create a single or multiple scenarios from a CSV.
This command assumes that the user has already created the database file
using the *gridpath_create_database* command and loaded input data for the
scenario using the *gridpath_load_csvs* command.
The *scenario.py* script takes several arguments. For usage info, run:
The *gridpath_load_scenarios* command takes several arguments. For usage info,
run:
>>> python scenario.py --help
>>> gridpath_load_scenarios --help
The user must specify the GridPath database path using the *--database* flag
and the path to the directory where the scenario CSV is located using the
*--csv_path* flag.
>>> python port_csvs_to_db.py --database PATH/DO/DB --csv_path PATH/TO/SCENARIO/CSV
>>> gridpath_load_scenarios --database PATH/DO/DB --csv_path PATH/TO/SCENARIO/CSV
To load a single scenario by name, use the *--scenario* flag. To delete a scenario from
the database, specify the scenario name with the *--scenario* flag and use the
Expand Down
55 changes: 23 additions & 32 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ Python

Running GridPath requires a Python 3 installation. GridPath is `tested nightly
<https://github.com/blue-marble/gridpath/actions/workflows/test_gridpath.yml>`__ in
Python 3.8, 3.9, and 3.10. We recommend using Python 3.9. You can get the official
CPython distribution (recommended) `here <https://www.python.org/downloads/>`__, the
Anaconda Python distribution `here <https://www.anaconda.com/distribution/>`__, or
`another Python distribution <https://wiki.python.org/moin/PythonDistributions>`_.

Python 3.9, 3.10, and 3.11. You can get Python `here <https://www.python.org/downloads/>`__.

.. _python-virtual-env-section-ref:

Expand Down Expand Up @@ -67,21 +63,6 @@ On Linux-based systems including MacOS, use::

source PATH/TO/PYTHON/ENV/bin/activate

^^^^^^^^
Anaconda
^^^^^^^^
Another way to set up a virtual environment is via the Anaconda Python
distribution. `You can obtain Anaconda here <https://www.anaconda
.com/distribution/>`_. Create the GridPath environment with::

conda env create --name gridpath

By default, environments are installed into the `envs` directory in your
conda directory. To activate the environment before running GridPath, enter
the following::

source activate gridpath


Solver
------
Expand All @@ -104,31 +85,40 @@ instructions for Windows `here <https://www.java.com/en/download/help/path
Installing GridPath
===================

Basic installation
------------------
Before installing, **make sure to activate your :ref:`GridPath virtual environment
<python-virtual-env-section-ref>`**.

Installation from PyPi
----------------------

You can download and install the latest version of GridPath from PyPi with::

pip install GridPath

To get a specific version, e.g., v0.16.0, use::

pip install GridPath==0.16.0

Note that GridPath versions before 0.16.0 are not available on PyPi.

Installation from Source
------------------------

GridPath's source code is stored in a GitHub repository. You can find the latest
GridPath release `here <https://github.com/blue-marble/gridpath/releases/latest>`__.
Download the source code zip file and extract it. We will refer to the directory
where the code is extracted to as the :code:`PATH/TO/GRIDPATH` directory.

Before installing, **make sure to activate your :ref:`GridPath virtual environment
<python-virtual-env-section-ref>`**.

Most users should install GridPath by navigating to the GridPath directory
:code:`PATH/TO/GRIDPATH` with :code:`cd PATH/TO/GRIDPATH` and
running::

pip install .


If you want to use the GUI, you should install additional required packages with::

pip install .[ui]


^^^^^^^^^^^^^^^^
Developer extras
----------------
^^^^^^^^^^^^^^^^

You may need to install additional packages if you plan to edit the GridPath code
and, for example, build the documentation from source, use the Black code formatter,
Expand All @@ -145,8 +135,9 @@ If you would like to edit the user-interface code, you will also need Node.js in
addition to Python and will be required to install various node packages.
See the User Interface section for more info.

^^^^^^^^^^^^^^^^^^^^^^^^^
Testing Your Installation
-------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^

To test the GridPath codebase, use the unittest module as follows from the
:code:`PATH/TO/GRIDPATH` directory::
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
"PyUtilib==6.0.0", # used for solver temp file management
"Jinja2==3.0.3", # bokeh dependency; see #904
"dill==0.3.7", # pickling
],
]
+ extras_ui,
extras_require={
"doc": extras_doc,
"ui": extras_ui,
"all": extras_all,
"coverage": extras_coverage,
"gurobi": extras_gurobi,
Expand All @@ -74,6 +74,9 @@
"gridpath_validate = gridpath.validate_inputs:main",
"gridpath_run_server = ui.server.run_server:main",
"gridpath_run_queue_manager = ui.server.run_queue_manager:main",
"gridpath_create_database = db.create_database:main",
"gridpath_load_csvs = db.utilities.port_csvs_to_db:main",
"gridpath_load_scenarios = db.utilities.scenario:main",
]
},
)

0 comments on commit 068c596

Please sign in to comment.