Skip to content

fix: remove access from explore tier in federation_hierarchy - #1425

Open
samay2504 wants to merge 2 commits into
pysal:mainfrom
samay2504:fix/access-duplicate-federation-tier
Open

samay2504 wants to merge 2 commits into
pysal:mainfrom
samay2504:fix/access-duplicate-federation-tier

Conversation

@samay2504

Copy link
Copy Markdown
Contributor

fixes #1424.

access was listed in both explore and model tiers of federation_hierarchy, causing Python's dict assignment to silently discard the explore entry so memberships["access"] always resolved to "model" regardless of iteration order. The duplicate explore entry is removed, aligning the data structure with the __init__.py docstring and pysal.org which place access exclusively under model.

access appears in both explore and model, causing memberships['access']
to silently resolve to 'model' (last-write wins). The __init__.py
docstring and pysal.org docs place access under model only.
Copilot AI review requested due to automatic review settings March 3, 2026 08:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Removes the duplicate "access" entry from the explore tier in pysal.base.federation_hierarchy so the derived memberships mapping is unambiguous and aligns with the package-layer documentation.

Changes:

  • Remove "access" from the explore layer in federation_hierarchy (leaving it only under model).
  • Simplify the memberships consistency test now that "access" no longer needs special-casing.
  • Add a regression test ensuring _installed_version() returns "NA" for a nonexistent package.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pysal/base.py Removes "access" from explore in federation_hierarchy, making memberships["access"] deterministic.
pysal/tests/test_base.py Updates membership-layer assertions and adds a nonexistent-package test for _installed_version().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pysal/base.py
Comment on lines 13 to 16
"pointpats",
"inequality",
"spaghetti",
"access",
"momepy",

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

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

PR metadata/linked issue #1424 describes an ImportError/__all__ export problem for federation_hierarchy/memberships, but this PR only changes the federation_hierarchy contents (removing access from explore) and related tests. If the intent is to close #1424, the exports in pysal/__init__.py (or the issue reference/PR description) likely needs to be updated so they align with the actual fix being made here.

Copilot uses AI. Check for mistakes.
Comment thread pysal/tests/test_base.py
# Note: test for nonexistent package is omitted because the current
# implementation has a bug (NameError instead of returning 'NA').
# This will be fixed in a separate PR.
def test_installed_version_for_nonexistent_package(self):

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

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

For consistency with the rest of the tests in this class/file (most test methods have a short docstring), consider adding a brief docstring to this newly added test as well.

Suggested change
def test_installed_version_for_nonexistent_package(self):
def test_installed_version_for_nonexistent_package(self):
"""Test version detection for a nonexistent package."""

Copilot uses AI. Check for mistakes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImportError: cannot import name 'federation_hierarchy' from 'pysal.base'

2 participants