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

Kdruzhinin/test/project structure #3

Closed
wants to merge 6 commits into from
Closed
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
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: dbt-score

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

push:
branches:
- main
paths-ignore:
- 'docs/**'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: [ "3.8", "3.9", "3.10", "3.11" ]

steps:
- uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: '3.8'

- name: Install dependencies
run: |
pdm sync -d
- name: Run Tests
run: |
pdm run tox -e py,lint
# - name: Publish docs
# run: |
# TODO
# - name: Publish package
# run: |
# pdm publish --no-build
28 changes: 28 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: dbt-score

on:
push:
branches:
- master
paths:
- 'docs/**'
- 'src/**'
- .github/workflows/docs.yml

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
pdm run tox -e docs
# - name: Publish docs
# run: |
# TODO
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: dbt-score

on:
push:
tags:
- "*"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
pdm sync -d
- name: Build package
run: |
pdm build
# - name: Publish package
# run: |
# pdm publish
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
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,063 changes: 1,063 additions & 0 deletions pdm.lock

Large diffs are not rendered by default.

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

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

description = "Linter for dbt model metadata."
authors = [
{name = "Kirill Druzhinin", email = "[email protected]"},
{name = "Jochem van Dooren", email = "[email protected]"},
{name = "Matthieu Caneill ", email = "[email protected]"},
]
dependencies = [
"dbt>=1.0.0.36.4",
]
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

### Ruff ###

[tool.ruff]
line-length = 88

[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
Empty file added src/dbt_score/__init__.py
Empty file.
Empty file added tests/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions tests/test_placeholder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_placeholder():
assert 1 == 1
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 = py38,py39,py310,py311,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
commands =
ruff check .
mypy .

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