diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b5a033..ef79516 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,10 +8,8 @@ repos: rev: 'v0.7.3' hooks: - id: ruff - - repo: https://github.com/psf/black - rev: 24.10.0 - hooks: - - id: black + args: ["--fix"] + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.13.0 hooks: diff --git a/.yamllint b/.yamllint index a4f47b7..ae0d5d5 100644 --- a/.yamllint +++ b/.yamllint @@ -8,3 +8,4 @@ rules: max: 130 truthy: check-keys: false + new-lines: disable diff --git a/README.md b/README.md index 43b73e9..057121c 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ knowledge of BCP required!! (pronounced _BEE-CEE-Pandas_) + - [Quickstart](#quickstart) - [IMPORTANT - Read vs. Write](#important---read-vs-write) - [Benchmarks](#benchmarks) diff --git a/TODO.MD b/TODO.MD index b00b962..3fed40a 100644 --- a/TODO.MD +++ b/TODO.MD @@ -3,6 +3,7 @@ + - [Completed](#completed) - [Open](#open) - [General](#general) diff --git a/bcpandas/main.py b/bcpandas/main.py index 67baabe..4b94801 100644 --- a/bcpandas/main.py +++ b/bcpandas/main.py @@ -195,9 +195,7 @@ def _sql_item_exists(sql_type: str, schema: str, table_name: str, creds: SqlCred FROM INFORMATION_SCHEMA.{_typ}S WHERE TABLE_SCHEMA = '{_schema}' AND TABLE_NAME = '{_tbl}' - """.format( - _typ=sql_type.upper(), _schema=schema, _tbl=table_name - ) + """.format(_typ=sql_type.upper(), _schema=schema, _tbl=table_name) ) res = pd.read_sql_query(sql=_qry, con=creds.engine) return res.shape[0] > 0 @@ -247,9 +245,7 @@ def _handle_cols_for_append( FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '{_schema}' AND TABLE_NAME = '{_tbl}' - """.format( - _schema=schema, _tbl=table_name - ) + """.format(_schema=schema, _tbl=table_name) ), creds.engine, ).values diff --git a/pyproject.toml b/pyproject.toml index bfd9b7e..0e75abf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,44 +50,21 @@ requests = "*" build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] -# Example configuration for Black. - -# NOTE: you have to use single-quoted strings in TOML for regular expressions. -# It's the equivalent of r-strings in Python. Multiline strings are treated as -# verbose regular expressions by Black. Use [ ] to denote a significant space -# character. - -[tool.black] -exclude = ''' -/( - \.eggs - | \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist -)/ -''' -include = '\.pyi?$' -line-length = 99 -target-version = ["py38"] - [tool.ruff] exclude = ["build"] ignore = ["E501"] line-length = 99 + +target-version = "py38" + +[tool.ruff.lint] select = [ "E", "F", "W", ] -target-version = "py38" -[tool.ruff.isort] +[tool.ruff.lint.isort] combine-as-imports = true force-sort-within-sections = true force-wrap-aliases = true @@ -99,7 +76,7 @@ keep-runtime-typing = true [tool.mypy] ignore_missing_imports = true pretty = true -python_version = 3.8 +python_version = "3.8" show_error_codes = true [tool.pytest.ini_options] diff --git a/tests/test_to_sql.py b/tests/test_to_sql.py index 30d4627..428dd94 100644 --- a/tests/test_to_sql.py +++ b/tests/test_to_sql.py @@ -201,9 +201,7 @@ def test_tosql_empty_df(df, sql_creds): FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{_schema}' AND TABLE_NAME = '{_tbl}' - """.format( - _tbl=tbl_name, _schema=schema_name - ) + """.format(_tbl=tbl_name, _schema=schema_name) res = pd.read_sql_query(sql=qry, con=sql_creds.engine) # assert that rows == 0, it has columns even without rows because it is an internal system table assert res.shape[0] == 0