Skip to content

Commit

Permalink
Update docs on installation, widget; update Readme and Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
bonicim committed Mar 1, 2024
1 parent bafb065 commit 1950c38
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 94 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test-ci-github: lint-deps lint pre-commit ci-github-deps test-deps test-ci

.PHONY: publish-deps
publish-deps:
@$(PYTHON3) -m pip install -e .'[packaging]' --use-pep517
@$(PYTHON3) -m pip install -e .[packaging] --use-pep517

.PHONY: build-dist
build-dist: publish-deps clean
Expand All @@ -75,21 +75,21 @@ publish-to-pypi: publish-deps build-dist

.PHONY: version-deps
version-deps:
@$(PYTHON3) -m pip install .'[releases]' --use-pep517
@$(PYTHON3) -m pip install .[releases] --use-pep517


### Documentation

.PHONY: docs-deps
docs-deps:
@$(PYTHON3) -m pip install .'[documentation]' --use-pep517
@$(PYTHON3) -m pip install .[documentation] --use-pep517


## Tutorials

.PHONY: tutorial-deps
tutorial-deps:
@$(PYTHON3) -m pip install .'[tutorials]' .'[widget]' --use-pep517
@$(PYTHON3) -m pip install .[tutorials] .[widget] --use-pep517

.PHONY: tutorials
tutorials:
Expand All @@ -116,16 +116,16 @@ ci-github-deps:

.PHONY: lint-deps
lint-deps:
@$(PYTHON3) -m pip install .'[lint]' --use-pep517
@$(PYTHON3) -m pip install .[lint] --use-pep517

.PHONY: format-deps
format-deps:
@$(PYTHON3) -m pip install .'[format]' --use-pep517
@$(PYTHON3) -m pip install .[format] --use-pep517

.PHONY: test-deps
test-deps:
@$(PYTHON3) -m pip install .'[testing]' --use-pep517
@$(PYTHON3) -m pip install .[testing] --use-pep517

.PHONY: all-deps
all-deps:
@$(PYTHON3) -m pip install .'[all]' --use-pep517
@$(PYTHON3) -m pip install .[all] --use-pep517
45 changes: 18 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ conda activate venv-hnx


```shell
virtualenv env-hnx
source env-hnx/bin/activate
virtualenv venv-hnx
source venv-hnx/bin/activate
```


