Skip to content

Commit

Permalink
wrong version pyproject toml
Browse files Browse the repository at this point in the history
  • Loading branch information
bertiqwerty committed Apr 11, 2024
1 parent f71f8e9 commit 36f3aac
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ classifiers = ["Development Status :: 1 - Planning",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers"]
dependencies = [
"mopti==0.10.10",
"bofire>=0.0.4",
"mopti>=0.10.10",
"bofire>=0.0.12",
]

[project.urls]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
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
28 changes: 28 additions & 0 deletions test/test_pyprojecttoml.py
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

0 comments on commit 36f3aac

Please sign in to comment.