Skip to content

fix: allow feast init to accept a path as PROJECT_DIRECTORY (#6134) - #6680

Open
karandhaodiyal28-hash wants to merge 1 commit into
feast-dev:masterfrom
karandhaodiyal28-hash:fix-feast-init-path-argument-6134
Open

fix: allow feast init to accept a path as PROJECT_DIRECTORY (#6134)#6680
karandhaodiyal28-hash wants to merge 1 commit into
feast-dev:masterfrom
karandhaodiyal28-hash:fix-feast-init-path-argument-6134

Conversation

@karandhaodiyal28-hash

Copy link
Copy Markdown

What this PR does / why we need it

feast init accepts a positional PROJECT_DIRECTORY argument, but passing a path currently fails:

$ feast init /tmp/test
Error: Invalid value for PROJECT_DIRECTORY: Name should be alphanumeric values,
underscores, and hyphens but not start with an underscore or hyphen.

The argument is validated as a project name (is_valid_name), so any path separator (/, \) is rejected — even though the argument is literally named PROJECT_DIRECTORY and users reasonably expect to scaffold into a directory (e.g. feast init /tmp/test or feast init my/sub/dir).

Change

In init_repo, when PROJECT_DIRECTORY contains a path separator and no explicit --repo-path is 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.

$ feast init /tmp/test        # creates repo at /tmp/test, project name "test"
$ feast init my/sub/dir       # creates repo at my/sub/dir, project name "dir"
$ feast init my_project       # unchanged
$ feast init /tmp/_bad        # still rejected: basename "_bad" is invalid

Behavior with an explicit --repo-path, and plain project names, is unchanged.

Which issue(s) this PR fixes

Fixes #6134

Testing

  • Added test_repo_init_with_path_argument in sdk/python/tests/unit/local_feast_tests/test_init.py — runs feast init <path> via the CLI runner and asserts the repo is scaffolded at the path with the project name derived from the basename.
  • Verified the name-derivation + validation logic against the reporter's case and edge cases (/tmp/testtest; my/sub/dirdir; /tmp/_bad still rejected; explicit --repo-path unchanged).

Note: I couldn't run the full test suite locally — import feast fails on my machine due to a pyarrow _substrait DLL 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.

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 <256503836+karandhaodiyal28-hash@users.noreply.github.com>
@karandhaodiyal28-hash
karandhaodiyal28-hash requested a review from a team as a code owner July 31, 2026 13:57
@codecov-commenter

codecov-commenter commented Jul 31, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.74%. Comparing base (79b33ce) to head (8934f09).

Files with missing lines Patch % Lines
sdk/python/feast/repo_operations.py 0.00% 3 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
go-feature-server 30.58% <ø> (ø)
python-unit 48.07% <0.00%> (+0.30%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/repo_operations.py 38.81% <0.00%> (-0.39%) ⬇️

... and 21 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79b33ce...8934f09. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

feast init /tmp/test # does not work

2 participants