Expand Down Expand Up @@ -190,19 +190,11 @@ Ensure that you have [git](https://git-scm.com/book/en/v2/Getting-Started-Instal
```shell
git clone https://github.com/pnnl/HyperNetX.git
cd HyperNetX
make venv
source venv-hnx/bin/activate
pip install .
```

Post-Installation Actions
=========================

Running Tests
-------------

```shell
python -m pytest
```

Development
===========

Expand All @@ -213,10 +205,13 @@ Install an editable version
pip install -e .
```

Install an editable version with access to jupyter notebooks
------------------------------------------------------------
Install an editable version with supported applications
-------------------------------------------------------

```shell
pip install -e .['all']

# for zsh users
pip install -e .'[all]'
```

Expand All @@ -226,7 +221,7 @@ Install support for testing
> ℹ️ **NOTE:** This project has a pytest configuration file named 'pytest.ini'. By default, pytest will use those configuration settings to run tests.
```shell
pip install .'[testing]'
make test-deps

# run tests
python -m pytest
Expand All @@ -243,20 +238,14 @@ Install support for tutorials
-----------------------------

``` shell
pip install .'[tutorials]'
make tutorial-deps

# open Jupyter notebooks in a browser
make tutorials
```

Install support for documentation
---------------------------------

```shell
pip install .'[documentation]'
cd docs

## This will generate the documentation in /docs/build/
## Open them in your browser with docs/build/html/index.html
make html
```


Code Quality
Expand All @@ -269,7 +258,7 @@ HyperNetX uses a number of tools to maintain code quality:
Before using these tools, ensure that you install Pylint in your environment:

```shell
pip install .'[lint]'
make lint-deps
```


Expand Down Expand Up @@ -299,6 +288,7 @@ For more information on configuration, see https://pylint.pycqa.org/en/latest/us


```shell
make format-deps
black hypernetx
```

Expand All @@ -309,19 +299,20 @@ Build and view documentation locally
---------------------------

```
make docs-deps
cd docs
make html
open docs/build/html/index.html
```

Editing documentation
----------------------
NOTE: make sure you install the required dependencies using: `make docs-deps`

When editing documentation, you can auto-rebuild the documentation locally so that you can view your document changes
live on the browser without having to rebuild every time you have a change.

```
make docs-deps
cd docs
make livehtml
```
Expand Down
8 changes: 0 additions & 8 deletions docs/source/classes/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ classes package
Submodules
----------

classes.entity module
---------------------

.. automodule:: classes.entity
:members:
:undoc-members:
:show-inheritance:

classes.entityset module
------------------------

Expand Down
69 changes: 28 additions & 41 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ Create a virtual environment
Using Anaconda
*************************

>>> conda create -n env-hnx python=3.8 -y
>>> conda activate env-hnx
>>> conda create -n venv-hnx python=3.8 -y
>>> conda activate venv-hnx

Using venv
*************************

>>> python -m venv venv-hnx
>>> source env-hnx/bin/activate
>>> source venv-hnx/bin/activate


Using virtualenv
*************************

>>> virtualenv env-hnx
>>> source env-hnx/bin/activate
>>> virtualenv venv-hnx
>>> source venv-hnx/bin/activate


For Windows Users
Expand All @@ -66,6 +66,15 @@ Installing from PyPi

>>> pip install hypernetx

If you want to use supported applications built upon HyperNetX (e.g. ``hypernetx.algorithms.hypergraph_modularity`` or
``hypernetx.algorithms.contagion``), you can install HyperNetX with those supported applications by using
the following command:

>>> pip install hypernetx[all]

If you are using zsh as your shell, use single quotation marks around the square brackets:

>>> pip install hypernetx'[all]'

Installing from Source
*************************
Expand All @@ -74,43 +83,14 @@ Ensure that you have ``git`` installed.

>>> git clone https://github.com/pnnl/HyperNetX.git
>>> cd HyperNetX
>>> pip install -e .['all']

If you are using zsh as your shell, ensure that the single quotation marks are placed outside the square brackets:

>>> pip install -e .'[all]'
>>> make venv
>>> source venv-hnx/bin/activate
>>> pip install .


Post-Installation Actions
##########################

Running Tests
**************

To run all the tests, ensure that you first install the testing dependencies:

>>> pip install -e .['testing']

Then try running all the tests:

>>> python -m pytest


Dependencies for some Submodules
********************************

Two submodules in the library, ``hypernetx.algorithms.hypergraph_modularity`` and ``hypernetx.algorithms.contagion``,
require some additional dependencies. If you want to use those submodules, you will need to install those dependencies.

For ``hypernetx.algorithms.hypergraph_modularity``, install the following:

>>> pip install 'igraph>=0.10.4'

For ``hypernetx.algorithms.contagion``, install the following:

>>> pip install 'celluloid>=0.2.0'


Interact with HyperNetX in a REPL
********************************************

Expand All @@ -130,22 +110,29 @@ Ensure that your environment is activated and that you run ``python`` on your te
Other Actions if installed from source
********************************************

Ensure that you are at the root of the source directory before running any of the following commands:
If you have installed HyperNetX from source, you can perform additional actions such as viewing the provided Jupyter notebooks
or building the documentation locally.

Ensure that you have activated your virtual environment and are at the root of the source directory before running any of the following commands:


Viewing jupyter notebooks
--------------------------

The following command will automatically open the notebooks in a browser.

>>> jupyter-notebook tutorials
>>> make tutorial-deps
>>> make tutorials


Building documentation
-----------------------

The following commands will build and open a local version of the documentation in a browser:

>>> make build-docs
>>> open docs/build/index.html
>>> make docs-deps
>>> cd docs
>>> make html
>>> open build/index.html


20 changes: 10 additions & 10 deletions docs/source/widget.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ HyperNetXWidget is currently in beta and will only work on Jupyter Notebook 6.5.
but support for Jupyter Lab is in planning.

In addition, HyperNetXWidget must be installed using the `Anaconda platform <https://www.anaconda.com/>`_ so that the
widget can render on Jupyter notebook. It is highly recommended to use the base environment provided by Anaconda because
Anaconda's package management system, `conda`, will resolve dependencies when HyperNetX and HyperNetXWidget are
installed. For more information on `conda` environments, please see `their documentation here.
<https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment>`_
widget can render on Jupyter notebook.

For users with inexperience with Jupyter and Anaconda, it is highly recommended to use the base environment of Anaconda so
that the widget works seamlessly and out-of-the box on Jupyter Notebook. The widget does not work on Jupyter Lab.

If users want to create a custom environment instead of using the base environment provided by Anaconda, then users
will need to do additional configuration on Jupyter and the kernel to ensure that the widget works.
Specifically, users will need to set the Kernel to use a custom environment. For a guide on how to do this, please
read and follow this guide: `How to add your Conda environment to your jupyter notebook in just 4 steps <https://medium.com/@nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084>`_.


**Do not use python's built-in venv module or virtualenv to create a virtual environment; the widget will not render on
Jupyter notebook.**
Expand Down Expand Up @@ -91,12 +97,6 @@ following screenshot as an example:
:align: center


|
| For more information on setting the environment in Jupyter notebook, see
`How to add your Conda environment to your jupyter notebook in just 4 steps.
<https://medium.com/@nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084>`_

Using the Tool
--------------

Expand Down

0 comments on commit 1950c38

Please sign in to comment.