Skip to content

Commit a442b63

Browse files
lmeilibrclaude
andcommitted
fix: resolve spec paths relative to package install dir
The get_spec_dict function used a relative path (farialimer/specs/{provider}) which only works when the CWD contains the farialimer source tree. When farialimer is installed as a package and imported from another project, os.walk finds nothing and returns an empty dict, breaking all parsers and generators. Fix: resolve the specs directory relative to __file__ so it works regardless of the caller's working directory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8510be1 commit a442b63

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

farialimer/utils/spec_loader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def get_spec_dict(provider):
2323
value: spec yaml filepath
2424
"""
2525
spec_dict = {}
26-
for dirpath, _, filenames in walk(f"farialimer/specs/{provider}"):
26+
_package_dir = os.path.dirname(os.path.dirname(__file__))
27+
for dirpath, _, filenames in walk(os.path.join(_package_dir, "specs", provider)):
2728
for filename in filenames:
2829
if filename.endswith("yaml"):
2930
spec_key = filename.split(".")[0]

0 commit comments

Comments
 (0)