Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate hmn and lgc modules from the node_classification package #5166

Merged
merged 6 commits into from
Nov 6, 2021

Conversation

rossbar
Copy link
Contributor

@rossbar rossbar commented Nov 1, 2021

Deprecates the hmn and lgc modules in the node_classification package. These names are not particularly descriptive, and are more of an implementation detail than useful objects or namespaces.

Refactors the node_classification/__init__.py with __getattr__ and __dir__ so that the same functions are visible/accessible from the package, but a deprecation warning is raised if a user tries to access the hmn or lgc attributes specifically. Access to the functions they define (harmonic_function and local_and_global_consistency, respectively) should be exactly the same as before.

This deprecation is in preparation for refactoring node_classification from a package to a module for NetworkX 3.0. The functions defined in lgc.py and hmn.py, along with an internal function in the currently unexposed utils.py, will be moved to a node_classification.py module, which will replace the current package. I've taken the liberty of combining the hmn and lgc tests into one top-level test_node_classification.py file that lives one level up. I left the tests themselves entirely unchanged.

I've also added tests to ensure that deprecation warnings are raised at the appropriate times.

Condense all node-classification tests into single test module
one level up.
Add a deprecation warning whenever the hmn or lgc attributes
are accessed.
@rossbar rossbar added this to the networkx-2.7 milestone Nov 1, 2021
Copy link
Member

@dschult dschult left a comment

Choose a reason for hiding this comment

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

LGTM!

@jarrodmillman jarrodmillman merged commit 4f7690b into networkx:main Nov 6, 2021
@rossbar rossbar deleted the node-classification-module branch December 13, 2021 05:55
dschult pushed a commit to dschult/networkx that referenced this pull request Jan 25, 2022
…age (networkx#5166)

* Reorganize tests.

Condense all node-classification tests into single test module
one level up.

* Add tests for deprecation warnings.

* Prevent test crosstalk.

* Refactor pkg with __getattr__ and __dir__.

Add a deprecation warning whenever the hmn or lgc attributes
are accessed.

* Add deprecation reminder to developer docs.

* Add release note.
MridulS pushed a commit to MridulS/networkx that referenced this pull request Feb 4, 2023
…age (networkx#5166)

* Reorganize tests.

Condense all node-classification tests into single test module
one level up.

* Add tests for deprecation warnings.

* Prevent test crosstalk.

* Refactor pkg with __getattr__ and __dir__.

Add a deprecation warning whenever the hmn or lgc attributes
are accessed.

* Add deprecation reminder to developer docs.

* Add release note.
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request Apr 22, 2024
…age (networkx#5166)

* Reorganize tests.

Condense all node-classification tests into single test module
one level up.

* Add tests for deprecation warnings.

* Prevent test crosstalk.

* Refactor pkg with __getattr__ and __dir__.

Add a deprecation warning whenever the hmn or lgc attributes
are accessed.

* Add deprecation reminder to developer docs.

* Add release note.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants