You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/12/30 07:01:24 UTC
[dolphinscheduler-sdk-python] branch main updated: feat: Use setup.cfg for dist package (#64)
This is an automated email from the ASF dual-hosted git repository.
zhongjiajie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler-sdk-python.git
The following commit(s) were added to refs/heads/main by this push:
new 7d37d2e feat: Use setup.cfg for dist package (#64)
7d37d2e is described below
commit 7d37d2ed8763499b9a1de75d95edb578ce504eec
Author: Jay Chung <zh...@gmail.com>
AuthorDate: Fri Dec 30 15:01:20 2022 +0800
feat: Use setup.cfg for dist package (#64)
Use setup.cfg to config dist package. the benefit is we can use `attr`
and `file` setup.cfg for convenient setting
---
.github/workflows/ci.yaml | 2 +-
RELEASE.md | 14 ++--
docs/source/conf.py | 9 ++-
setup.cfg | 112 ++++++++++++++++++++++++++++++
setup.py | 138 ++-----------------------------------
src/pydolphinscheduler/__init__.py | 4 +-
6 files changed, 134 insertions(+), 145 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 35af018..e76d26f 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -151,7 +151,7 @@ jobs:
integrate-test:
needs: license
runs-on: ubuntu-latest
- if: ${{ github.event_name == 'schedule' }} || contains(github.event.head_commit.message, '[run-it]')
+ if: ${{ github.event_name == 'schedule' || contains(toJSON(github.event.commits.*.message), '[run-it]') }}
timeout-minutes: 30
steps:
- name: Checkout Dolphinscheduler SDK Python
diff --git a/RELEASE.md b/RELEASE.md
index adf8d28..09499fd 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -24,7 +24,6 @@ but we also have a [PyPi](#release-to-pypi) repository for Python package distri
## Prepare
-* Change `version` in `setup.py`.
* Remove `sphinx-multiversion` dependency in `setup.py`, we still can not fix this issue
[Distribute tarball and wheel error with direct dependency](https://github.com/apache/dolphinscheduler/issues/12238)
* Change `version_ext` about the dolphinscheduler version current support, the syntax is respect [pep-044](https://peps.python.org/pep-0440/#version-specifiers)
@@ -40,6 +39,13 @@ upload package to PyPi. You could first install and upgrade them by:
# Install or upgrade dependencies
python3 -m pip install --upgrade pip build twine
+# Change version
+# For macOS
+sed -i '' "s/__version__ = \".*\"/__version__ = \"${VERSION}\"/" src/pydolphinscheduler/__init__.py
+# For Linux
+sed -i "s/__version__ = \".*\"/__version__ = \"${VERSION}\"/" src/pydolphinscheduler/__init__.py
+git commit -am "Release v${VERSION}"
+
# Add Tag
VERSION=<VERSION> # The version of the package you want to release, e.g. 1.2.3
REMOTE=<REMOTE> # The git remote name, we usually use `origin` or `remote`
@@ -47,7 +53,7 @@ git tag -a "${VERSION}" -m "Release v${VERSION}"
git push "${REMOTE}" --tags
# Build
-python setup.py pre_clean && python -m build
+python setup.py clean && python -m build
# Sign
cd dist
@@ -210,7 +216,7 @@ Vote result should follow these:
TestPyPi is a test environment of PyPi, you could release to it to test whether the package is work or not.
1. Create an account in [TestPyPi](https://test.pypi.org/account/register/).
-2. Clean unrelated files in `dist` directory, and build package `python3 setup.py pre_clean`.
+2. Clean unrelated files in `dist` directory, and build package `python3 setup.py clean`.
3. Build package `python3 -m build`, and you will see two new files in `dist` directory, with extension
`.tar.gz` and `.whl`.
4. Upload to TestPyPi `python3 -m twine upload --repository testpypi dist/*`.
@@ -224,7 +230,7 @@ PyPi is the official repository of Python packages, it is highly recommended [re
first to test whether the package is correct.
1. Create an account in [PyPI](https://pypi.org/account/register/).
-2. Clean unrelated files in `dist` directory, and build package `python3 setup.py pre_clean`.
+2. Clean unrelated files in `dist` directory, and build package `python3 setup.py clean`.
3. Build package `python3 -m build`, and you will see two new files in `dist` directory, with extension
`.tar.gz` and `.whl`.
4. Upload to TestPyPi `python3 -m twine upload dist/*`.
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 021683e..e834971 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -39,6 +39,9 @@ pkg_src_dir = (
.resolve()
)
sys.path.insert(0, str(pkg_src_dir))
+
+from pydolphinscheduler import __version__ # noqa
+
# Debug to uncomment this to see the source path
# print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=")
# print(pkg_src_dir)
@@ -48,12 +51,12 @@ sys.path.insert(0, str(pkg_src_dir))
# -- Project information -----------------------------------------------------
-project = "pydolphinscheduler"
+project = "apache-dolphinscheduler"
copyright = "2022, apache"
-author = "apache dolphinscheduler contributors"
+author = "Apache Software Foundation"
# The full version, including alpha/beta/rc tags
-release = "0.0.1"
+release = __version__
# -- General configuration ---------------------------------------------------
diff --git a/setup.cfg b/setup.cfg
index 13a8339..37cf657 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -14,3 +14,115 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+
+[metadata]
+name = apache-dolphinscheduler
+version = attr: pydolphinscheduler.__version__
+url = https://dolphinscheduler.apache.org/python/main/index.html
+description = pydolphinscheduler is Apache DolphinScheduler Python API.
+long_description = file: README.md
+long_description_content_type = text/markdown
+author = Apache Software Foundation
+author_email = dev@dolphinscheduler.apache.org
+license = Apache License 2.0
+license_files =
+ file: LICENSE
+keywords =
+ dolphinscheduler
+ workflow
+ scheduler
+ taskflow
+# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
+classifiers =
+ Development Status :: 4 - Beta
+ Environment :: Console
+ Intended Audience :: Developers
+ License :: OSI Approved :: Apache Software License
+ Operating System :: Unix
+ Operating System :: POSIX
+ Operating System :: Microsoft :: Windows
+ Programming Language :: Python
+ Programming Language :: Python :: 3
+ Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
+ Programming Language :: Python :: 3.8
+ Programming Language :: Python :: 3.9
+ Programming Language :: Python :: 3.10
+ Programming Language :: Python :: 3.11
+ Programming Language :: Python :: Implementation :: CPython
+ Programming Language :: Python :: Implementation :: PyPy
+ Topic :: Software Development :: User Interfaces
+project_urls =
+ Homepage = https://dolphinscheduler.apache.org/python/main/index.html
+ Documentation = https://dolphinscheduler.apache.org/python/main/index.html
+ Source = https://github.com/apache/dolphinscheduler-sdk-python
+ Issue Tracker = https://github.com/apache/dolphinscheduler-sdk-python/issues
+ Twitter = https://twitter.com/dolphinschedule
+
+[options]
+python_requires = >=3.6
+include_package_data = True
+zip_safe = true
+platforms = any
+package_dir =
+ =src
+packages =
+ find:
+install_requires =
+ boto3>=1.23.10
+ oss2>=2.16.0
+ python-gitlab>=2.10.1
+ click>=8.0.0
+ py4j~=0.10
+ ruamel.yaml
+ stmdency>=0.0.2
+
+[options.packages.find]
+where=src
+
+[options.package_data]
+pydolphinscheduler =
+ default_config.yaml
+ version_ext
+
+[options.entry_points]
+console_scripts =
+ pydolphinscheduler = pydolphinscheduler.cli.commands:cli
+
+[options.extras_require]
+build =
+ build
+ setuptools>=42
+ wheel
+test =
+ pytest>=6.2
+ freezegun>=1.1
+ coverage>=6.1
+ pytest-cov>=3.0
+ docker>=5.0.3
+style =
+ flake8>=4.0
+ flake8-docstrings>=1.6
+ flake8-black>=0.2
+ isort>=5.10
+ autoflake>=1.4
+doc =
+ sphinx>=4.3
+ sphinx_rtd_theme>=1.0
+ sphinx-click>=3.0
+ sphinx-inline-tabs
+ sphinx-copybutton>=0.4.0
+ # Unreleased package have a feature we want(use correct version package for API ref), so we install from
+ # GitHub directly, see also:
+ # https://github.com/Holzhaus/sphinx-multiversion/issues/42#issuecomment-1210539786
+ sphinx-multiversion @ git+https://github.com/Holzhaus/sphinx-multiversion#egg=sphinx-multiversion
+ sphinx-github-changelog
+dev =
+ # build
+ apache-dolphinscheduler[build]
+ # test
+ apache-dolphinscheduler[test]
+ # style
+ apache-dolphinscheduler[style]
+ # doc
+ apache-dolphinscheduler[doc]
diff --git a/setup.py b/setup.py
index 99fddac..4e84454 100644
--- a/setup.py
+++ b/setup.py
@@ -20,10 +20,9 @@ import logging
import os
import sys
from distutils.dir_util import remove_tree
-from os.path import dirname, join
from typing import List
-from setuptools import Command, find_packages, setup
+from setuptools import Command, setup
if sys.version_info[0] < 3:
raise Exception(
@@ -32,69 +31,9 @@ if sys.version_info[0] < 3:
logger = logging.getLogger(__name__)
-version = "dev"
-
-# Start package required
-prod = [
- "boto3>=1.23.10",
- "oss2>=2.16.0",
- "python-gitlab>=2.10.1",
- "click>=8.0.0",
- "py4j~=0.10",
- "ruamel.yaml",
- "stmdency>=0.0.2",
-]
-
-build = [
- "build",
- "setuptools>=42",
- "wheel",
-]
-
-doc = [
- "sphinx>=4.3",
- "sphinx_rtd_theme>=1.0",
- "sphinx-click>=3.0",
- "sphinx-inline-tabs",
- "sphinx-copybutton>=0.4.0",
- # Unreleased package have a feature we want(use correct version package for API ref), so we install from
- # GitHub directly, see also:
- # https://github.com/Holzhaus/sphinx-multiversion/issues/42#issuecomment-1210539786
- "sphinx-multiversion @ git+https://github.com/Holzhaus/sphinx-multiversion#egg=sphinx-multiversion",
- "sphinx-github-changelog",
-]
-
-test = [
- "pytest>=6.2",
- "freezegun>=1.1",
- "coverage>=6.1",
- "pytest-cov>=3.0",
- "docker>=5.0.3",
-]
-
-style = [
- "flake8>=4.0",
- "flake8-docstrings>=1.6",
- "flake8-black>=0.2",
- "isort>=5.10",
- "autoflake>=1.4",
-]
-
-dev = style + test + doc + build
-
-all_dep = prod + dev
-# End package required
-
-
-def read(*names, **kwargs):
- """Read file content from given file path."""
- return open(
- join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
- ).read()
-
class CleanCommand(Command):
- """Command to clean up python api before setup by running `python setup.py pre_clean`."""
+ """Command to clean up python api before setup by running `python setup.py clean`."""
description = "Clean up project root"
user_options: List[str] = []
@@ -121,80 +60,11 @@ class CleanCommand(Command):
remove_tree(cl)
else:
os.remove(cl)
- logger.info("Finish pre_clean process.")
+ logger.info("Finish clean process.")
setup(
- name="apache-dolphinscheduler",
- version=version,
- license="Apache License 2.0",
- description="Apache DolphinScheduler Python API",
- long_description=read("README.md"),
- # Make sure pypi is expecting markdown
- long_description_content_type="text/markdown",
- author="Apache Software Foundation",
- author_email="dev@dolphinscheduler.apache.org",
- url="https://dolphinscheduler.apache.org/python/main/index.html",
- python_requires=">=3.6",
- keywords=[
- "dolphinscheduler",
- "workflow",
- "scheduler",
- "taskflow",
- ],
- project_urls={
- "Homepage": "https://dolphinscheduler.apache.org/python/main/index.html",
- "Documentation": "https://dolphinscheduler.apache.org/python/main/index.html",
- "Source": "https://github.com/apache/dolphinscheduler-sdk-python",
- "Issue Tracker": "https://github.com/apache/dolphinscheduler-sdk-python/issues",
- "Twitter": "https://twitter.com/dolphinschedule",
- },
- packages=find_packages(where="src"),
- package_dir={"": "src"},
- include_package_data=True,
- package_data={
- "pydolphinscheduler": [
- "default_config.yaml",
- "version_ext",
- ],
- },
- platforms=["any"],
- classifiers=[
- # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
- "Development Status :: 4 - Beta",
- "Environment :: Console",
- "Intended Audience :: Developers",
- "License :: OSI Approved :: Apache Software License",
- "Operating System :: Unix",
- "Operating System :: POSIX",
- "Operating System :: Microsoft :: Windows",
- "Programming Language :: Python",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.6",
- "Programming Language :: Python :: 3.7",
- "Programming Language :: Python :: 3.8",
- "Programming Language :: Python :: 3.9",
- "Programming Language :: Python :: 3.10",
- "Programming Language :: Python :: 3.11",
- "Programming Language :: Python :: Implementation :: CPython",
- "Programming Language :: Python :: Implementation :: PyPy",
- "Topic :: Software Development :: User Interfaces",
- ],
- install_requires=prod,
- extras_require={
- "all": all_dep,
- "dev": dev,
- "style": style,
- "test": test,
- "doc": doc,
- "build": build,
- },
cmdclass={
- "pre_clean": CleanCommand,
- },
- entry_points={
- "console_scripts": [
- "pydolphinscheduler = pydolphinscheduler.cli.commands:cli",
- ],
+ "clean": CleanCommand,
},
)
diff --git a/src/pydolphinscheduler/__init__.py b/src/pydolphinscheduler/__init__.py
index 2a7b554..b285d5a 100644
--- a/src/pydolphinscheduler/__init__.py
+++ b/src/pydolphinscheduler/__init__.py
@@ -17,6 +17,4 @@
"""Init root of pydolphinscheduler."""
-from pkg_resources import get_distribution
-
-__version__ = get_distribution("apache-dolphinscheduler").version
+__version__ = "dev"