pax_global_header 0000666 0000000 0000000 00000000064 14713323143 0014513 g ustar 00root root 0000000 0000000 52 comment=f8e1e6d9b2fedd975ff1f217acab17cf0e0a56df optuna-4.1.0/ 0000775 0000000 0000000 00000000000 14713323143 0013023 5 ustar 00root root 0000000 0000000 optuna-4.1.0/.coveragerc 0000664 0000000 0000000 00000000074 14713323143 0015145 0 ustar 00root root 0000000 0000000 [run] concurrency = multiprocessing,thread source = optuna/ optuna-4.1.0/.dockerignore 0000664 0000000 0000000 00000000113 14713323143 0015472 0 ustar 00root root 0000000 0000000 # Ignore everything ** !pyproject.toml !README.md !optuna **/__pycache__ optuna-4.1.0/.github/ 0000775 0000000 0000000 00000000000 14713323143 0014363 5 ustar 00root root 0000000 0000000 optuna-4.1.0/.github/FUNDING.yml 0000664 0000000 0000000 00000000017 14713323143 0016176 0 ustar 00root root 0000000 0000000 github: optuna optuna-4.1.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14713323143 0016546 5 ustar 00root root 0000000 0000000 optuna-4.1.0/.github/ISSUE_TEMPLATE/bug-report.yml 0000664 0000000 0000000 00000004146 14713323143 0021364 0 ustar 00root root 0000000 0000000 name: "\U0001F41BBug report" description: Create a report to help us improve Optuna. labels: ["bug"] body: - type: markdown attributes: value: | Thanks for taking the time to fill out this bug report! Please write a clear and concise description of what the bug is. - type: textarea id: expected-behavior attributes: label: Expected behavior description: Please write a clear and concise description of what you expected to happen. validations: required: true - type: textarea id: environment attributes: label: Environment description: | Please give us your environment information. You can get this information by typing the following. ``` python3 -c 'import optuna; print(f"- Optuna version:{optuna.__version__}")' python3 -c 'import platform; print(f"- Python version:{platform.python_version()}")' python3 -c 'import platform; print(f"- OS:{platform.platform()}")' ``` value: | - Optuna version: - Python version: - OS: - (Optional) Other libraries and their versions: validations: required: true - type: textarea id: logs attributes: label: Error messages, stack traces, or logs description: Please copy and paste any relevant error messages, stack traces, or log output. render: shell validations: required: true - type: textarea id: steps-to-reproduce attributes: label: Steps to reproduce description: Please provide how we reproduce your reported bugs. If possible, it is highly recommended to provide the reproducible example codes. Note that pickle files will not be accepted due to possible [security issues](https://docs.python.org/3/library/pickle.html). value: | 1. 2. 3. ```python # python code ``` validations: required: true - type: textarea id: additional-context attributes: label: Additional context (optional) description: Please provide additional contexts if you have. validations: required: false optuna-4.1.0/.github/ISSUE_TEMPLATE/code-fix.yml 0000664 0000000 0000000 00000002016 14713323143 0020766 0 ustar 00root root 0000000 0000000 name: "\U0001F6A7Code fix" description: Suggest a code fix that does not change the behaviors of Optuna, such as code refactoring. labels: ["code-fix"] body: - type: markdown attributes: value: | Thanks for taking the time to raise a new issue! Please write a clear and concise description of the code fix. - type: textarea id: motivation attributes: label: Motivation description: | Please write the motivation for the proposal. If your code fix is related to a problem, please describe a clear and concise description of what the problem is. validations: required: true - type: textarea id: suggestion attributes: label: Suggestion description: Please explain your suggestion for the code change. validations: required: true - type: textarea id: additional-context attributes: label: Additional context (optional) description: Please provide additional contexts if you have. validations: required: false optuna-4.1.0/.github/ISSUE_TEMPLATE/config.yml 0000664 0000000 0000000 00000000034 14713323143 0020533 0 ustar 00root root 0000000 0000000 blank_issues_enabled: false optuna-4.1.0/.github/ISSUE_TEMPLATE/documentation.yml 0000664 0000000 0000000 00000000651 14713323143 0022144 0 ustar 00root root 0000000 0000000 name: "\U0001f4d6Documentation" description: Report an issue related to https://optuna.readthedocs.io/. labels: ["document"] body: - type: textarea id: explanation attributes: label: What is an issue? description: Thanks for taking time to raise an issue! Please write a clear and concise description of what content in https://optuna.readthedocs.io/ is an issue. validations: required: true optuna-4.1.0/.github/ISSUE_TEMPLATE/feature-request.yml 0000664 0000000 0000000 00000002414 14713323143 0022413 0 ustar 00root root 0000000 0000000 name: "\U0001F4A1Feature request" description: Suggest an idea for Optuna. labels: ["feature"] body: - type: markdown attributes: value: | Thanks for taking the time for your feature requests! Please write a clear and concise description of the feature proposal. - type: textarea id: motivation attributes: label: Motivation description: | Please write the motivation for the proposal. If your feature request is related to a problem, please describe a clear and concise description of what the problem is. validations: required: true - type: textarea id: description attributes: label: Description description: Please write a detailed description of the new feature. validations: required: true - type: textarea id: alternatives attributes: label: Alternatives (optional) description: Please write a clear and concise description of any alternative solutions or features you've considered. validations: required: false - type: textarea id: additional-context attributes: label: Additional context (optional) description: Please add any other context or screenshots about the feature request here. validations: required: false optuna-4.1.0/.github/ISSUE_TEMPLATE/questions-help-support.yml 0000664 0000000 0000000 00000000675 14713323143 0023773 0 ustar 00root root 0000000 0000000 name: "\U00002753Questions" description: Don't use GitHub Issues to ask support questions. body: - type: markdown attributes: value: | # PLEASE USE GITHUB DISCUSSIONS Don't use GitHub Issues to ask support questions. Use the [GitHub Discussions](https://github.com/optuna/optuna/discussions/categories/q-a) for that. - type: textarea attributes: label: "Don't use GitHub Issues to ask support questions." optuna-4.1.0/.github/PULL_REQUEST_TEMPLATE.md 0000664 0000000 0000000 00000001221 14713323143 0020160 0 ustar 00root root 0000000 0000000 ## Motivation ## Description of the changes optuna-4.1.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14713323143 0016420 5 ustar 00root root 0000000 0000000 optuna-4.1.0/.github/workflows/checks.yml 0000664 0000000 0000000 00000002100 14713323143 0020374 0 ustar 00root root 0000000 0000000 name: Checks on: push: branches: - master pull_request: {} schedule: - cron: '0 23 * * SUN-THU' concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: checks: if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.12 - name: Install run: | python -m pip install -U pip pip install --progress-bar off -U .[checking] - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: black run: black . --check --diff - name: flake8 run: flake8 . - name: isort run: isort . --check --diff - name: mypy run: mypy . - name: blackdoc run: blackdoc . --check --diff optuna-4.1.0/.github/workflows/coverage.yml 0000664 0000000 0000000 00000004471 14713323143 0020744 0 ustar 00root root 0000000 0000000 name: Coverage on: push: branches: - master pull_request: {} concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: coverage: runs-on: ubuntu-latest # Not intended for forks. if: github.repository == 'optuna/optuna' steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python 3.12 uses: actions/setup-python@v5 with: python-version: 3.12 - name: Setup cache uses: actions/cache@v3 env: cache-name: coverage with: path: ~/.cache/pip key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 restore-keys: | ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} - name: Setup environment run: | sudo apt-get update sudo apt-get -y install openmpi-bin libopenmpi-dev libopenblas-dev - name: Install run: | python -m pip install --upgrade pip # Install minimal dependencies and confirm that `import optuna` is successful. pip install --progress-bar off . python -c 'import optuna' optuna --version pip install --progress-bar off .[test] --extra-index-url https://download.pytorch.org/whl/cpu pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu echo 'import coverage; coverage.process_startup()' > sitecustomize.py - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Tests env: OMP_NUM_THREADS: 1 PYTHONPATH: . # To invoke sitecutomize.py COVERAGE_PROCESS_START: .coveragerc # https://coverage.readthedocs.io/en/6.4.1/subprocess.html COVERAGE_COVERAGE: yes # https://github.com/nedbat/coveragepy/blob/65bf33fc03209ffb01bbbc0d900017614645ee7a/coverage/control.py#L255-L261 run: | coverage run --source=optuna -m pytest tests -m "not skip_coverage and not slow" coverage combine coverage xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: file: ./coverage.xml optuna-4.1.0/.github/workflows/dockerimage.yml 0000664 0000000 0000000 00000004531 14713323143 0021420 0 ustar 00root root 0000000 0000000 name: Build Docker Image on: push: branches: - master release: types: [published] pull_request: paths: - .github/workflows/dockerimage.yml - Dockerfile - .dockerignore - pyproject.toml - .github/workflows/dockerimage.yml concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true env: DOCKER_HUB_BASE_NAME: optuna/optuna jobs: dockerimage: runs-on: ubuntu-latest strategy: matrix: python_version: ['3.8', '3.9', '3.10', '3.11'] build_type: ['', 'dev'] # "dev" installs all the dependencies including pytest. # This action cannot be executed in the forked repository. if: github.repository == 'optuna/optuna' steps: - uses: actions/checkout@v4 - name: Set ENV run: | export TAG_NAME="py${{ matrix.python_version }}" if [ "${{ github.event_name }}" = 'release' ]; then export TAG_NAME="${{ github.event.release.tag_name }}-${TAG_NAME}" fi if [ "${{matrix.build_type}}" = 'dev' ]; then export TAG_NAME="${TAG_NAME}-dev" fi echo "HUB_TAG=${DOCKER_HUB_BASE_NAME}:${TAG_NAME}" >> $GITHUB_ENV - name: Build the Docker image run: | if [ "${{ github.event_name }}" = 'release' ]; then # Cache is not available because the image tag includes the Optuna version. CACHE_FROM="" else CACHE_FROM="--cache-from=${HUB_TAG}" fi docker build ${CACHE_FROM} . --build-arg PYTHON_VERSION=${{ matrix.python_version }} --build-arg BUILD_TYPE=${{ matrix.build_type }} --file Dockerfile --tag "${HUB_TAG}" env: DOCKER_BUILDKIT: 1 - name: Output installed packages run: | docker run "${HUB_TAG}" sh -c "pip freeze --all" - name: Output dependency tree run: | docker run "${HUB_TAG}" sh -c "pip install pipdeptree && pipdeptree" - name: Verify the built image run: | docker run "${HUB_TAG}" optuna --version - name: Login & Push to Docker Hub if: ${{ github.event_name != 'pull_request' }} env: DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} run: | echo "${DOCKER_HUB_TOKEN}" | docker login -u optunabot --password-stdin docker push "${HUB_TAG}" optuna-4.1.0/.github/workflows/mac-tests.yml 0000664 0000000 0000000 00000004231 14713323143 0021043 0 ustar 00root root 0000000 0000000 # Run tests on Mac, which are triggered by each master push. # Currently, Python3.12 is only used as an environment. # This is mainly for the sake of speed. name: Mac tests on: push: branches: - master pull_request: {} schedule: - cron: '0 23 * * SUN-THU' workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: tests-mac: runs-on: macos-latest # Scheduled Tests are disabled for forks. if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python 3.12 uses: actions/setup-python@v5 with: python-version: 3.12 - name: Setup cache uses: actions/cache@v3 env: cache-name: test with: path: ~/Library/Caches/pip key: ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 restore-keys: | ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} - name: Install run: | python -m pip install --upgrade pip pip install --progress-bar off -U setuptools # Install minimal dependencies and confirm that `import optuna` is successful. pip install --progress-bar off . python -c 'import optuna' optuna --version pip install --progress-bar off .[test] --extra-index-url https://download.pytorch.org/whl/cpu pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Scheduled tests if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} run: | pytest tests - name: Tests if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} run: | pytest tests -m "not slow" optuna-4.1.0/.github/workflows/matplotlib-tests.yml 0000664 0000000 0000000 00000003722 14713323143 0022456 0 ustar 00root root 0000000 0000000 name: matplotlib-tests on: pull_request: paths: - .github/workflows/matplotlib-tests.yml - optuna/visualization/**.py - tests/visualization_tests/** concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: matplotlib-tests: runs-on: ubuntu-latest # Scheduled Tests are disabled for forks. if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python 3.12 uses: actions/setup-python@v5 with: python-version: 3.12 - name: Setup cache uses: actions/cache@v3 env: cache-name: test-matplotlib with: path: ~/.cache/pip key: ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 restore-keys: | ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} - name: Install run: | python -m pip install --upgrade pip pip install --progress-bar off -U setuptools # Install minimal dependencies and confirm that `import optuna` is successful. pip install --progress-bar off . python -c 'import optuna' optuna --version pip install --progress-bar off .[test] --extra-index-url https://download.pytorch.org/whl/cpu pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Tests without Plotly if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} run: | pip uninstall -y plotly pytest tests/visualization_tests/matplotlib_tests optuna-4.1.0/.github/workflows/pypi-publish.yml 0000664 0000000 0000000 00000003567 14713323143 0021603 0 ustar 00root root 0000000 0000000 name: Publish distributions to PyPI or TestPyPI # TestPyPI upload is scheduled in each weekday. # PyPI upload is only activated if the release is published. on: schedule: - cron: '0 15 * * *' release: types: - published jobs: build-n-publish: name: Build and publish Python distributions to PyPI or TestPyPI runs-on: ubuntu-latest permissions: id-token: write # Not intended for forks. if: github.repository == 'optuna/optuna' steps: - uses: actions/checkout@v4 - name: Set up Python 3.12 uses: actions/setup-python@v5 with: python-version: 3.12 - name: Install twine run: | python -m pip install -U pip python -m pip install -U twine wheel build - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Change the version file for scheduled TestPyPI upload if: github.event_name == 'schedule' run: | OPTUNA_VERSION=$(cut -d '"' -f 2 optuna/version.py) DATE=`date +"%Y%m%d"` echo "__version__ = \"${OPTUNA_VERSION}${DATE}\"" > optuna/version.py - name: Build a tar ball run: | python -m build --sdist --wheel - name: Verify the distributions run: twine check dist/* - name: Publish distribution to TestPyPI # The following upload action cannot be executed in the forked repository. if: (github.event_name == 'schedule') || (github.event_name == 'release') uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ - name: Publish distribution to PyPI # The following upload action cannot be executed in the forked repository. if: github.event_name == 'release' uses: pypa/gh-action-pypi-publish@release/v1 optuna-4.1.0/.github/workflows/reviewdog.yml 0000664 0000000 0000000 00000001533 14713323143 0021140 0 ustar 00root root 0000000 0000000 name: Reviewdog on: pull_request: types: [opened, review_requested] jobs: reviewdog: runs-on: ubuntu-latest if: github.event.action == 'opened' || github.event.requested_team.name == 'reviewdog' steps: - name: Checkout uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.12 - name: Install run: | python -m pip install -U pip pip install --progress-bar off -U .[checking] - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Apply formatters run: | black . blackdoc . isort . - name: Reviewdog uses: reviewdog/action-suggester@v1 with: tool_name: formatters optuna-4.1.0/.github/workflows/speed-benchmarks.yml 0000664 0000000 0000000 00000002610 14713323143 0022355 0 ustar 00root root 0000000 0000000 name: Speed benchmarks on: schedule: - cron: '0 23 * * SUN-THU' jobs: speed-benchmarks: runs-on: ubuntu-latest # Not intended for forks. if: github.repository == 'optuna/optuna' steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python 3.12 uses: actions/setup-python@v5 with: python-version: 3.12 - name: Setup cache uses: actions/cache@v3 env: cache-name: speed-benchmarks with: path: ~/.cache/pip key: ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 restore-keys: | ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} - name: Install run: | python -m pip install --upgrade pip pip install --progress-bar off -U setuptools # Install minimal dependencies and confirm that `import optuna` is successful. pip install --progress-bar off . python -c 'import optuna' optuna --version pip install --progress-bar off .[benchmark] --extra-index-url https://download.pytorch.org/whl/cpu asv machine --yes - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Speed benchmarks run: | asv run optuna-4.1.0/.github/workflows/sphinx-build.yml 0000664 0000000 0000000 00000005056 14713323143 0021557 0 ustar 00root root 0000000 0000000 name: Sphinx on: push: branches: - master pull_request: {} concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: documentation: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # TODO(c-bata): Use the newer Python version - uses: actions/setup-python@v5 with: python-version: 3.8 # note (crcrpar): We've not updated tutorial frequently enough so far thus # it'd be okay to discard cache by any small changes including typo fix under tutorial directory. - name: Sphinx Gallery Cache uses: actions/cache@v3 env: cache-name: sphx-glry-documentation with: path: | tutorial/MNIST docs/source/tutorial key: py3.8-${{ env.cache-name }}-${{ hashFiles('tutorial/**/*') }} - name: Install Dependencies run: | sudo apt-get install optipng python -m pip install -U pip pip install --progress-bar off -U .[document] --extra-index-url https://download.pytorch.org/whl/cpu - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Build Document run: | cd docs make html cd ../ - uses: actions/upload-artifact@v4 with: name: built-html path: | docs/build/html - uses: actions/upload-artifact@v4 with: name: tutorial path: | docs/source/tutorial doctest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # TODO(c-bata): Use the newer Python version - uses: actions/setup-python@v5 with: python-version: 3.8 - name: Sphinx Gallery Cache uses: actions/cache@v3 env: cache-name: sphx-glry-doctest with: path: | tutorial/MNIST docs/source/tutorial key: py3.8-${{ env.cache-name }}-${{ hashFiles('tutorial/**/*') }} - name: Install Dependencies run: | sudo apt-get install optipng python -m pip install -U pip pip install --progress-bar off -U .[document] --extra-index-url https://download.pytorch.org/whl/cpu - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Run Doctest run: | cd docs make doctest optuna-4.1.0/.github/workflows/stale.yml 0000664 0000000 0000000 00000002036 14713323143 0020254 0 ustar 00root root 0000000 0000000 name: Stale on: schedule: - cron: '0 23 * * SUN-THU' jobs: stale: runs-on: ubuntu-latest if: github.repository == 'optuna/optuna' steps: - uses: actions/stale@v6 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue has not seen any recent activity.' stale-pr-message: 'This pull request has not seen any recent activity.' close-issue-message: 'This issue was closed automatically because it had not seen any recent activity. If you want to discuss it, you can reopen it freely.' close-pr-message: 'This pull request was closed automatically because it had not seen any recent activity. If you want to discuss it, you can reopen it freely.' days-before-issue-stale: 300 days-before-issue-close: 0 days-before-pr-stale: 7 days-before-pr-close: 14 stale-issue-label: 'stale' stale-pr-label: 'stale' exempt-issue-labels: 'no-stale' exempt-pr-labels: 'no-stale' operations-per-run: 1000 optuna-4.1.0/.github/workflows/tests-storage.yml 0000664 0000000 0000000 00000010370 14713323143 0021750 0 ustar 00root root 0000000 0000000 name: Tests (Storage with server) on: workflow_dispatch: push: branches: - master pull_request: {} schedule: - cron: '0 23 * * SUN-THU' concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: # TODO(masap): Modify job name to "tests-storage-with-server" because this test is not only for # RDB. Since current name "tests-rdbstorage" is required in the Branch protection rules, you # need to modify the Branch protection rules as well. tests-rdbstorage: if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') runs-on: ubuntu-latest strategy: matrix: python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] test-trigger-type: - ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && 'Scheduled' || '' }} exclude: - test-trigger-type: "" python-version: "3.9" - test-trigger-type: "" python-version: "3.10" - test-trigger-type: "" python-version: "3.11" - test-trigger-type: "" python-version: "3.12" services: mysql: image: mysql:8 ports: - 3306:3306 env: MYSQL_ROOT_PASSWORD: mandatory_arguments MYSQL_DATABASE: optunatest MYSQL_USER: user MYSQL_PASSWORD: test options: >- --health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5 postgres: image: postgres:latest ports: - 5432:5432 env: POSTGRES_DB: optunatest POSTGRES_USER: user POSTGRES_PASSWORD: test options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 redis: image: redis ports: - 6379:6379 steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Setup cache uses: actions/cache@v3 env: cache-name: test-storage-with-server with: path: ~/.cache/pip key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 restore-keys: | ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} - name: Setup environment run: | sudo apt-get update sudo apt-get -y install openmpi-bin libopenmpi-dev - name: Install run: | python -m pip install --upgrade pip pip install --progress-bar off -U setuptools # Install minimal dependencies and confirm that `import optuna` is successful. pip install --progress-bar off . python -c 'import optuna' optuna --version pip install --progress-bar off .[test] --extra-index-url https://download.pytorch.org/whl/cpu pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu - name: Install DB bindings run: | pip install --progress-bar off PyMySQL cryptography psycopg2-binary redis - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Tests MySQL run: | pytest tests/storages_tests/test_with_server.py env: SQLALCHEMY_WARN_20: 1 OMP_NUM_THREADS: 1 TEST_DB_URL: mysql+pymysql://user:test@127.0.0.1/optunatest - name: Tests PostgreSQL run: | pytest tests/storages_tests/test_with_server.py env: OMP_NUM_THREADS: 1 TEST_DB_URL: postgresql+psycopg2://user:test@127.0.0.1/optunatest - name: Tests Journal Redis run: | pytest tests/storages_tests/test_with_server.py env: OMP_NUM_THREADS: 1 TEST_DB_URL: redis://localhost:6379 TEST_DB_MODE: journal-redis optuna-4.1.0/.github/workflows/tests-with-minimum-versions.yml 0000664 0000000 0000000 00000006206 14713323143 0024601 0 ustar 00root root 0000000 0000000 name: Tests with minimum versions on: push: branches: - master pull_request: {} schedule: - cron: '0 23 * * SUN-THU' workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: tests-with-minimum-versions: if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') runs-on: ubuntu-latest strategy: matrix: python-version: ['3.8', '3.9'] services: redis: image: redis options: >- --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Setup cache uses: actions/cache@v3 env: cache-name: test-with-minimum-versions with: path: ~/.cache/pip key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/setup.py') }}-v1 restore-keys: | ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/setup.py') }} - name: Setup pip run: | python -m pip install --upgrade pip pip install --progress-bar off -U setuptools - name: Install run: | # Install minimal dependencies and confirm that `import optuna` is successful. pip install --progress-bar off . python -c 'import optuna' optuna --version pip install --progress-bar off .[test] --extra-index-url https://download.pytorch.org/whl/cpu pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu - name: Install dependencies with minimum versions run: | # Install dependencies with minimum versions. pip uninstall -y alembic cmaes packaging sqlalchemy plotly scikit-learn pillow pip install alembic==1.5.0 cmaes==0.10.0 packaging==20.0 sqlalchemy==1.4.2 tqdm==4.27.0 colorlog==0.3 PyYAML==5.1 'pillow<10.4.0' pip uninstall -y matplotlib pandas scipy if [ "${{ matrix.python-version }}" = "3.8" ]; then pip install matplotlib==3.7.5 pandas==2.0.3 scipy==1.10.1 numpy==1.20.3 elif [ "${{ matrix.python-version }}" = "3.9" ]; then pip install matplotlib==3.8.4 pandas==2.2.2 scipy==1.13.0 numpy==1.26.4 fi pip install plotly==5.0.0 scikit-learn==0.24.2 # optional extras - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Scheduled tests if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} run: | pytest tests - name: Tests if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} run: | pytest tests -m "not slow" optuna-4.1.0/.github/workflows/tests.yml 0000664 0000000 0000000 00000005705 14713323143 0020314 0 ustar 00root root 0000000 0000000 name: Tests on: push: branches: - master pull_request: {} schedule: - cron: '0 23 * * SUN-THU' workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: tests: if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') runs-on: ubuntu-latest strategy: matrix: python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] test-trigger-type: - ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && 'Scheduled' || '' }} exclude: - test-trigger-type: "" python-version: "3.9" - test-trigger-type: "" python-version: "3.10" - test-trigger-type: "" python-version: "3.11" services: redis: image: redis options: >- --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Setup cache uses: actions/cache@v3 env: cache-name: test with: path: ~/.cache/pip key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 restore-keys: | ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} - name: Setup pip run: | python -m pip install --upgrade pip pip install --progress-bar off -U setuptools - name: Install run: | # Install minimal dependencies and confirm that `import optuna` is successful. pip install --progress-bar off . python -c 'import optuna' optuna --version pip install --progress-bar off .[test] --extra-index-url https://download.pytorch.org/whl/cpu pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu # TODO(gen740): Remove this after pytorch supports Python 3.13 if [ "${{ matrix.python-version }}" = "3.13" ] ; then pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu fi - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Tests run: | if [ "${{ github.event_name }}" = "schedule" ] || \ [ "${{ github.event_name }}" = "workflow_dispatch" ] ; then target="" else target="not slow" fi pytest tests -m "$target" env: SQLALCHEMY_WARN_20: 1 optuna-4.1.0/.github/workflows/windows-tests.yml 0000664 0000000 0000000 00000005343 14713323143 0022002 0 ustar 00root root 0000000 0000000 # Run tests on Windows, which are triggered by each master push. # Currently, Python3.12 is only used as an environment. # This is mainly for the sake of speed. name: Windows tests on: push: branches: - master pull_request: {} schedule: - cron: '0 23 * * SUN-THU' workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} cancel-in-progress: true jobs: tests-windows: runs-on: windows-latest # Not intended for forks. if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python 3.12 uses: actions/setup-python@v5 with: python-version: "3.12" - name: Setup cache uses: actions/cache@v3 env: cache-name: windows-test with: path: ~\\AppData\\Local\\pip\\Cache key: ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 restore-keys: | ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} - name: Install run: | python -m pip install --upgrade pip pip install --progress-bar off -U setuptools # Install minimal dependencies and confirm that `import optuna` is successful. pip install --progress-bar off . python -c 'import optuna' optuna --version pip install --progress-bar off .[test] --extra-index-url https://download.pytorch.org/whl/cpu pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu pip install PyQt6 # Install PyQT for using QtAgg as matplotlib backend. # TODO(HideakiImamura): Remove this after fixing https://github.com/plotly/Kaleido/issues/110 pip install "kaleido<=0.1.0post1" # TODO(nabe): Remove the version constraint once Torch supports NumPy v2.0.0 for Windows. pip uninstall numpy pip install --progress-bar off 'numpy<2.0.0' - name: Output installed packages run: | pip freeze --all - name: Output dependency tree run: | pip install pipdeptree pipdeptree - name: Scheduled tests if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} run: | pytest env: SQLALCHEMY_WARN_20: 1 MPLBACKEND: "QtAgg" # Use QtAgg as matplotlib backend. - name: Tests if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} run: | pytest -m "not slow" env: MPLBACKEND: "QtAgg" # Use QtAgg as matplotlib backend. optuna-4.1.0/.gitignore 0000664 0000000 0000000 00000003563 14713323143 0015022 0 ustar 00root root 0000000 0000000 # macOS metadata .DS_Store # Ignore files that examples create t10k-images-idx3-ubyte* t10k-labels-idx1-ubyte* train-images-idx3-ubyte* train-labels-idx1-ubyte* training.pt test.pt catboost_info/ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *,cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log !tests/storages_tests/journal_tests/assets/*.log local_settings.py # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # PyBuilder target/ # IPython Notebook .ipynb_checkpoints # pyenv .python-version # celery beat schedule file celerybeat-schedule # dotenv .env # virtualenv .venv/ venv/ ENV/ # Spyder project settings .spyderproject # Rope project settings .ropeproject # PyCharm .idea # VSCode .vscode .devcontainer # MyPy .mypy_cache # Sphinx tutorial/**/example.db tutorial/**/example-study.db tutorial/20_recipes/artifacts/ tutorial/20_recipes/best_atoms.png tutorial/20_recipes/tmp/ docs/_build/ docs/source/reference/generated/ docs/source/reference/multi_objective/generated/ docs/source/reference/visualization/generated/ docs/source/reference/visualization/matplotlib/generated/ docs/source/reference/samplers/generated docs/source/sg_execution_times.rst docs/source/tutorial/** !docs/source/tutorial/index.rst # asv .asv # Dask dask-worker-space/ # PyTorch Lightning lightning_logs/ optuna-4.1.0/.pre-commit-config.yaml 0000664 0000000 0000000 00000003025 14713323143 0017304 0 ustar 00root root 0000000 0000000 # pre-commit package installation is necessary to use pre-commit. # $ pip install pre-commit # $ pre-commit install default_language_version: python: python3 repos: # Args are based on setup.cfg. - repo: https://github.com/psf/black rev: 24.8.0 hooks: - id: black - repo: https://github.com/pycqa/flake8 rev: 7.1.1 hooks: - id: flake8 exclude: tutorial|docs/visualization_examples|docs/visualization_matplotlib_examples args: [ "--max-line-length=99", "--ignore=E203,E704,W503", "--statistics", ] - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.11.2 hooks: - id: mypy additional_dependencies: [ "alembic>=1.5.0", "colorlog", "numpy", "packaging>=20.0", "sqlalchemy>=1.3.0", "tqdm", "PyYAML", "mypy_boto3_s3", "types-PyYAML", "types-redis", "types-setuptools", "types-tqdm", "typing_extensions>=3.10.0.0", ] exclude: docs|tutorial|optuna/storages/_rdb/alembic args: [ --warn-unused-configs, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs, --no-implicit-optional, --warn-redundant-casts, --strict-equality, --extra-checks, --no-implicit-reexport, --ignore-missing-imports, ] optuna-4.1.0/.readthedocs.yml 0000664 0000000 0000000 00000001413 14713323143 0016110 0 ustar 00root root 0000000 0000000 # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 # Set the version of Python and other tools you might need build: os: ubuntu-22.04 tools: python: "3.11" # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/source/conf.py # Optionally build your docs in additional formats such as PDF and ePub formats: all # Optionally set the version of Python and requirements required to build your docs python: # `sphinx` requires either Python >= 3.8 or `typed-ast` to reflect type comments # in the documentation. See: https://github.com/sphinx-doc/sphinx/pull/6984 install: - method: pip path: . extra_requirements: - document optuna-4.1.0/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000000465 14713323143 0015627 0 ustar 00root root 0000000 0000000 # Optuna Code of Conduct Optuna follows the [NumFOCUS Code of Conduct][homepage] available at https://numfocus.org/code-of-conduct. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at optuna@preferred.jp. [homepage]: https://numfocus.org/ optuna-4.1.0/CONTRIBUTING.md 0000664 0000000 0000000 00000026761 14713323143 0015270 0 ustar 00root root 0000000 0000000 # Contribution Guidelines It’s an honor to have you on board! We are proud of this project and have been working to make it great since day one. We believe you will love it, and we know there’s room for improvement. We want to - implement features that make what you want to do possible and/or easy. - write more tutorials and [examples](https://github.com/optuna/optuna-examples) that help you get familiar with Optuna. - make issues and pull requests on GitHub fruitful. - have more conversations and discussions on [GitHub Discussions](https://github.com/optuna/optuna/discussions). We need your help and everything about Optuna you have in your mind pushes this project forward. Join Us! If you feel like giving a hand, here are some ways: - Implement a feature - If you have some cool idea, please open an issue first to discuss design to make your idea in a better shape. - We also welcome PRs for [optunahub-registry](https://github.com/optuna/optunahub-registry). [OptunaHub](https://hub.optuna.org/) is a feature-sharing platform for Optuna. - Send a patch - Dirty your hands by tackling [issues with `contribution-welcome` label](https://github.com/optuna/optuna/issues?q=is%3Aissue+is%3Aopen+label%3Acontribution-welcome) - Report a bug - If you find a bug, please report it! Your reports are important. - Fix/Improve documentation - Documentation gets outdated easily and can always be better, so feel free to fix and improve - Let us and the Optuna community know your ideas and thoughts. - __Contribution to Optuna includes not only sending pull requests, but also writing down your comments on issues and pull requests by others, and joining conversations/discussions on [GitHub Discussions](https://github.com/optuna/optuna/discussions).__ - Also, sharing how you enjoy Optuna is a huge contribution! If you write a blog, let us know about it! ## Pull Request Guidelines If you make a pull request, please follow the guidelines below: - [Setup Optuna](#setup-optuna) - [Checking the Format, Coding Style, and Type Hints](#checking-the-format-coding-style-and-type-hints) - [Documentation](#documentation) - [Unit Tests](#unit-tests) - [Continuous Integration and Local Verification](#continuous-integration-and-local-verification) - [Creating a Pull Request](#creating-a-pull-request) Detailed conventions and policies to write, test, and maintain Optuna code are described in the [Optuna Wiki](https://github.com/optuna/optuna/wiki). - [Coding Style Conventions](https://github.com/optuna/optuna/wiki/Coding-Style-Conventions) - [Deprecation Policy](https://github.com/optuna/optuna/wiki/Deprecation-policy) - [Test Policy](https://github.com/optuna/optuna/wiki/Test-Policy) ### Setup Optuna First of all, fork Optuna on GitHub. You can learn about fork in the official [documentation](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo). After forking, download and install Optuna on your computer. ```bash git clone git@github.com:YOUR_NAME/optuna.git cd optuna pip install -e . ``` ### Checking the Format, Coding Style, and Type Hints Code is formatted with [black](https://github.com/psf/black), and docstrings are formatted with [blackdoc](https://github.com/keewis/blackdoc). Coding style is checked with [flake8](http://flake8.pycqa.org) and [isort](https://pycqa.github.io/isort/), and additional conventions are described in the [Wiki](https://github.com/optuna/optuna/wiki/Coding-Style-Conventions). Type hints, [PEP484](https://www.python.org/dev/peps/pep-0484/), are checked with [mypy](http://mypy-lang.org/). You can check the format, coding style, and type hints at the same time just by executing a script `formats.sh`. If your environment is missing some dependencies such as black, blackdoc, flake8, isort or mypy, you will be asked to install them. The following commands automatically fix format errors by auto-formatters. ```bash # Install auto-formatters. $ pip install ".[checking]" $ ./formats.sh ``` You can use `pre-commit` to automatically check the format, coding style, and type hints before committing. The following commands automatically fix format errors by auto-formatters. ```bash # Install `pre-commit`. $ pip install pre-commit $ pre-commit install $ pre-commit run --all-files ``` ### Documentation When adding a new feature to the framework, you also need to document it in the reference. The documentation source is stored under the [docs](./docs) directory and written in [reStructuredText format](http://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html). To build the documentation, you need to run: ```bash pip install -e ".[document]" ``` Note that the above command might try to install PyTorch without CUDA to your environment even if your environment has CUDA version already. Then you can build the documentation in HTML format locally: ```bash cd docs make html ``` HTML files are generated under `build/html` directory. Open `index.html` with the browser and see if it is rendered as expected. Optuna's tutorial is built with [Sphinx-Gallery](https://sphinx-gallery.github.io/stable/index.html) and some other requirements like [LightGBM](https://github.com/microsoft/LightGBM) and [PyTorch](https://pytorch.org) meaning that all .py files in `tutorial` directory are run during the documentation build if there's no build cache. Whether you edit any tutorial or not doesn't matter. To avoid having to run the tutorials, you may download executed tutorial artifacts named "tutorial" from our CI (see the capture below) and put them in `docs/build` before extracting the files in the zip to `docs/source/tutorial` directory. Note that the CI runs with Python 3.8 and the generated artifacts contain pickle files. The pickle files are serialized with [the protocol version 5](https://docs.python.org/3/library/pickle.html#data-stream-format) so you will see the error with Python 3.7 or older. Please use Python 3.8 or later if you build the documentation with artifacts.  **Writing a Tutorial** Tutorials are part of Optuna’s documentation. Optuna depends on Sphinx to build the documentation HTML files from the corresponding reStructuredText (`.rst`) files in the docs/source directory, but as you may notice, [Tutorial directory](https://github.com/optuna/optuna/tree/master/tutorial) does not have any `.rst` files. Instead, it has a bunch of Python (`.py`) files. We have [Sphinx Gallery](https://sphinx-gallery.github.io/stable/index.html) that executes those `.py` files and generates `.rst` files with standard outputs from them and corresponding Jupyter Notebook (`.ipynb`) files. These generated `.rst` and `.ipynb` files are written to the docs/source/tutorial directory. The output directory (docs/source/tutorial) and source (tutorial) directory are configured in [`sphinx_gallery_conf` of docs/source/conf.py](https://github.com/optuna/optuna/blob/2e14273cab87f13edeb9d804a43bd63c44703cb5/docs/source/conf.py#L189-L199). These generated `.rst` files are handled by Sphinx like the other `.rst` files. The generated `.ipynb` files are hosted on Optuna’s documentation page and downloadable (check [Optuna tutorial](https://optuna.readthedocs.io/en/stable/tutorial/index.html)). The order of contents on [tutorial top page](https://optuna.readthedocs.io/en/stable/tutorial/index.html) is determined by two keys: one is the subdirectory name of tutorial and the other is the filename (note that there are some alternatives as documented in [Sphinx Gallery - sorting](https://sphinx-gallery.github.io/stable/gen_modules/sphinx_gallery.sorting.html?highlight=filenamesortkey), but we chose this key in https://github.com/optuna/optuna/blob/2e14273cab87f13edeb9d804a43bd63c44703cb5/docs/source/conf.py#L196). Optuna’s tutorial directory has two directories: (1) [10_key_features](https://github.com/optuna/optuna/tree/master/tutorial/10_key_features), which is meant to be aligned with and explain the key features listed on [README.md](https://github.com/optuna/optuna#key-features) and (2) [20_recipes](https://github.com/optuna/optuna/tree/master/tutorial/20_recipes), whose contents showcase how to use Optuna features conveniently. When adding new content to the Optuna tutorials, place it in `20_recipes` and its file name should conform to the other names, for example, `777_cool_feature.py`. In general, please number the prefix for your file consecutively with the last number. However, this is not mandatory and if you think your content deserves the smaller number (the order of recipes does not have a specific meaning, but in general, order could convey the priority order to readers), feel free to propose the renumbering in your PR. You may want to refer to the Sphinx Gallery for the syntax of `.py` files processed by Sphinx Gallery. Two specific conventions and limitations for Optuna tutorials: 1. 99 #s for block separation as in https://github.com/optuna/optuna/blob/2e14273cab87f13edeb9d804a43bd63c44703cb5/tutorial/10_key_features/001_first.py#L19 2. Execution time of the new content needs to be less than three minutes. This limitation derives from Read The Docs. If your content runs some hyperparameter optimization, set the `timeout` to 180 or less. You can check this limitation on [Read the Docs - Build Process](https://docs.readthedocs.io/en/stable/builds.html). ### Unit Tests When adding a new feature or fixing a bug, you also need to write sufficient test code. We use [pytest](https://pytest.org/) as the testing framework and unit tests are stored under the [tests directory](./tests). Please install some required packages at first. ```bash # Install required packages to test all modules. pip install ".[test,optional]" ``` You can run your tests as follows: ```bash # Run all the unit tests. pytest # Run all the unit tests defined in the specified test file. pytest tests/${TARGET_TEST_FILE_NAME} # Run the unit test function with the specified name defined in the specified test file. pytest tests/${TARGET_TEST_FILE_NAME} -k ${TARGET_TEST_FUNCTION_NAME} ``` See also the [Optuna Test Policy](https://github.com/optuna/optuna/wiki/Test-Policy), which describes the principles to write and maintain Optuna tests to meet certain quality requirements. ### Continuous Integration and Local Verification Optuna repository uses GitHub Actions. ### Creating a Pull Request When you are ready to create a pull request, please try to keep the following in mind. First, the **title** of your pull request should: - briefly describe and reflect the changes - wrap any code with backticks - not end with a period *The title will be directly visible in the release notes.* For example: - Introduces Tree-structured Parzen Estimator to `optuna.samplers` Second, the **description** of your pull request should: - describe the motivation - describe the changes - if still work-in-progress, describe remaining tasks ## Learning Optuna's Implementation With Optuna actively being developed and the amount of code growing, it has become difficult to get a hold of the overall flow from reading the code. So we created a tiny program called [Minituna](https://github.com/CyberAgentAILab/minituna). Once you get a good understanding of how Minituna is designed, it will not be too difficult to read the Optuna code. We encourage you to practice reading the Minituna code with the following article. [An Introduction to the Implementation of Optuna, a Hyperparameter Optimization Framework](https://medium.com/optuna/an-introduction-to-the-implementation-of-optuna-a-hyperparameter-optimization-framework-33995d9ec354) optuna-4.1.0/Dockerfile 0000664 0000000 0000000 00000001436 14713323143 0015021 0 ustar 00root root 0000000 0000000 ARG PYTHON_VERSION=3.8 FROM python:${PYTHON_VERSION} ENV PIP_OPTIONS "--no-cache-dir --progress-bar off" RUN apt-get update \ && apt-get -y install openmpi-bin libopenmpi-dev libopenblas-dev \ && rm -rf /var/lib/apt/lists/* \ && pip install --no-cache-dir -U pip \ && pip install ${PIP_OPTIONS} -U setuptools WORKDIR /workspaces COPY . . ARG BUILD_TYPE='dev' RUN if [ "${BUILD_TYPE}" = "dev" ]; then \ pip install ${PIP_OPTIONS} -e '.[benchmark, checking, document, optional, test]' --extra-index-url https://download.pytorch.org/whl/cpu; \ else \ pip install ${PIP_OPTIONS} -e .; \ fi \ && pip install ${PIP_OPTIONS} jupyter notebook # Install RDB bindings. RUN pip install ${PIP_OPTIONS} PyMySQL cryptography psycopg2-binary ENV PIP_OPTIONS "" optuna-4.1.0/LICENSE 0000664 0000000 0000000 00000002071 14713323143 0014030 0 ustar 00root root 0000000 0000000 MIT License Copyright (c) 2018 Preferred Networks, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. optuna-4.1.0/LICENSE_THIRD_PARTY 0000664 0000000 0000000 00000003611 14713323143 0015742 0 ustar 00root root 0000000 0000000 Optuna contains code that is licensed by third-party developers. == SciPy The Optuna contains the codes from SciPy project. Copyright (c) 2001-2002 Enthought, Inc. 2003-2022, SciPy Developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. == fdlibm Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. Developed at SunPro, a Sun Microsystems, Inc. business. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved. optuna-4.1.0/MANIFEST.in 0000664 0000000 0000000 00000000055 14713323143 0014561 0 ustar 00root root 0000000 0000000 graft tests global-exclude *~ *.py[cod] *.so optuna-4.1.0/README.md 0000664 0000000 0000000 00000031142 14713323143 0014303 0 ustar 00root root 0000000 0000000