Skip to content

Commit

Permalink
Merge pull request #3 from databricks/new-branch-for-files
Browse files Browse the repository at this point in the history
Setup pyproject and CI
  • Loading branch information
prithvikannan authored Oct 17, 2024
2 parents f5d5948 + 3f1cfd6 commit 2d11411
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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/
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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
```
83 changes: 83 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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="[email protected]" },
]
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"]

0 comments on commit 2d11411

Please sign in to comment.