setup a workflow for publishing package to pypi #11804
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this is cherry-pick of recent commits: c306d28 8a99bc9 d28d9e7 89e0a15 landed in release/2.7 branch. In the future, when we create a release, we can use .github/workflows/python-publish.yml to publish package automatically to pypi.
Some thing we can improve:
use a pyproject.toml file in this project, which is the recommended way for python packaging, see details here: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/. By doing so, we can use
python -m build
to build and package this project, which is more modern way for python packaging.dynamic versioning, get version of this package by using
paddleocr.VERSION
requires complex env setup (see paddleocr.py), we may need a better mechanism for doing this. To avoid changing paddleocr.py, a trick is used in setup.py.P.S.: to use github action for pypi package uploading, a repository secret is installed. (https://github.com/PaddlePaddle/PaddleOCR/settings/secrets/actions, repository admin privilege is required).