Skip to content

Commit 20dfac0

Browse files
authored
Fix for pip flags with equal sign being incorrectly treated as local file names (#3766)
## Changes Fix for pip flags with equal sign being incorrectly treated as local file names ## Why Pip flags containing an equal sign and used in the environment dependencies section were incorrectly treated as local file names, leading to the bundle deploy error. ## Tests Added test case for this <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent 98d7b80 commit 20dfac0

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212

1313
### Bundles
1414
* Updated the internal lakeflow-pipelines template to use an "src" layout ([#3671](https://github.com/databricks/cli/pull/3671)).
15+
* Fix for pip flags with equal sign being incorrectly treated as local file names ([#3766](https://github.com/databricks/cli/pull/3766))
1516

1617
### API Changes

acceptance/bundle/environments/dependencies/databricks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ resources:
3232
- "beautifulsoup4>=1.0.0,~=1.2.0,<2.0.0"
3333
- "beautifulsoup4[security, tests] ~= 4.12.3"
3434
- "requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip"
35+
- "--find-links=/Workspace/Users/test"
3536

3637
pipelines:
3738
test_pipeline:
@@ -49,3 +50,4 @@ resources:
4950
- "test_package>=2.0.1"
5051
- "beautifulsoup4>=1.0.0,~=1.2.0,<2.0.0"
5152
- "requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip"
53+
- "--find-links=/Workspace/Users/test"

acceptance/bundle/environments/dependencies/output.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ Deployment complete!
3333
"/Workspace/Users/[email protected]/test-package.whl",
3434
"beautifulsoup4>=1.0.0,~=1.2.0,<2.0.0",
3535
"beautifulsoup4[security, tests] ~= 4.12.3",
36-
"requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip"
36+
"requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip",
37+
"--find-links=/Workspace/Users/test"
3738
]
3839
}
3940
},
@@ -71,7 +72,8 @@ Deployment complete!
7172
"test_package==2.0.1",
7273
"test_package>=2.0.1",
7374
"beautifulsoup4>=1.0.0,~=1.2.0,<2.0.0",
74-
"requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip"
75+
"requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip",
76+
"--find-links=/Workspace/Users/test"
7577
]
7678
},
7779
"name": "Test Pipeline"
@@ -96,7 +98,8 @@ Deployment complete!
9698
"/Workspace/Users/[email protected]/test-package.whl",
9799
"beautifulsoup4>=1.0.0,~=1.2.0,<2.0.0",
98100
"beautifulsoup4[security, tests] ~= 4.12.3",
99-
"requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip"
101+
"requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip",
102+
"--find-links=/Workspace/Users/test"
100103
]
101104
}
102105
},
@@ -124,6 +127,7 @@ Deployment complete!
124127
"test_package==2.0.1",
125128
"test_package>=2.0.1",
126129
"beautifulsoup4>=1.0.0,~=1.2.0,<2.0.0",
127-
"requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip"
130+
"requests[security] @ https://github.com/psf/requests/archive/refs/heads/main.zip",
131+
"--find-links=/Workspace/Users/test"
128132
]
129133
}

bundle/libraries/local_path.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func containsPipFlag(input string) bool {
9595
// Trailing space means the the flag takes an argument or there's multiple arguments in input
9696
// Alternatively it could be a flag with no argument and no space after it
9797
// For example: -r myfile.txt or --index-url http://myindexurl.com or -i
98-
re := regexp.MustCompile(`(^|\s+)--?[a-zA-Z0-9-]+(\s+|$)`)
98+
re := regexp.MustCompile(`(^|\s+)--?[a-zA-Z0-9-]+(([\s|=]+)|$)`)
9999
return re.MatchString(input)
100100
}
101101

bundle/libraries/local_path_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,15 @@ func TestIsLibraryLocal(t *testing.T) {
6363
{path: "-e some/local/path", expected: false},
6464
{path: "-i http://myindexurl.com", expected: false},
6565
{path: "--index-url http://myindexurl.com", expected: false},
66+
{path: "--index-url http://myindexurl.com", expected: false},
6667
{path: "-i", expected: false},
6768
{path: "--index-url", expected: false},
6869
{path: "-i -e", expected: false},
70+
{path: "--find-links=/Workspace/Users/test", expected: false},
71+
{path: "--find-links = /Workspace/Users/test.whl", expected: false},
72+
{path: "--find-links =/Workspace/Users/test.whl", expected: false},
73+
{path: "--find-links = /Workspace/Users/test.whl", expected: false},
74+
{path: "--find-links /Workspace/Users/test", expected: false},
6975

7076
// Check the possible version specifiers as in PEP 440
7177
// https://peps.python.org/pep-0440/#public-version-identifiers

0 commit comments

Comments
 (0)