diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a5afbb9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,52 @@ +name: tests + +on: + push: + branches: + - master + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: Install dependencies + run: | + pip install -r requirements/lint-requirements.txt + - name: Lint Python code with ruff + run: | + ruff check . + ruff format --check . + - name: Lint YAML files with yamllint + run: yamllint . + + core_test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10'] + timeout-minutes: 20 + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install .[dev] + - name: Run tests + run: | + pytest tests/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7d00e19 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,10 @@ +Setting up dev environment + +Create a conda environement and install dev requirements + +``` +conda create --name databricks-ai-dev-env python=3.10 +conda activate databricks-ai-dev-env +pip install -e ".[databricks-dev]" +pip install -r requirements/lint-requirements.txt +``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6e76c92 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,83 @@ +[project] +name = "databricks-ai-bridge" +version = "0.0.1" +description = "Official Python library for Databricks AI support" +authors = [ + { name="Prithvi Kannan", email="prithvi.kannan@databricks.com" }, +] +readme = "README.md" +requires-python = ">=3.9" +dependencies = [ + "typing_extensions", + "pydantic" +] + +[project.license] +file = "LICENSE.txt" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build] +include = [ + "src/*" +] + +[tool.hatch.build.targets.wheel] +packages = ["src/databricks_ai_bridge"] + +[project.optional-dependencies] +databricks = [ + "databricks-sdk>=0.34.0", + "pandas", +] +databricks-dev = [ + "hatch", + "pytest", + "databricks-sdk>=0.34.0", + "pandas", + "ruff==0.6.4", +] +dev = [ + "hatch", + "pytest", + "databricks-sdk>=0.34.0", + "pandas", + "ruff==0.6.4", +] + +[tool.ruff] +line-length = 100 +target-version = "py39" + +[tool.ruff.lint] +select = [ + # isort + "I", + # bugbear rules + "B", + # remove unused imports + "F401", + # bare except statements + "E722", + # print statements + "T201", + "T203", + # misuse of typing.TYPE_CHECKING + "TCH004", + # import rules + "TID251", + # undefined-local-with-import-star + "F403", +] + +[tool.ruff.format] +docstring-code-format = true +docstring-code-line-length = 88 + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.pytest.ini_options] +pythonpath = ["src"]