Skip to content

Docs: add nx-neptune backend documentation - #8258

Merged
MridulS merged 5 commits into
networkx:mainfrom
acarbonetto:add-nx-neptune-backend-to-docs
Oct 18, 2025
Merged

MridulS merged 5 commits into
networkx:mainfrom
acarbonetto:add-nx-neptune-backend-to-docs

Conversation

@acarbonetto

@acarbonetto acarbonetto commented Sep 8, 2025 •

Copy link
Copy Markdown
Contributor

Adds nx-neptune to backend.md list of compatible integration clients.

References:

Install from pypi:

pip install nx_neptune

Some notable changes:

  • Backend documentation is updated with a link to the nx-neptune repository. Example
  • Supported algorithms contain links to the nx-neptune repository with additional information, such as links to source and the Amazon documentation page, as well as the API. See algorithms.md.
image image

@MridulS

MridulS commented Sep 10, 2025

Copy link
Copy Markdown
Member

@acarbonetto thanks for this! It's nice to see more backends implemented in the wild :)

NetworkX has weekly community meetings and I think it would be great to get a quick demo of this if possible! We meet 9am Vancouver time weekly on Thursdays. Link to the .ics https://scientific-python.org/calendars/networkx.ics. It's okay if you can't make it, no pressure :) I would just need to go fiddle around with AWS then.

@acarbonetto

Copy link
Copy Markdown
Contributor Author

@acarbonetto thanks for this! It's nice to see more backends implemented in the wild :)

NetworkX has weekly community meetings and I think it would be great to get a quick demo of this if possible! We meet 9am Vancouver time weekly on Thursdays. Link to the .ics https://scientific-python.org/calendars/networkx.ics. It's okay if you can't make it, no pressure :) I would just need to go fiddle around with AWS then.

Yes. I would love to give a demo!

I've tried to attend a couple of times at 8am PST on Fridays but there was nobody there. I must have had an old calendar event. I'll do my absolute best to be there tomorrow at 9am with an AWS setup.

@Schefflera-Arboricola Schefflera-Arboricola left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acarbonetto

Copy link
Copy Markdown
Contributor Author

rossbar
rossbar previously approved these changes Sep 11, 2025

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acarbonetto - very cool stuff, thanks for putting this together and taking the time to demo at the meeting!

AFAIK there's no "official" policy laying out criteria for linking to backends from the NX docs. Absent that, here's my personal take:

I'm generally in favor of adding links to doc/backends.md for projects that make good-faith attempts at bringing functionality to users! So I'd be +1 on adding that change right now.

There also exists the infrastructure for auto-generating cross-links to backend implementations of some functions: see e.g. the bottom of the pagerank docs page for an example of the rendered output. For this cross-linking IMO the bar should be a little higher - namely it'd be important (to me at least) that the backend have a test suite in place that for the subset of NX functionality that the backend implements. In principal the process for doing so is documented though I've never actually gone through it myself!

Does that seem reasonable? I'm very open to others' thoughts! Either way, AIUI (and maybe @eriknw can double-check my understanding) this PR would essentially just add nx-neptune to the backends page, which I'd be in favor of, even if it's still in alpha/beta/pre-release phase. Assuming my mental model for things isn't completely off base, I approve!

@acarbonetto

Copy link
Copy Markdown
Contributor Author

There also exists the infrastructure for auto-generating cross-links to backend implementations of some functions: see e.g. the bottom of the pagerank docs page for an example of the rendered output. For this cross-linking IMO the bar should be a little higher - namely it'd be important (to me at least) that the backend have a test suite in place that for the subset of NX functionality that the backend implements. In principal the process for doing so is documented though I've never actually gone through it myself!

I've added an issue on the nx-neptune side to make sure that testing suites are hooked up (awslabs/nx-neptune#29). It can be a problem to have a CI /automatic github action to test the suite because the AWS offering has to be setup to test with (including authentication). We can add a test suite that runs locally - at least until an alternative is discovered.

Signed-off-by: Andrew Carbonetto <[email protected]>
@rossbar
rossbar self-requested a review September 12, 2025 20:15
@rossbar

rossbar commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

