Skip to content

Setup pyproject and CI #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Check warning on line 1 in .github/workflows/main.yml

View workflow job for this annotation

GitHub Actions / lint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/main.yml

View workflow job for this annotation

GitHub Actions / lint

3:1 [truthy] truthy value should be one of [false, true]
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="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"]
Loading