OpenMDAO / OpenMDAO/Aviary

Stop `get_path` from "autocompleting" filenames

Open
#1,118 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

code cleanup user interface
Dominant language
Python
Stars
287
Forks
140
Avg merge
6d 14h
Merged PRs (30d)
18

Description

Desired capability or behavior.

get_path currently completes a file with ".csv" if it can't find one with the right file extension. This is unhelpful as we have similarly named files (such as the legacy files vs. converted files), and now that those exist in the legacy folder I often see the converted file returned when I specifically asked to find the legacy file.

Suggested implementation.

get_path() should ONLY look for exact matches, including file extension. If it can't find an exact match, it needs to raise a FileNotFoundError.

get_model() should use this kind of behavior, since it is supposed to be limited to only the aviary/models folder and is designed to assist users trying to find the included models using only their name (they shouldn't need to care about filepath or file extension when using basic commands like run_mission).
For commands where we want that filling behavior, we can first use get_path() to see if the user provided a full valid filepath, then use get_model() if get_path() fails, finally raising the FileNotFoundError if that function fails too.

We probably will need to swap around where we are using get_path() and get_model in the codebase, as some tests, examples, and command utilities are probably relying on the extension completion capabilities of get_path()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the definitions and all call sites of get_path() and get_model(), including the tests, examples, and command utilities mentioned in the issue. Verify the current extension-completion behavior, then trace each caller to ensure exact paths use get_path() while model-name lookup uses get_model(); done means missing exact paths raise FileNotFoundError without breaking intended model resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.