Skip to content

Commit

Permalink
Merge branch 'networkx:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Schefflera-Arboricola authored Oct 14, 2023
2 parents 8e48408 + 0ac8b7b commit 614ada3
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 21 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/label-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Labels

on:
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize

env:
LABELS: ${{ join( github.event.pull_request.labels.*.name, ' ' ) }}

jobs:
check-type-label:
name: ensure type label
runs-on: ubuntu-latest
steps:
- if: "contains( env.LABELS, 'type: ' ) == false"
run: exit 1
18 changes: 18 additions & 0 deletions .github/workflows/milestone-merged-prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Milestone

on:
pull_request_target:
types:
- closed
branches:
- "main"

jobs:
milestone_pr:
name: attach to PR
runs-on: ubuntu-latest
steps:
- uses: scientific-python/attach-next-milestone-action@bc07be829f693829263e57d5e8489f4e57d3d420
with:
token: ${{ secrets.MILESTONE_LABELER_TOKEN }}
force: true
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Wheel and Release
on:
push:
tags:
- v*

jobs:
pypi-publish:
name: upload release to PyPI
if: github.repository_owner == 'networkx' && startsWith(github.ref, 'refs/tags/v') && github.actor == 'jarrodmillman' && always()
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.11"

- name: Build wheels
run: |
git clean -fxd
pip install -U build
python -m build --sdist --wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# nx-parallel 0.1

We're happy to announce the release of nx-parallel 0.1!

## Enhancements

