Skip to content

Fix imports in the artifact tutorial Boto3ArtifactStore example - #6953

Merged
c-bata merged 1 commit into
optuna:masterfrom
ZainnQureshii:docs/artifact-tutorial-imports
Nov 9, 2026
Merged

c-bata merged 1 commit into
optuna:masterfrom
ZainnQureshii:docs/artifact-tutorial-imports

Conversation

@ZainnQureshii

Copy link
Copy Markdown
Contributor

Motivation

The S3 pseudocode in tutorial/20_recipes/012_artifact_tutorial.py imports from optuna.artifact and optuna.artifact.boto3, and neither module exists, so anyone copying those import lines gets ModuleNotFoundError: No module named 'optuna.artifact'. The two other code blocks in the same tutorial (lines 108-110 and 266-268) already import from optuna.artifacts.

These broken imports were reported in #6860, where the maintainer review said they should be fixed in a separate PR. That PR was closed and I could not find a follow-up, so this is that separate fix, with credit to @bodapatisaikrishna for spotting it.

Description of the changes

Lines 184-186 of the tutorial now read:

from optuna.artifacts import upload_artifact
from optuna.artifacts import download_artifact
from optuna.artifacts import Boto3ArtifactStore

All three names are exported from optuna/artifacts/__init__.py (lines 2, 3 and 8, and __all__). Checked against the repo source on current master (50c5b87), run from the repo root with uv run --no-project --with packaging --with numpy --with sqlalchemy --with alembic --with colorlog --with tqdm --with PyYAML python -c "<import>":

from optuna.artifacts import upload_artifact, download_artifact, Boto3ArtifactStore  -> ok
from optuna.artifact import upload_artifact                                          -> ModuleNotFoundError: No module named 'optuna.artifact'
from optuna.artifact.boto3 import Boto3ArtifactStore                                 -> ModuleNotFoundError: No module named 'optuna.artifact'

No other line changes. The docs site was not built locally.

Checklist

  • I used an LLM while working on this PR.

This PR was prepared with AI assistance (Claude Code) and reviewed with GitHub Copilot.

🤖 Generated with Claude Code

The S3 pseudocode imported from optuna.artifact and optuna.artifact.boto3, which do not exist; upload_artifact, download_artifact and Boto3ArtifactStore are exported from optuna.artifacts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@c-bata c-bata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. LGTM.

@c-bata c-bata added the document Documentation related. label Nov 9, 2026
@c-bata c-bata added this to the v5.1.0 milestone Nov 9, 2026
@c-bata
c-bata merged commit 67a38ef into optuna:master Nov 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

document Documentation related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants