From b91ffaea7950b37ee9d58105bb97122ee27abe0b Mon Sep 17 00:00:00 2001 From: ismail simsek <6005685+ismailsimsek@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:21:59 +0100 Subject: [PATCH] Use pyproject.toml instead of setup.py (#33) * Use pyproject.toml instead of setup.py * Use pyproject.toml instead of setup.py * Use pyproject.toml instead of setup.py --- .github/workflows/tests.yml | 4 +-- .gitignore | 1 + pyproject.toml | 39 ++++++++++++++++++++++++++++++ setup.py | 33 ------------------------- tests/resources/airflow/Dockerfile | 2 +- 5 files changed, 43 insertions(+), 36 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fc7c795..8445d80 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,9 +38,9 @@ jobs: pip install -q .[test] --prefer-binary python --version python -c "from dbt.version import get_installed_version as get_dbt_version;print(f'dbt version={get_dbt_version()}')" - python -m compileall -f opendbt setup.py + python -m compileall -f opendbt - name: Run Tests run: | python -c "from dbt.version import get_installed_version as get_dbt_version;print(f'dbt version={get_dbt_version()}')" python -m coverage run --source=./tests/ -m unittest discover -s tests/ - python -m coverage report -m ./opendbt/*.py setup.py + python -m coverage report -m ./opendbt/*.py diff --git a/.gitignore b/.gitignore index c964897..67c7aba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +logs **.duckdb **.user.yml reset.sh diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b715494 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,39 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "opendbt" +version = "0.8.0" +authors = [ + { name = "Memiiso Organization" }, +] +description = "opendbt dbt-core with additional features" +readme = "README.md" +requires-python = ">=3.8" +keywords = ["dbt-core", "dbt"] +license = { text = "Apache License 2.0" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python :: 3", +] +dependencies = [ + "dbt-duckdb>=1.6", + "sqlfluff", + "sqlfluff-templater-dbt" +] +[project.optional-dependencies] +airflow = ["apache-airflow"] +test = ["testcontainers>=3.7,<4.9", "apache-airflow"] + +[tool.setuptools] +include-package-data = true +packages = ["opendbt"] + +[project.scripts] +opendbt = "opendbt.__main__:main" + +[project.urls] +Homepage = "https://github.com/memiiso/opendbt" +Documentation = "https://github.com/memiiso/opendbt" +Repository = "https://github.com/memiiso/opendbt" diff --git a/setup.py b/setup.py deleted file mode 100644 index 23e5ec1..0000000 --- a/setup.py +++ /dev/null @@ -1,33 +0,0 @@ -import os -import pathlib - -from setuptools import setup, find_packages - -setup_py_dir = pathlib.Path(__file__).parent -os.chdir(setup_py_dir) - -setup( - name='opendbt', - entry_points={ - 'console_scripts': [ - 'opendbt = opendbt.__main__:main', - ], - }, - version="0.8.0", - packages=find_packages(), - author="Memiiso Organization", - description='Python opendbt', - long_description=pathlib.Path(__file__).parent.joinpath("README.md").read_text(encoding="utf-8"), - long_description_content_type="text/markdown", - url='https://github.com/memiiso/opendbt', - download_url='https://github.com/memiiso/opendbt/archive/master.zip', - include_package_data=True, - license="Apache License 2.0", - test_suite='tests', - install_requires=["dbt-duckdb>=1.6", "sqlfluff", "sqlfluff-templater-dbt"], - extras_require={ - "airflow": ["apache-airflow"], - "test": ["testcontainers>=3.7,<4.9", "apache-airflow"], - }, - python_requires='>=3.8' -) diff --git a/tests/resources/airflow/Dockerfile b/tests/resources/airflow/Dockerfile index b628592..e811b5f 100644 --- a/tests/resources/airflow/Dockerfile +++ b/tests/resources/airflow/Dockerfile @@ -4,7 +4,7 @@ LABEL authors="opendbt" # install additional packages COPY --chown=airflow:airflow opendbt /tmp/opendbt/opendbt COPY --chown=airflow:airflow README.md /tmp/opendbt/README.md -COPY --chown=airflow:airflow setup.py /tmp/opendbt/setup.py +COPY --chown=airflow:airflow pyproject.toml /tmp/opendbt/pyproject.toml RUN pip install -e /tmp/opendbt/ EXPOSE 8080