diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 70f094c18..71e1e5531 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -39,3 +39,19 @@ jobs: - name: Fail on differences run: git diff --exit-code + + check-manifest: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/setup-python@v4 + with: + python-version: 3.13 + + - name: Check MANIFEST.in + run: | + pip install check-manifest + check-manifest . diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index 0e8c4d8e0..9f05311d1 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -17,8 +17,15 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.13 + + - name: Install build + run: pip install build + - name: Build wheel - run: make dev install dist + run: python -m build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32890bde6..637db2faf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,8 +20,15 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.13 + + - name: Install build + run: pip install build + - name: Build wheel - run: make dev install dist + run: python -m build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -30,8 +37,8 @@ jobs: with: draft: true files: | - dist/databricks-*.whl - dist/databricks-*.tar.gz + dist/databricks_*.whl + dist/databricks_*.tar.gz - uses: pypa/gh-action-pypi-publish@release/v1 name: Publish package distributions to PyPI diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..cba549dc5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,23 @@ +include README.md +include LICENSE +include NOTICE +include DCO +include Makefile +include SECURITY.md +include CHANGELOG.md +include CONTRIBUTING.md +include pyproject.toml +include databricks/sdk/py.typed + +exclude .codegen.json +exclude .readthedocs.yaml +exclude docs-requirements.txt +exclude NEXT_CHANGELOG.md +exclude tagging.py +exclude .package.json + +recursive-exclude docs * +recursive-exclude examples * +recursive-exclude tests * +recursive-exclude .codegen * +recursive-exclude .vscode * diff --git a/Makefile b/Makefile index eb8fe8397..8c0be4b8a 100644 --- a/Makefile +++ b/Makefile @@ -36,8 +36,5 @@ benchmark: coverage: test open htmlcov/index.html -dist: - python3 setup.py bdist_wheel sdist - clean: rm -fr dist *.egg-info .pytest_cache build htmlcov diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..92572a44d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,74 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "databricks-sdk" +dynamic = ["version"] +description = "Databricks SDK for Python (Beta)" +readme = "README.md" +requires-python = ">=3.7" +keywords = ["databricks", "sdk"] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: Apache Software License", + "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 :: 3.12", + "Programming Language :: Python :: 3.13", + "Operating System :: OS Independent" +] +dependencies = [ + "requests>=2.28.1,<3", + "google-auth~=2.0" +] + +[project.urls] +Documentation = "https://databricks-sdk-py.readthedocs.io" + +[project.optional-dependencies] +dev = [ + "pytest", + "pytest-cov", + "pytest-xdist", + "pytest-mock", + "yapf", + "pycodestyle", + "autoflake", + "isort", + "wheel", + "ipython", + "ipywidgets", + "requests-mock", + "pyfakefs", + "databricks-connect", + "pytest-rerunfailures", + "openai", + 'langchain-openai; python_version > "3.7"', + "httpx", + "build", # some integration tests depend on the databricks-sdk-py wheel +] +notebook = [ + "ipython>=8,<9", + "ipywidgets>=8,<9" +] +openai = [ + "openai", + 'langchain-openai; python_version > "3.7"', + "httpx" +] + +[tool.setuptools.dynamic] +version = { attr = "databricks.sdk.version.__version__" } + +[tool.setuptools.packages.find] +include = ["databricks", "databricks.*"] + +[tool.setuptools.package-data] +"databricks.sdk" = ["py.typed"] diff --git a/setup.py b/setup.py deleted file mode 100644 index b756e6d0d..000000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -import io -import pathlib - -from setuptools import setup, find_packages - -version_data = {} -version_file = pathlib.Path(__file__).parent / 'databricks/sdk/version.py' -with version_file.open('r') as f: - exec(f.read(), version_data) - -setup(name="databricks-sdk", - version=version_data['__version__'], - packages=find_packages(exclude=["tests", "*tests.*", "*tests"]), - package_data = {"databricks.sdk": ["py.typed"]}, - python_requires=">=3.7", - install_requires=["requests>=2.28.1,<3", "google-auth~=2.0"], - extras_require={"dev": ["pytest", "pytest-cov", "pytest-xdist", "pytest-mock", - "yapf", "pycodestyle", "autoflake", "isort", "wheel", - "ipython", "ipywidgets", "requests-mock", "pyfakefs", - "databricks-connect", "pytest-rerunfailures", "openai", - 'langchain-openai; python_version > "3.7"', "httpx"], - "notebook": ["ipython>=8,<9", "ipywidgets>=8,<9"], - "openai": ["openai", 'langchain-openai; python_version > "3.7"', "httpx"]}, - author="Serge Smertin", - author_email="serge.smertin@databricks.com", - description="Databricks SDK for Python (Beta)", - long_description=io.open("README.md", encoding="utf-8").read(), - long_description_content_type='text/markdown', - url="https://databricks-sdk-py.readthedocs.io", - keywords="databricks sdk", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "Intended Audience :: System Administrators", - "License :: OSI Approved :: Apache Software License", - "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 :: 3.12", - "Operating System :: OS Independent"]) diff --git a/tests/integration/test_auth.py b/tests/integration/test_auth.py index 3ee271778..41b901c9a 100644 --- a/tests/integration/test_auth.py +++ b/tests/integration/test_auth.py @@ -25,7 +25,7 @@ def fresh_wheel_file(tmp_path) -> Path: build_root = tmp_path / 'databricks-sdk-py' shutil.copytree(project_root, build_root) try: - completed_process = subprocess.run([sys.executable, 'setup.py', 'bdist_wheel'], + completed_process = subprocess.run([sys.executable, '-m', 'build'], capture_output=True, cwd=build_root) if completed_process.returncode != 0: