Skip to content

Commit

Permalink
use ruff for linting and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tedivm committed Dec 29, 2023
1 parent 5585946 commit bcba5ad
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 81 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/isort.yaml

This file was deleted.

11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ repos:
name: pytest
entry: make pytest_check
language: system
- id: isort
name: isort
entry: make isort_check
pass_filenames: false
- id: ruff
name: ruff
entry: make ruff_check
language: system
pass_filenames: false
- id: black
name: black
entry: make black_check
language: system
pass_filenames: false
- id: mypy
name: mypy
entry: make mypy_check
language: system
pass_filenames: false
- id: tomlsort
name: tomlsort
entry: make tomlsort_check
language: system
pass_filenames: false
26 changes: 13 additions & 13 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ pre-commit:
pre-commit install

#
# Formatting
# Chores
#

.PHONY: pretty
pretty: black_fixes isort_fixes dapperdata_fixes tomlsort_fixes
.PHONY: chores
chores: black_fixes dapperdata_fixes tomlsort_fixes

.PHONY: ruff_fix
ruff_fix:
$(PYTHON) -m ruff check --fix

.PHONY: black_fixes
black_fixes:
$(PYTHON) -m black .

.PHONY: isort_fixes
isort_fixes:
$(PYTHON) -m isort .
$(PYTHON) -m ruff format .

.PHONY: dapperdata_fixes
dapperdata_fixes:
Expand All @@ -78,7 +78,7 @@ tomlsort_fixes:
#

.PHONY: tests
tests: install pytest isort_check black_check mypy_check dapperdata_check tomlsort_check
tests: install pytest ruff_check black_check mypy_check dapperdata_check tomlsort_check

.PHONY: pytest
pytest:
Expand All @@ -88,13 +88,13 @@ pytest:
pytest_loud:
$(PYTHON) -m pytest -s --cov=./${PACKAGE_SLUG} --cov-report=term-missing tests

.PHONY: isort_check
isort_check:
$(PYTHON) -m isort --check-only .
.PHONY: ruff_check
ruff_check:
$(PYTHON) -m ruff check

.PHONY: black_check
black_check:
$(PYTHON) -m black . --check
$(PYTHON) -m ruff format . --check

.PHONY: mypy_check
mypy_check:
Expand Down
7 changes: 2 additions & 5 deletions paracelsus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
try:
from . import _version
from . import _version

__version__ = _version.__version__
except:
__version__ = "0.0.0-dev"
__version__ = _version.__version__
5 changes: 3 additions & 2 deletions paracelsus/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object
Expand All @@ -12,5 +13,5 @@
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '0.1.dev2+ge46e6ae.d20231228'
__version_tuple__ = version_tuple = (0, 1, 'dev2', 'ge46e6ae.d20231228')
__version__ = version = "0.1.dev11+g5585946.d20231229"
__version_tuple__ = version_tuple = (0, 1, "dev11", "g5585946.d20231229")
2 changes: 1 addition & 1 deletion paracelsus/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def inject(
fp.write(new_content)


@app.command(help=f"Display the current installed version of paracelsus.")
@app.command(help="Display the current installed version of paracelsus.")
def version():
from . import _version

Expand Down
4 changes: 1 addition & 3 deletions paracelsus/transformers/dot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import List

import pydot
from sqlalchemy.sql.schema import Column, MetaData, Table
from sqlalchemy.sql.schema import MetaData, Table

from . import utils

Expand Down
2 changes: 0 additions & 2 deletions paracelsus/transformers/mermaid.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

from sqlalchemy.sql.schema import Column, MetaData, Table

from . import utils
Expand Down
2 changes: 0 additions & 2 deletions paracelsus/transformers/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

from sqlalchemy.sql.schema import Column


Expand Down
33 changes: 4 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [{"name" = "Robert Hafner"}]
dependencies = [
"pydot",
"sqlalchemy",
"typer",
"typer"
]
description = ""
dynamic = ["version"]
Expand All @@ -17,49 +17,24 @@ readme = {file = "README.md", content-type = "text/markdown"}

[project.optional-dependencies]
dev = [
"black",
"build",
"dapperdata",
"glom",
"isort",
"mypy",
"pip-tools",
"pytest",
"pytest-cov",
"pytest-pretty",
"ruamel.yaml",
"toml-sort",
"ruff",
"toml-sort"
]

[project.scripts]
paracelsus = "paracelsus.cli:app"

[tool.black]
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| \.env
| _build
| buck-out
| build
| dist
| paracelsus/_version.py
)
)
'''
[tool.ruff]
line-length = 120
target-version = ['py38', 'py39', 'py310', 'py311']

[tool.isort]
profile = "black"
skip = [".venv"]
src_paths = ["paracelsus", "tests"]

[tool.setuptools.dynamic]
readme = {file = ["README.md"]}
Expand Down

0 comments on commit bcba5ad

Please sign in to comment.