- This document assumes some familiarity NetworkX library and contributing to open source scientific Python projects using Github pull requests. If this does not describe you, you may first want to see the Contributing FAQs.
- Building and Testing process of this project is done on Linux and MacOS platforms. Therefore, any one of the afformentioned platforms is an extra requirement for this project.
If you are a first time contributor:
- Go to https://github.com/networkx/nx-guides and click on the
fork
button to create your own copy of the project. - Clone the project to your local system
git clone https://github.com/username/nx-guides.git
- Navigate to the folder and add upstream repository:
git remote add upstream git@github.com:networkx/nx-guides.git
- Now you will have remote repositories named as such:
upstream
, refering to thenx-guides
repositoryorigin
, refering to your personal forked repository
- Next, you need to set up your build environment. Here are the instructions for two popular environment managers:
venv
(pip based)# Create a virtualenv named ``nx-guides-dev`` python -m venv nx-guides-dev # Activate it source nx-guides-dev/bin/activate # Install main development and runtime dependencies pip install -r requirements.txt
conda
(Anaconda or Miniconda)# Create a conda environment named ``nx-guides-dev`` conda create --name nx-guides-dev # Activate it conda activate nx-guides-dev # Install main development and runtime dependencies conda install -c conda-forge --file requirements.txt
- Develop your contribution
- Pull the latest changes from upstream
git checkout main git pull upstream main
- Create a branch for the feature you want to work on. Since the branch name will appear in the merge message, use a sensible name such as 'bugfix-for-issue-1480':
git checkout -b bugfix-for-issue-1480
- Commit locally using
git add
andgit commit
as you progress
- Pull the latest changes from upstream
After you have created the Jupyter Notebook on your selected algorithm or networkx application (Guidelines for appropriate notebooks), the next step would be converting the notebook. The educational materials in the form of markdown-based Jupyter Notebooks which makes them interactive! You can follow along yourself:
- on binder, by clicking on the launch button at the top of this page, or the rocket icon in the upper-right corner of any of the pages, or
- locally, by cloning the repository (see the octocat icon above) and running jupyter notebook.
To convert a notebook into markdown format, jupytext
is used. The following command is used for the conversion:
jupytext notebook.ipynb --to myst
After conversion, the next task would be arranging the files in the correct location. For maintaining a consistent coding style, the following rules are to followed -
- The
.md
file generated will be placed in a subdirectory under appropriate directory - Only a single
.md
file will be stored in a directory. For multiple files, multiple directories should be created accordingly. These directories should be then arranged properly for a tree structure. See Algorithms. - Markdown file generated using Jupytext are to named
index.md
- All the datasets used in the notebooks should be placed in an
data
folder - All the static images used for the documentation should be placed in
images
folder - Each
index.md
is to be mentioned in the parent directory'sTOC tree
. Finally, the.md
file in main directory of/content
should be included inTOC tree
of/site/index.md
.