Skip to content

Commit

Permalink
chore: Drop support for Python 3.7 and modernize tap (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon authored Feb 6, 2024
1 parent da49600 commit 5605c64
Show file tree
Hide file tree
Showing 14 changed files with 1,426 additions and 1,390 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on: [push]
jobs:
linting:
env:
POETRY_VERSION: "1.2.2"
POETRY_VERSION: "1.7.1"
runs-on: ubuntu-latest
strategy:
matrix:
# Only lint using the primary version used for dev
python-version: ["3.10"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
Expand All @@ -29,10 +29,11 @@ jobs:

- name: Install dependencies
run: |
poetry install
pipx install tox
- name: Run lint command from tox.ini
run: |
poetry run tox -e lint
tox -e lint
pytest:

Expand All @@ -42,7 +43,7 @@ jobs:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ci:
autofix_prs: true
autofix_commit_msg: '[pre-commit.ci] auto fixes'
autoupdate_schedule: weekly
autoupdate_commit_msg: 'chore(deps): pre-commit autoupdate'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-json
exclude: "\\.vscode/.*.json"
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.7.0"
hooks:
- id: pyproject-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.2.0'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
pass_filenames: true
additional_dependencies:
- types-requests
2,223 changes: 1,098 additions & 1,125 deletions poetry.lock

Large diffs are not rendered by default.

104 changes: 82 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[build-system]
build-backend = "poetry.core.masonry.api"
requires = [
"poetry-core==1.9",
]

[tool.poetry]
name = "tap-google-analytics"
version = "0.0.6"
Expand All @@ -7,32 +13,86 @@ keywords = [
"ELT",
"GoogleAnalytics",
]
license = "Apache 2.0"
license = "Apache-2.0"

[tool.poetry.dependencies]
python = ">=3.7.1,<3.12" # Tested up to 3.11
singer-sdk = "^0.27.0"
google-analytics-data = "0.14.2"

[tool.poetry.dev-dependencies]
pytest = "^7.2.1"
tox = "^3.28.0"
flake8 = "^5.0.4"
black = "^23.1"
pydocstyle = "^6.1.1"
mypy = "^1.0"
isort = "^5.11.5"
coverage = "^7.1"

[tool.isort]
profile = "black"
multi_line_output = 3 # Vertical Hanging Indent
src_paths = "tap_google_analytics"
python = ">=3.8"
backports-datetime-fromisoformat = {version = "~=2.0.1", python = "<3.11"}
singer-sdk = "~=0.35.0"
google-analytics-data = "~=0.14.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.group.dev.dependencies]
pytest = ">=7.2.1"
coverage = ">=7.1"
mypy = ">=1.8"
ruff = ">=0.2.1"

[tool.poetry.scripts]
# CLI declaration
tap-google-analytics = 'tap_google_analytics.tap:TapGoogleAnalytics.cli'

[tool.ruff]
line-length = 100
target-version = "py38"

[tool.ruff.lint]
ignore = [
"COM812",
"ISC001",
]
select = [
"F", # Pyflakes
"W", # pycodestyle (warnings)
"E", # pycodestyle (errors)
"C90", # mccabe
"I", # isort
"N", # pep8-naming
"D", # pydocstyle
"UP", # pyupgrade
"YTT", # flake8-2020
"S", # flake8-bandit
"BLE", # flake8-blind-except
"FBT", # flake8-boolean-trap
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T20", # flake8-print
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"PGH", # pygrep-hooks
"PL", # Pylint
"TRY", # tryceratops
"FLY", # flynt
"PERF", # perflint
"FURB", # refurb
"LOG", # flake8-logging
"RUF", # Ruff-specific rules
]
unfixable = [
"ERA",
]

[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101"]

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

0 comments on commit 5605c64

Please sign in to comment.