-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #298 from w2ll2am/master
Added CLI to run pysr.install() to install Julia dependencies
- Loading branch information
Showing
18 changed files
with
134 additions
and
25 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
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
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 |
---|---|---|
|
@@ -9,4 +9,5 @@ dependencies: | |
- setuptools | ||
- pyjulia | ||
- openlibm | ||
- openspecfun | ||
- openspecfun | ||
- click |
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,4 @@ | ||
from pysr._cli.main import pysr as _cli | ||
|
||
if __name__ == "__main__": | ||
_cli(prog_name="pysr") |
Empty file.
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,37 @@ | ||
import click | ||
from ..julia_helpers import install | ||
|
||
|
||
@click.group("pysr") | ||
@click.pass_context | ||
def pysr(context): | ||
ctx = context | ||
|
||
|
||
@pysr.command("install", help="Install Julia dependencies for PySR.") | ||
@click.option( | ||
"-p", | ||
"julia_project", | ||
"--project", | ||
default=None, | ||
type=str, | ||
help="Install in a specific Julia project (e.g., a local copy of SymbolicRegression.jl).", | ||
metavar="PROJECT_DIRECTORY", | ||
) | ||
@click.option("-q", "--quiet", is_flag=True, default=False, help="Disable logging.") | ||
@click.option( | ||
"--precompile", | ||
"precompile", | ||
flag_value=True, | ||
default=None, | ||
help="Force precompilation of Julia libraries.", | ||
) | ||
@click.option( | ||
"--no-precompile", | ||
"precompile", | ||
flag_value=False, | ||
default=None, | ||
help="Disable precompilation.", | ||
) | ||
def _install(julia_project, quiet, precompile): | ||
install(julia_project, quiet, precompile) |
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
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,57 @@ | ||
import unittest | ||
from click import testing as click_testing | ||
from .._cli.main import pysr | ||
|
||
|
||
class TestCli(unittest.TestCase): | ||
# TODO: Include test for custom project here. | ||
def setUp(self): | ||
self.cli_runner = click_testing.CliRunner() | ||
|
||
def test_help_on_all_commands(self): | ||
expected = "\n".join( | ||
[ | ||
"Usage: pysr [OPTIONS] COMMAND [ARGS]...", | ||
"", | ||
"Options:", | ||
" --help Show this message and exit.", | ||
"", | ||
"Commands:", | ||
" install Install Julia dependencies for PySR.", | ||
"", | ||
] | ||
) | ||
result = self.cli_runner.invoke(pysr, ["--help"]) | ||
self.assertEqual(expected, result.output) | ||
self.assertEqual(0, result.exit_code) | ||
|
||
def test_help_on_install(self): | ||
expected = "\n".join( | ||
[ | ||
"Usage: pysr install [OPTIONS]", | ||
"", | ||
" Install Julia dependencies for PySR.", | ||
"", | ||
"Options:", | ||
" -p, --project PROJECT_DIRECTORY", | ||
" Install in a specific Julia project (e.g., a", | ||
" local copy of SymbolicRegression.jl).", | ||
" -q, --quiet Disable logging.", | ||
" --precompile Force precompilation of Julia libraries.", | ||
" --no-precompile Disable precompilation.", | ||
" --help Show this message and exit.", | ||
"", | ||
] | ||
) | ||
result = self.cli_runner.invoke(pysr, ["install", "--help"]) | ||
self.assertEqual(expected, result.output) | ||
self.assertEqual(0, result.exit_code) | ||
|
||
|
||
def runtests(): | ||
"""Run all tests in cliTest.py.""" | ||
loader = unittest.TestLoader() | ||
suite = unittest.TestSuite() | ||
suite.addTests(loader.loadTestsFromTestCase(TestCli)) | ||
runner = unittest.TextTestRunner() | ||
return runner.run(suite) |
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 @@ | ||
__version__ = "0.13.0" | ||
__version__ = "0.14.0" | ||
__symbolic_regression_jl_version__ = "0.18.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
sympy | ||
pandas | ||
numpy | ||
scikit_learn >= 1.0.0 | ||
julia >= 0.6.0 | ||
scikit_learn>=1.0.0 | ||
julia>=0.6.0 | ||
click>=7.0.0 | ||
setuptools>=50.0.0 |