- first commit, isolates and betweenness ([#2](https://github.com/networkx/nx-parallel/pull/2)).
- Reconfigure so ParallelGraph stores original nx graph ([#9](https://github.com/networkx/nx-parallel/pull/9)).

## Bug Fixes

- bug fix : changed edge probability from 0.5 to p ([#13](https://github.com/networkx/nx-parallel/pull/13)).

## Documentation

- Update README for Clarity and Comprehension ([#16](https://github.com/networkx/nx-parallel/pull/16)).
- Add release process documentation ([#19](https://github.com/networkx/nx-parallel/pull/19)).

## Maintenance

- add skeleton ([#1](https://github.com/networkx/nx-parallel/pull/1)).
- Add basic test.yaml based on graphblas-algorithms ([#3](https://github.com/networkx/nx-parallel/pull/3)).
- New name for repository ([#8](https://github.com/networkx/nx-parallel/pull/8)).
- Clean up tests, add some minimal docs to readme ([#10](https://github.com/networkx/nx-parallel/pull/10)).
- Use changelist ([#17](https://github.com/networkx/nx-parallel/pull/17)).
- Use hatch as the build backend ([#20](https://github.com/networkx/nx-parallel/pull/20)).
- Use trusted publisher ([#18](https://github.com/networkx/nx-parallel/pull/18)).

## Contributors

6 authors added to this release (alphabetically):

- [@20kavishs](https://github.com/20kavishs)
- Aditi Juneja ([@Schefflera-Arboricola](https://github.com/Schefflera-Arboricola))
- Dan Schult ([@dschult](https://github.com/dschult))
- Jarrod Millman ([@jarrodmillman](https://github.com/jarrodmillman))
- MD ASIFUL ALAM ([@axif0](https://github.com/axif0))
- Mridul Seth ([@MridulS](https://github.com/MridulS))

4 reviewers added to this release (alphabetically):

- Aditi Juneja ([@Schefflera-Arboricola](https://github.com/Schefflera-Arboricola))
- Dan Schult ([@dschult](https://github.com/dschult))
- Jarrod Millman ([@jarrodmillman](https://github.com/jarrodmillman))
- Mridul Seth ([@MridulS](https://github.com/MridulS))

_These lists are automatically generated, and may not be complete or may contain
duplicates._
57 changes: 39 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
## nx-parallel

A NetworkX backend plugin which uses joblib and multiprocessing for parallelization.
nx-parallel is a NetworkX backend plugin that uses joblib and multiprocessing for parallelization. This project aims to provide parallelized implementations of various NetworkX functions to improve performance.

```python
In [1]: import networkx as nx; import nx_parallel
## Features

In [2]: G = nx.path_graph(4)

In [3]: H = nx_parallel.ParallelGraph(G)

In [4]: nx.betweenness_centrality(H)
Out[4]: {0: 0.0, 1: 0.6666666666666666, 2: 0.6666666666666666, 3: 0.0}

```

Currently the following functions have parallelized implementations:
nx-parallel provides parallelized implementations for the following NetworkX functions:

```
├── centrality
Expand All @@ -38,21 +28,52 @@ To setup a local development:
- Fork this repository.
- Clone the forked repository locally.
```
$ git clone git@github.com:<your_username>/networkx.git
git clone git@github.com:<your_username>/networkx.git
```
- Create a fresh conda/mamba virtualenv and install the dependencies
```
$ pip install -e ".[developer]"
pip install -e ".[developer]"
```
- Install pre-commit actions that will run the linters before making a commit
```
$ pre-commit install
pre-commit install
```


## Usage

Here's an example of how to use nx-parallel:

```python
In [1]: import networkx as nx; import nx_parallel

In [2]: G = nx.path_graph(4)

In [3]: H = nx_parallel.ParallelGraph(G)

In [4]: nx.betweenness_centrality(H)
Out[4]: {0: 0.0, 1: 0.6666666666666666, 2: 0.6666666666666666, 3: 0.0}
```
- Make sure you can run the tests locally with

## Testing

To run tests for the project, use the following command:

```
PYTHONPATH=. \
NETWORKX_GRAPH_CONVERT=parallel \
NETWORKX_TEST_BACKEND=parallel \
NETWORKX_FALLBACK_TO_NX=True \
pytest --pyargs networkx "$@"
```
```

## Contributing

We'd love to have you contribute to nx-parallel! Here are some guidelines on how to do that:

- **Issues:** Feel free to open issues for any problems you face, or for new features you'd like to see implemented.
- **Pull requests:** If you'd like to implement a feature or fix a bug yourself, we'd be happy to review a pull request. Please make sure to explain the changes you made in the pull request description.

## Additional Information

This project is part of the larger NetworkX project. If you're interested in contributing to NetworkX, you can find more information in the [NetworkX contributing guidelines](https://github.com/networkx/networkx/blob/main/CONTRIBUTING.rst).
59 changes: 59 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Release process for `nx-parallel`

## Introduction

Example `version number`

- 1.8.dev0 # development version of 1.8 (release candidate 1)
- 1.8rc1 # 1.8 release candidate 1
- 1.8rc2.dev0 # development version of 1.8 release candidate 2
- 1.8 # 1.8 release
- 1.9.dev0 # development version of 1.9 (release candidate 1)

## Process

- Set release variables:

export VERSION=<version number>
export PREVIOUS=<previous version number>
export ORG="networkx"
export REPO="nx-parallel"

- Autogenerate release notes

changelist ${ORG}/${REPO} v${PREVIOUS} main --version ${VERSION}

- Put the output of the above command at the top of `CHANGELOG.md`

- Update `__version__` in `nx_parallel/__init__.py`.

- Commit changes:

git add nx_parallel/__init__.py CHANGELOG.md
git commit -m "Designate ${VERSION} release"

- Tag the release in git:

git tag -s v${VERSION} -m "signed ${VERSION} tag"

If you do not have a gpg key, use -u instead; it is important for
Debian packaging that the tags are annotated

- Push the new meta-data to github:

git push --tags origin main

where `origin` is the name of the `github.com:networkx/nx-parallel`
repository

- Review the github release page:

https://github.com/networkx/nx-parallel/tags

- Update `__version__` in `nx_parallel/__init__.py`.

- Commit changes:

git add pyproject.toml
git commit -m 'Bump version'
git push origin main
2 changes: 2 additions & 0 deletions nx_parallel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from .algorithms import *
from .interface import *
from .utils import *

__version__ = "0.2rc0.dev0"
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "nx-parallel"
Expand All @@ -19,7 +19,10 @@ dependencies = [
"networkx",
"joblib"
]
version = '0.0.1'
dynamic = ["version"]

[tool.hatch.version]
path = "nx_parallel/__init__.py"

[project.optional-dependencies]
developer = [
Expand Down
1 change: 1 addition & 0 deletions requirements/release.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
changelist==0.4

0 comments on commit 614ada3

Please sign in to comment.