This document describes MinerU's version management system and automated release process. It covers how version numbers are tracked, the Git tag-based versioning scheme, the CI/CD pipeline for publishing releases, and the automation that deploys packages to PyPI and GitHub Releases. For information about continuous testing workflows, see CI/CD Pipeline and Workflows. For documentation deployment, see Documentation System (MkDocs).
Sources: .github/workflows/python-package.yml1-145 mineru/version.py1-2 update_version.py1-28
MinerU uses a single-source-of-truth approach for version management. The canonical version number is stored in `mineru/version.py`() as a simple __version__ string variable:
This version file serves multiple purposes:
pyproject.toml to set the distribution versionmineru.__version__The version number follows semantic versioning principles (MAJOR.MINOR.PATCH) and is automatically synchronized with Git tags during the release workflow.
Sources: mineru/version.py1-2
The `update_version.py`() script extracts version information from Git tags and updates the version file. It implements the core version management logic:
| Function | Purpose | Implementation |
|---|---|---|
get_version() | Extracts version from Git tags | Executes git describe --tags and parses output |
write_version_to_commons() | Updates version.py | Writes __version__ = "{version}" to file |
The `get_version()`() function implements the following algorithm:
git describe --tags to get the most recent tagmineru-<version>-released-)"0.0.0" on errorExample tag parsing:
mineru-2.7.6-released2.7.6Sources: update_version.py5-28
The `python-package` workflow is triggered by two events:
| Trigger | Condition | Use Case |
|---|---|---|
push.tags | Tags matching *released pattern | Automated production releases |
workflow_dispatch | Manual trigger | Emergency releases or testing |
When triggered, the workflow operates on the master branch and executes a four-stage pipeline with job dependencies ensuring sequential execution.
Sources: .github/workflows/python-package.yml6-11
Sources: .github/workflows/python-package.yml13-145
The `update-version` job executes on ubuntu-latest and performs version synchronization:
master branch with full Git history (fetch-depth: 0) to access all tagsactions/setup-python@v6python update_version.py to extract version from Git tag and update `mineru/version.py`()myhloli <[email protected]>, skips if no changes detectedmaster branch using RELEASE_TOKEN secretThe workflow configures Git with hardcoded credentials:
[email protected]myhloliThis ensures consistent commit attribution across all automated version updates.
Sources: .github/workflows/python-package.yml15-56
The `check-install` job validates package installability across Python versions:
| Parameter | Values | Purpose |
|---|---|---|
python-version | ["3.10", "3.11", "3.12", "3.13"] | Test all supported Python versions |
fail-fast | false | Continue testing even if one version fails |
master branch after version update commitmineru/version.py contains the updated versionpip install -e .[core]This stage ensures the updated package is installable before building distribution artifacts. If installation fails on any Python version, the workflow continues but marks the job as failed.
Sources: .github/workflows/python-package.yml57-86
The `build` job creates the distribution package:
3.10 (single version, no matrix)wheel, build packages.whl file in dist/ directoryThe wheel file is uploaded as a GitHub Actions artifact with:
wheel-filedist/*.whlThis artifact bridges the build and release jobs, allowing the wheel to be downloaded and published in the final stage.
Sources: .github/workflows/python-package.yml87-118
The `release` job publishes the package to two targets:
Uses `softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981` to:
dist/*.whlRELEASE_TOKEN secretThe PyPI upload process L140-144:
twine, keyring, packaging utilitiestwine check dist/* validates wheel metadatatwine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}| Parameter | Value | Purpose |
|---|---|---|
| Username | __token__ | PyPI token-based authentication |
| Password | ${{ secrets.PYPI_TOKEN }} | API token from GitHub secrets |
| Files | dist/* | All distribution files in dist directory |
Sources: .github/workflows/python-package.yml119-145
MinerU releases must follow a strict tag naming pattern:
mineru-<MAJOR>.<MINOR>.<PATCH>-released
Examples:
mineru-2.7.6-released → Version 2.7.6mineru-3.0.0-released → Version 3.0.0| Component | Description | Validation |
|---|---|---|
mineru- | Project prefix | Required, validated by update_version.py |
X.Y.Z | Semantic version | Extracted as version number |
-released | Release suffix | Triggers workflow via *released pattern |
The workflow trigger pattern *released L9 matches any tag ending with "released", but `update_version.py`() enforces the full format by checking if the first part starts with "mineru". Tags not matching this format will cause the version extraction to fail and fall back to "0.0.0".
Sources: .github/workflows/python-package.yml8-9 update_version.py10-13
MinerU's release process requires two secrets configured in the repository settings:
| Secret Name | Usage | Scope |
|---|---|---|
RELEASE_TOKEN | GitHub API authentication | Git push to master, create releases |
PYPI_TOKEN | PyPI API authentication | Package upload to PyPI |
Used in two contexts:
Version Update Commit L50-55:
master branchGitHub Release Creation L134-138:
The PyPI token L144 must:
mineru packagetwine with username __token__ (literal string)Sources: .github/workflows/python-package.yml53-54 .github/workflows/python-package.yml138 .github/workflows/python-package.yml144
Sources: .github/workflows/python-package.yml1-145
The `mkdocs` workflow runs independently from the release process:
| Trigger | Branch | Action |
|---|---|---|
Push to master or dev | Specified branch | Deploy docs to GitHub Pages |
This workflow:
dev branch (note: configures checkout to dev regardless of push branch)mhausenblas/mkdocs-deploy-gh-pages@master actionRELEASE_TOKEN/docs/requirements.txtFor detailed documentation system architecture, see Documentation System (MkDocs).
Sources: .github/workflows/mkdocs.yml1-23
Maintainers can manually trigger releases without pushing a tag:
master)This invokes the same four-stage pipeline but requires manual tag creation beforehand for version extraction to succeed.
For urgent releases:
git tag mineru-X.Y.Z-released && git push origin mineru-X.Y.Z-releasedhttps://github.com/opendatalab/MinerU/releaseshttps://pypi.org/project/mineru/Sources: .github/workflows/python-package.yml10-11
Error Handling L14-16:
File Path Resolution L20:
os.path.join() for cross-platform compatibilitymineru/version.pyFile Writing L21-22:
__version__ = "{version}"\nSources: update_version.py1-28
The workflow enforces strict job dependencies using the needs keyword:
| Stage | Depends On | Reason |
|---|---|---|
check-install | update-version | Must test installation with updated version number |
build | check-install | Only build if installation succeeds on all Python versions |
release | build | Only publish if wheel builds successfully |
If any job fails, downstream jobs are skipped, preventing publication of broken releases.
Sources: .github/workflows/python-package.yml58 .github/workflows/python-package.yml88 .github/workflows/python-package.yml120
The build job uploads the wheel artifact L112-117:
The release job downloads the artifact L126-130:
This artifact mechanism decouples build and release, allowing manual intervention if needed before publication.
Refresh this wiki