diff --git a/.github/workflows/label-check.yaml b/.github/workflows/label-check.yaml new file mode 100644 index 0000000..d6e97f2 --- /dev/null +++ b/.github/workflows/label-check.yaml @@ -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 diff --git a/.github/workflows/milestone-merged-prs.yaml b/.github/workflows/milestone-merged-prs.yaml new file mode 100644 index 0000000..71ae037 --- /dev/null +++ b/.github/workflows/milestone-merged-prs.yaml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bca9689 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..38bff9d --- /dev/null +++ b/CHANGELOG.md @@ -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._ diff --git a/README.md b/README.md index bbe42ce..ac3240c 100644 --- a/README.md +++ b/README.md @@ -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 @@ -38,21 +28,52 @@ To setup a local development: - Fork this repository. - Clone the forked repository locally. ``` -$ git clone git@github.com:/networkx.git +git clone git@github.com:/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 "$@" -``` \ No newline at end of file +``` + +## 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). diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..7d0dc3d --- /dev/null +++ b/RELEASE.md @@ -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= + export PREVIOUS= + 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 diff --git a/nx_parallel/__init__.py b/nx_parallel/__init__.py index 77d7714..5c9e673 100644 --- a/nx_parallel/__init__.py +++ b/nx_parallel/__init__.py @@ -1,3 +1,5 @@ from .algorithms import * from .interface import * from .utils import * + +__version__ = "0.2rc0.dev0" diff --git a/pyproject.toml b/pyproject.toml index fb71bde..5f09069 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -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 = [ diff --git a/requirements/release.txt b/requirements/release.txt new file mode 100644 index 0000000..b2531f9 --- /dev/null +++ b/requirements/release.txt @@ -0,0 +1 @@ +changelist==0.4