Skip to content

Comments

add atlas name hinting#745

Merged
PolarBean merged 13 commits intomainfrom
hint-atlas-names
Feb 9, 2026
Merged

add atlas name hinting#745
PolarBean merged 13 commits intomainfrom
hint-atlas-names

Conversation

@PolarBean
Copy link
Member

@PolarBean PolarBean commented Feb 3, 2026

Description

I always find myself needing to check the brainglobe documentation for atlas names. I realised it would be really nice if my IDE could suggest me valid atlas names. This is apparantly very doable and I have implemented it here. The main drawback is we would have a hardcoded atlas name list that we would need to update. We could have a test though that automatically checks for discrepencies between the remote last_versions.conf and our atlas_names.py

This is what it looks like in practice
image

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@PolarBean PolarBean changed the title add atlas names and atlas hinting add atlas name hinting Feb 3, 2026
@adamltyson
Copy link
Member

This is a great idea, but I'm concerned that this is one more place to add the atlas (GIN repo, last_versions.conf, docs, readme etc etc), and it will lag behind.

Is there a way to directly import this from last_versions.conf somehow?

@PolarBean
Copy link
Member Author

I looked into this and no it has to be hardcoded like this. Would it be acceptable to automatically create this file using a github action? Thats the only way I think we could have it without hand maintaining it

@adamltyson
Copy link
Member

Would it be acceptable to automatically create this file using a github action?

Possibly, this seems brittle though. It would be less than ideal, but could it be created on initialising the class? So there would be autocomplete, but only not for the first time someone ever uses the API?

@PolarBean
Copy link
Member Author

I think its odd to change the python files after everything is installed. Here is what the gh action solution would look like, what do you think?

@adamltyson
Copy link
Member

What about part of the validation script that checks that the list has been updated in the code?

@PolarBean
Copy link
Member Author

ah so still have it written manually. Well that's already what the test I added does so if someone forgets it will fail when they push. Do you think its beneficial to also do this during atlas validation?

@PolarBean
Copy link
Member Author

I added it to the atlas validation, I think its good we check twice as they are slightly different (checks atlas is in last_versions.conf vs checking that wrapup atlas name has been added to atlas_name.py)

"""Ensure atlas name list matches last_versions.conf keys exactly."""
atlas_name_values = list(get_args(AtlasName))
cache_path = config.get_brainglobe_dir() / "last_versions.conf"
if not cache_path.exists():
Copy link
Member

Choose a reason for hiding this comment

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

I think we should make sure that our test env always has this set up, so would shouldn't need to check this?
I think we (kind of) already implicitly do because we have a fixture that instantiates a BrainGlobeAtlas that will have been called previously.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree its a bit extra, ill remove it

@alessandrofelder
Copy link
Member

I like the idea a lot!
Maybe I am too tired 😅 will this work alongside users that have a custom_atlases.conf file?

IIUC they just wouldn't have the IDE autocomplete but they could still instantiate the atlas objects?

@PolarBean
Copy link
Member Author

Yes! I tested it with custom atlases and it works like normal they just don't get the autocomplete

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

@alessandrofelder alessandrofelder self-requested a review February 9, 2026 11:25
Copy link
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

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

Nice - thanks @PolarBean

Think we can merge now but will leave merging honours to you in case you had more plans for this PR (I self-requested review so wasn't sure).

@PolarBean PolarBean merged commit db913d4 into main Feb 9, 2026
15 of 16 checks passed
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.

3 participants