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
Showing
17 changed files
with
434 additions
and
500 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
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,76 @@ | ||
name: CI_conda | ||
# This tests whether conda, a statically-linked libpython, works | ||
# with PySR. | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
paths: | ||
- 'test/**' | ||
- 'pysr/**' | ||
- '.github/workflows/**' | ||
- 'setup.py' | ||
- 'Project.toml' | ||
pull_request: | ||
branches: | ||
- '*' | ||
paths: | ||
- 'test/**' | ||
- 'pysr/**' | ||
- '.github/workflows/**' | ||
- 'setup.py' | ||
- 'Project.toml' | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
julia-version: ['1.7.1'] | ||
python-version: ['3.9'] | ||
os: ['ubuntu-latest'] | ||
|
||
steps: | ||
- uses: actions/checkout@v1.0.0 | ||
- name: "Set up Julia" | ||
uses: julia-actions/setup-julia@v1.6.0 | ||
with: | ||
version: ${{ matrix.julia-version }} | ||
- name: "Change package server" | ||
shell: bash | ||
env: | ||
JULIA_PKG_SERVER: "" | ||
run: | | ||
julia -e 'using Pkg; Pkg.Registry.add("General")' | ||
- name: "Cache dependencies" | ||
uses: actions/cache@v1 # Thanks FromFile.jl | ||
env: | ||
cache-name: cache-artifacts | ||
with: | ||
path: ~/.julia/artifacts | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: "Set up Conda" | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
auto-activate-base: true | ||
python-version: ${{ matrix.python-version }} | ||
activate-environment: test | ||
environment-file: environment.yml | ||
- name: "Install PySR" | ||
run: | | ||
python3 -m pip install . | ||
python3 -c 'import pysr; pysr.install()' | ||
shell: bash -l {0} | ||
- name: "Ensure that static libpython warning appears" | ||
run: python3 test/test_static_libpython_warning.py | ||
shell: bash -l {0} | ||
- name: "Run tests" | ||
run: python3 -m unittest discover -s test | ||
shell: bash -l {0} |
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 |
---|---|---|
|
@@ -12,3 +12,6 @@ dist | |
*.pyproj | ||
*.sln | ||
pysr/.vs/ | ||
pysr.egg-info | ||
Manifest.toml | ||
workflow |
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,30 +1,44 @@ | ||
# This builds a dockerfile containing a working copy of PySR | ||
# with all pre-requisites installed. | ||
|
||
|
||
ARG VERSION=latest | ||
|
||
FROM julia:$VERSION | ||
|
||
RUN apt-get update && apt-get upgrade -y && apt-get install -y \ | ||
build-essential python3 python3-dev python3-pip python3-setuptools \ | ||
vim git wget curl \ | ||
make build-essential libssl-dev zlib1g-dev \ | ||
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ | ||
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \ | ||
vim git \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /pysr | ||
|
||
# Install PyEnv to switch Python to dynamically linked version: | ||
RUN curl https://pyenv.run | bash | ||
ENV PATH="/root/.pyenv/bin:$PATH" | ||
|
||
ENV PYTHON_VERSION="3.9.10" | ||
RUN PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install ${PYTHON_VERSION} | ||
ENV PATH="/root/.pyenv/versions/${PYTHON_VERSION}/bin:$PATH" | ||
|
||
# Install IPython and other useful libraries: | ||
RUN pip install ipython jupyter matplotlib | ||
|
||
# Caches install (https://stackoverflow.com/questions/25305788/how-to-avoid-reinstalling-packages-when-building-docker-image-for-python-project) | ||
ADD ./requirements.txt /pysr/requirements.txt | ||
RUN pip3 install -r /pysr/requirements.txt | ||
|
||
# Install PySR: | ||
ADD . /pysr/ | ||
# We do a minimal copy so it doesn't need to rerun at every file change: | ||
ADD ./setup.py /pysr/setup.py | ||
ADD ./README.md /pysr/README.md | ||
Add ./Project.toml /pysr/Project.toml | ||
ADD ./pysr/ /pysr/pysr/ | ||
RUN pip3 install . | ||
|
||
# Install Julia pre-requisites: | ||
RUN julia -e 'using Pkg; Pkg.add("SymbolicRegression")' | ||
|
||
# Install IPython and other useful libraries: | ||
RUN pip3 install ipython jupyter matplotlib | ||
RUN python3 -c 'import pysr; pysr.install()' | ||
|
||
CMD ["bash"] | ||
CMD ["bash"] |
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: test | ||
channels: | ||
- conda-forge | ||
- defaults | ||
dependencies: | ||
- python=3.9 | ||
- sympy | ||
- pandas | ||
- numpy | ||
- scikit-learn | ||
- setuptools | ||
- pip | ||
- pip: | ||
- julia |
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,4 +1,13 @@ | ||
from .sr import pysr, get_hof, best, best_tex, best_callable, best_row | ||
from .sr import ( | ||
pysr, | ||
get_hof, | ||
best, | ||
best_tex, | ||
best_callable, | ||
best_row, | ||
install, | ||
silence_julia_warning, | ||
) | ||
from .feynman_problems import Problem, FeynmanProblem | ||
from .export_jax import sympy2jax | ||
from .export_torch import sympy2torch |
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
Oops, something went wrong.