Skip to content

Commit

Permalink
Merge pull request #580 from MilesCranmer/fix-extensions
Browse files Browse the repository at this point in the history
Bump backend version and switch to GitHub version
  • Loading branch information
MilesCranmer authored Mar 24, 2024
2 parents de9fc13 + 7ba43b5 commit 483a19a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update_backend_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
major, minor, patch, *dev = pyproject_data["project"]["version"].split(".")
pyproject_data["project"]["version"] = f"{major}.{minor}.{int(patch)+1}"

juliapkg_data["packages"]["SymbolicRegression"]["version"] = f"={new_backend_version}"
juliapkg_data["packages"]["SymbolicRegression"]["rev"] = f"v{new_backend_version}"

with open(pyproject_toml, "w") as toml_file:
toml_file.write(tomlkit.dumps(pyproject_data))
Expand Down
3 changes: 2 additions & 1 deletion pysr/juliapkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"packages": {
"SymbolicRegression": {
"uuid": "8254be44-1295-4e6a-a16d-46603ac705cb",
"version": "=0.24.0"
"url": "https://github.com/MilesCranmer/SymbolicRegression.jl",
"rev": "v0.24.1"
},
"Serialization": {
"uuid": "9e88b42a-f829-5b0c-bbe9-9e923198166b",
Expand Down
8 changes: 5 additions & 3 deletions pysr/test/generate_dev_juliapkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
with open(juliapkg_json, "r") as f:
juliapkg = json.load(f)

del juliapkg["packages"]["SymbolicRegression"]["version"]
juliapkg["packages"]["SymbolicRegression"]["path"] = path_to_srjl
juliapkg["packages"]["SymbolicRegression"]["dev"] = True
juliapkg["packages"]["SymbolicRegression"] = {
"uuid": juliapkg["packages"]["SymbolicRegression"]["uuid"],
"path": path_to_srjl,
"dev": True,
}

with open(juliapkg_json, "w") as f:
json.dump(juliapkg, f, indent=4)
12 changes: 5 additions & 7 deletions pysr/test/test_dev_pysr.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ ADD ./pysr/_cli/*.py /pysr/pysr/_cli/

RUN mkdir /pysr/pysr/test

RUN pip3 install --no-cache-dir .

# Now, we create a custom version of SymbolicRegression.jl
# First, we get the version from juliapkg.json:
RUN python3 -c 'import json; print(json.load(open("/pysr/pysr/juliapkg.json", "r"))["packages"]["SymbolicRegression"]["version"])' > /pysr/sr_version
RUN python3 -c 'import json; print(json.load(open("/pysr/pysr/juliapkg.json", "r"))["packages"]["SymbolicRegression"]["rev"])' > /pysr/sr_version

# Remove any = or ^ or ~ from the version:
RUN cat /pysr/sr_version | sed 's/[\^=~]//g' > /pysr/sr_version_processed
# Remove v from the version:
RUN cat /pysr/sr_version | sed 's/^v//g' > /pysr/sr_version_processed

# Now, we check out the version of SymbolicRegression.jl that PySR is using:
RUN git clone -b "v$(cat /pysr/sr_version_processed)" --single-branch https://github.com/MilesCranmer/SymbolicRegression.jl /srjl
Expand All @@ -53,5 +51,5 @@ RUN sed -i 's/module SymbolicRegression/module SymbolicRegression\n__test_functi
ADD ./pysr/test/generate_dev_juliapkg.py /generate_dev_juliapkg.py
RUN python3 /generate_dev_juliapkg.py /pysr/pysr/juliapkg.json /srjl

# Precompile
RUN python3 -c 'import pysr'
# Install and pre-compile
RUN pip3 install --no-cache-dir . && python3 -c 'import pysr'

0 comments on commit 483a19a

Please sign in to comment.