fix(python): allow feast init to accept path as PROJECT_DIRECTORY - #6680
Conversation
feast init /tmp/test failed with a project-name validation error because the whole path was validated as the project name. When PROJECT_DIRECTORY contains a path separator and no explicit --repo-path is given, treat the argument as the target directory and derive the project name from its final path component. Invalid basenames are still rejected. Fixes feast-dev#6134. Signed-off-by: Karan Dhaodiyal <[email protected]>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6680 +/- ##
==========================================
+ Coverage 46.45% 46.74% +0.28%
==========================================
Files 414 414
Lines 50136 50176 +40
Branches 7173 7180 +7
==========================================
+ Hits 23293 23454 +161
+ Misses 25204 25082 -122
- Partials 1639 1640 +1
... and 21 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
franciscojavierarceo
left a comment
There was a problem hiding this comment.
The path-aware initialization change derives and validates the project name while preserving the explicit --repo-path and plain-name paths, and the regression covers nested absolute paths. I found no blocking issue in the remote diff.
What this PR does / why we need it
feast initaccepts a positionalPROJECT_DIRECTORYargument, but passing a path currently fails:The argument is validated as a project name (
is_valid_name), so any path separator (/,\) is rejected — even though the argument is literally namedPROJECT_DIRECTORYand users reasonably expect to scaffold into a directory (e.g.feast init /tmp/testorfeast init my/sub/dir).Change
In
init_repo, whenPROJECT_DIRECTORYcontains a path separator and no explicit--repo-pathis provided, treat the argument as the target directory and derive the project name from its final path component. The derived name is then validated as before.Behavior with an explicit
--repo-path, and plain project names, is unchanged.Which issue(s) this PR fixes
Fixes #6134
Testing
test_repo_init_with_path_argumentinsdk/python/tests/unit/local_feast_tests/test_init.py— runsfeast init <path>via the CLI runner and asserts the repo is scaffolded at the path with the project name derived from the basename./tmp/test→test;my/sub/dir→dir;/tmp/_badstill rejected; explicit--repo-pathunchanged).Note: I couldn't run the full test suite locally —
import feastfails on my machine due to apyarrow_substraitDLL being blocked by an OS Application-Control policy (unrelated to this change). The validation/derivation logic is small and pure, and the added regression test exercises the end-to-end CLI path in CI.