Skip to content
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

Configure project setup #2

Merged
merged 12 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: dbt-score

on:
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'

push:
branches:
- main
paths-ignore:
- 'docs/**'
druzhinin-kirill marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: [ "3.8", "3.9", "3.10", "3.11" ]
druzhinin-kirill marked this conversation as resolved.
Show resolved Hide resolved

steps:
- uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
druzhinin-kirill marked this conversation as resolved.
Show resolved Hide resolved
with:
python-version: '3.8'

- name: Install dependencies
run: |
pdm sync -d
- name: Run Tox
run: |
pdm run tox -e py,lint
97 changes: 97 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# PyCharm
.idea

# VisualStudioCode
.vscode

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# PyBuilder
.pybuilder/
target/

# pdm
.pdm.toml
.pdm-python
.pdm-build/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# ruff
.ruff_cache/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.2.2
hooks:
- id: ruff
args: [ --fix ]
description: Run linter with fixes enabled
- id: ruff-format
description: Run formatter
- repo: local
hooks:
- id: tox
name: tox
description: Run tox
entry: pdm run tox -e py,lint
language: system
pass_filenames: false
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Welcome to dbt-score
8 changes: 8 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
site_name: dbt-score
theme:
name: material
plugins:
- search
- mkdocstrings
nav:
- Home: index.md
1,737 changes: 1,737 additions & 0 deletions pdm.lock

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[project]
name = "dbt-score"
dynamic = ["version"]

description = "Linter for dbt model metadata."
authors = [
{name = "Picnic Analyst Development Platform", email = "[email protected]"}
]
dependencies = [
"dbt-core~=1.7",
druzhinin-kirill marked this conversation as resolved.
Show resolved Hide resolved
]
requires-python = ">=3.8"
readme = "README.md"
license = {text = "MIT"}

[tool.pdm]
[tool.pdm.dev-dependencies]
dev = [
"tox-pdm~=0.7.2",
"tox~=4.13",
]
lint = [
"ruff~=0.2.2",
"mypy~=1.8",
]
test = [
"pytest~=8.0",
"coverage[toml]~=7.4"
]
docs = [
"mkdocs-material~=9.5",
"mkdocstrings[python]~=0.24.0"
]

[tool.pdm.version]
source = "scm"

### Mypy ###

[tool.mypy]
strict = true

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_incomplete_defs = false
disallow_untyped_calls = false

### Ruff ###

[tool.ruff]
line-length = 88

[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"C90", # mccabe
"I", # isort
"PL", # pylint
"Q", # flake8-quotes
"RUF", # ruff
"E", # pycodestyle errors
"W", # pycodestyle warnings
]

[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.ruff.lint.pydocstyle]
convention = "google"

### Coverage ###

[tool.coverage.run]
source = [
"tests",
"src"
]

[tool.coverage.report]
show_missing = true
fail_under = 80
1 change: 1 addition & 0 deletions src/dbt_score/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Init dbt_score package."""
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Test dbt_score package."""
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Test configuration."""

from pytest import ExitCode, Session


def pytest_sessionfinish(session: Session, exitstatus: int):
"""Avoid ci failure if no tests are found."""
if exitstatus == ExitCode.NO_TESTS_COLLECTED:
session.exitstatus = ExitCode.OK
24 changes: 24 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[tox]
env_list = py{38,39,310,311},lint,docs

skip_missing_interpreters = true

[testenv]
description = Run tests
groups = test
commands =
pytest
coverage run -m pytest

[testenv:lint]
description = Run lint
groups = lint, test
commands =
ruff check .
mypy .
druzhinin-kirill marked this conversation as resolved.
Show resolved Hide resolved

[testenv:docs]
description = Build docs
groups = docs
commands =
mkdocs build --clean
Loading