-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f71f8e9
commit 36f3aac
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
mopti==0.10.10 | ||
mopti>=0.10.10 | ||
bofire>=0.0.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
def find_min_bofire_version(pkg: str, filepath: str): | ||
with open(filepath) as f: | ||
for line in f: | ||
if f"{pkg}==" in line: | ||
raise Exception( | ||
"bofire version is pinned to a specific version. please specify the minimal version with >=" | ||
) | ||
if f"{pkg}>=" in line: | ||
return line.split("=")[1].split('"')[0].strip() | ||
|
||
|
||
def find_all_deps_inreqstxt(filepath: str): | ||
with open(filepath) as f: | ||
for line in f: | ||
if line.strip() != "" and line.strip()[0] != "#": | ||
if ">=" in line: | ||
yield line.split(">=")[0].strip() | ||
else: | ||
raise ValueError( | ||
f"Please specify the minimal version with >= in {filepath}" | ||
) | ||
|
||
|
||
def test(): | ||
for dep in find_all_deps_inreqstxt("requirements.txt"): | ||
min_v_req = find_min_bofire_version(dep, "requirements.txt") | ||
min_v_pyprtoml = find_min_bofire_version(dep, "pyproject.toml") | ||
assert min_v_req == min_v_pyprtoml |