Thanks @acarbonetto - looking at the rendered docs my initial impression is that the "additional parameters" bit is too much extra information for the docstring. My preference would be to limit the additional docs to a link to the related backend docs as is done with the other backends. In an ideal world, the link target would take you straight to the neptune docs page for the linked function, but I'm not sure whether the infrastructure is in place to make that easy. Just my 2 cents.

Since this PR now also includes the doc cross-linking, I'm going to go ahead and remove my approval until we've had time to discuss that!

@rossbar
rossbar dismissed their stale review September 12, 2025 20:16

Change in scope for PR: need to evaluate the doc cross-linking and what should be in place for doing so!

@Schefflera-Arboricola

Copy link
Copy Markdown
Member

In an ideal world, the link target would take you straight to the neptune docs page for the linked function, but I'm not sure whether the infrastructure is in place to make that easy. Just my 2 cents.

You can add a "Source" url link for each algorithm (#7219). for nx-parallel, it redirects to the function’s implementation in the repo.

Also, additional parameters (like concurrency and write_property-- not sure about edgeLabel and vertexLabel (also in networkx "node" is preferred over "vertex")) may be better as backend-specific global configurations rather than additional arguments for all algorithms, I think -- unless it's more meaningful to have them as additional parameters for each algorithm. Feel free to disagree.

@acarbonetto

Copy link
Copy Markdown
Contributor Author

Also, additional parameters (like concurrency and write_property-- not sure about edgeLabel and vertexLabel (also in networkx "node" is preferred over "vertex")) may be better as backend-specific global configurations rather than additional arguments for all algorithms, I think -- unless it's more meaningful to have them as additional parameters for each algorithm. Feel free to disagree.

The idea of including them as additional arguments is that they are available at a high-level to users. So anyone who's looking at the documentation will know that the Amazon-algorithm parameters are available.

I agree that the amount of details may be too specific for this documentation. I'm going to propose moving the details to a separate .md in the nx-neptune repo. I'll build an example and let you all take a look.

@acarbonetto

Copy link
Copy Markdown
Contributor Author

@rossbar @Schefflera-Arboricola

I have updated our documentation (no change required here) on the nx-neptune side of things and moved a majority of the API documentation to the nx-neptune site - only a single click away.

All information the algorithms are consolidated in our algorithms.md file with anchor links from the networkx.org documentation page.

For example, for bfs_edges, it's just a link: https://output.circle-artifacts.com/output/job/9f31fd5a-3461-42e6-a769-a4252139f93d/artifacts/0/doc/build/html/reference/algorithms/generated/networkx.algorithms.traversal.breadth_first_search.bfs_edges.html#networkx.algorithms.traversal.breadth_first_search.bfs_edges
While for
While for asyn_lpa_communities there's a few more information, but most of the details are in the link: https://output.circle-artifacts.com/output/job/9f31fd5a-3461-42e6-a769-a4252139f93d/artifacts/0/doc/build/html/reference/algorithms/generated/networkx.algorithms.community.label_propagation.asyn_lpa_communities.html#networkx.algorithms.community.label_propagation.asyn_lpa_communities

Let me know if this is acceptable.

@eriknw

eriknw commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

Nice! I like how function-specific notes are still included in the docstring and also having a link for more details.

Some of the additional docstrings are rendered oddly. Note that networkx doesn't use dedent or any sort of cleaning of these inputs (maybe we should?):

if func_docs := (
func_info.get("additional_docs") or func_info.get("extra_docstring")
):
lines.extend(
f" {line}" if line else line for line in func_docs.split("\n")
)

See how asyn_lpa_communities is quoted b/c it's indented:
https://output.circle-artifacts.com/output/job/9f31fd5a-3461-42e6-a769-a4252139f93d/artifacts/0/doc/build/html/reference/algorithms/generated/networkx.algorithms.community.label_propagation.asyn_lpa_communities.html#networkx.algorithms.community.label_propagation.asyn_lpa_communities

And see how pagerank makes the first line bold:
https://output.circle-artifacts.com/output/job/9f31fd5a-3461-42e6-a769-a4252139f93d/artifacts/0/doc/build/html/reference/algorithms/generated/networkx.algorithms.link_analysis.pagerank_alg.pagerank.html#networkx.algorithms.link_analysis.pagerank_alg.pagerank

The additional docstrings are defined here:
https://github.com/awslabs/nx-neptune/blob/main/nx_plugin/__init__.py

Maybe we should try to have NetworkX clean up these strings to be more accommodating. This isn't something I've put much effort into.

Oh, and my two cents are having tests--especially running networkx tests--is best practice even if only run locally, but I understand this may be more difficult, inconvenient, or costly for some backends. As long as backends are striving to do well and making an honest effort--and respond to user feedback--I'm okay with including them.

@acarbonetto

Copy link
Copy Markdown
Contributor Author

Thanks for your feedback!

I'll see if I can clean up the docs. I'm concerned about adding inline formatting in case there's any formatting done on the nx side. So I'll keep it limited.

Oh, and my two cents are having tests--especially running networkx tests--is best practice even if only run locally, but I understand this may be more difficult, inconvenient, or costly for some backends. As long as backends are striving to do well and making an honest effort--and respond to user feedback--I'm okay with including them.

These are run locally against an instance of Neptune in the cloud. Unfortunately, there's no good way to run these in github actions right now as CI (not without a full account set up at least). That being said, we have an issue to investigate an alternative (e.g. using a mock): awslabs/nx-neptune#29.

@acarbonetto acarbonetto changed the title Docs: add nx-neptune backend to https://github.com/awslabs/nx-neptune Docs: add nx-neptune backend documentation Sep 17, 2025
@rossbar rossbar added the Dispatching Related to dispatching and backend support label Sep 17, 2025

@dschult dschult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all seems to be working, and generally looks good to me.

As far as timing goes, we plan to release networkx 3.6 in October. So the docs would become public then. It looks like nx-neptune is in an Alpha release phase based on the Readme. Do you want the NX public links to be available while in Alpha? Or should we hold off until after 3.6 release and then merge (once we merge it will be on our "latest" docs -- then when we make the release they show up in our "stable" docs.

We should probably build a set of guidelines for backend doc inclusion, style, testing etc.

By the way, the testing is set up so you set some environment variables and then run all the networkx test suite. For functions not provided by neptune get run in NetworkX while the provided functions (including when other networkx function call that function) use the neptune backend. In your case you still need to set up the resource to make it run. But you don't need to worry about which tests to run -- just run them all and rely on the fallback to allow the tests to pass.

I'm going to approve this PR with the idea that follow-up changes and our guidelines, etc should come in separate PRs. Thanks @acarbonetto!

@acarbonetto

Copy link
Copy Markdown
Contributor Author

By the way, the testing is set up so you set some environment variables and then run all the networkx test suite. For functions not provided by neptune get run in NetworkX while the provided functions (including when other networkx function call that function) use the neptune backend. In your case you still need to set up the resource to make it run. But you don't need to worry about which tests to run -- just run them all and rely on the fallback to allow the tests to pass.

Correct. I can run these locally, as we don't yet have a set of resources to run against in CI. This is partially why we are labelling the release as "alpha".

As far as timing goes, we plan to release networkx 3.6 in October. So the docs would become public then. It looks like nx-neptune is in an Alpha release phase based on the Readme. Do you want the NX public links to be available while in Alpha?

As mentioned during the demo, the other reason for the "alpha" label is to get usage data before a v1.0 release. The preview library is stable, within the test scenarios that we've run - but we'd like to get more pipelines and use cases before declaring it stable.

Regardless, the backend is out in the wild and we want people to use it.

@acarbonetto

acarbonetto commented Sep 25, 2025 •

Copy link
Copy Markdown
Contributor Author

@rossbar @eriknw @Schefflera-Arboricola would you have a chance to take a look at the latest documentation?

@acarbonetto

Copy link
Copy Markdown
Contributor Author

@rossbar ping! to see if you have had a chance to take a look at the latest documentation updates.

@MridulS MridulS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @acarbonetto !

@MridulS
MridulS merged commit aa7a53d into networkx:main Oct 18, 2025
@dschult dschult added this to the 3.6 milestone Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dispatching Related to dispatching and backend support type: Documentation

Development

Successfully merging this pull request may close these issues.

6 participants