Skip to content

Conversation

@kalpana-pardeep-rassani
Copy link

@kalpana-pardeep-rassani kalpana-pardeep-rassani commented Nov 28, 2025

Before submitting a pull request (PR), please read the contributing guide.

Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
The current implementation crashes with a KeyError: 'atlases' if the local custom_atlases.conf file exists but is empty (contains no sections). This prevents the brainglobe list command from running.

What does this PR do?
This PR modifies the get_all_atlases_lastversions function in brainglobe_atlasapi/list_atlases.py to use a safe .get("atlases", {}) method when reading the custom atlas configuration. This ensures that an empty dictionary is used if the 'atlases' section is missing, thus preventing the crash.

References

Fixes #668

How has this PR been tested?

The fix was tested locally by ensuring that the brainglobe list command runs successfully without crashing when the ~/.brainglobe/custom_atlases.conf file is present but completely empty.

Is this a breaking change?

No. This is a fix for an existing bug and does not change any public API or required functionality.

Does this PR require an update to the documentation?

No.

Checklist:

  • [done] The code has been tested locally
  • [done] Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • [done] The code has been formatted with pre-commit
    Note on Test Failures:

All code changes related to Issue #668 (empty config file) have been verified locally. When running the full test suite, I encountered 2 ConnectionErrors (due to the GIN server being unreachable) and 1 FileNotFoundError (due to missing local test data), which are external to this fix. The patch itself is clean.

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.

[BUG] Empty custom_atlases.conf file leads to crash

2 participants