Skip to content

Commit 32b3c3c

Browse files
chore: Modernize configuration (#314)
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent 0e395e3 commit 32b3c3c

7 files changed

Lines changed: 282 additions & 232 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
name: Build
22

3+
permissions:
4+
contents: read
5+
36
on:
47
push:
58
tags: ["*"]
69

7-
permissions:
8-
contents: write
9-
id-token: write
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
1013

1114
jobs:
1215
build:
13-
name: Build and Inspect
16+
name: Build wheel and sdist
1417
runs-on: ubuntu-24.04
1518
outputs:
1619
package_name: ${{ steps.baipp.outputs.package_name }}
@@ -19,7 +22,8 @@ jobs:
1922
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2023
with:
2124
fetch-depth: 0
22-
- uses: hynek/build-and-inspect-python-package@efb823f52190ad02594531168b7a2d5790e66516 # v2.14.0
25+
persist-credentials: false
26+
- uses: hynek/build-and-inspect-python-package@d44ca7d91762de7a7d5436ddae667c6da6d1c3df # v2.18.0
2327
id: baipp
2428

2529
publish:
@@ -29,15 +33,12 @@ jobs:
2933
environment:
3034
name: publishing
3135
url: https://pypi.org/p/${{ needs.build.outputs.package_name }}/${{ needs.build.outputs.package_version }}
36+
permissions:
37+
contents: write # Upload artifacts to release
38+
id-token: write # Required by pypa/gh-action-pypi-publish for trusted publishing
3239
steps:
33-
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
40+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
3441
with:
3542
name: Packages
3643
path: dist
37-
- uses: svenstaro/upload-release-action@b98a3b12e86552593f3e4e577ca8a62aa2f3f22b # 2.11.4
38-
with:
39-
file: dist/*
40-
tag: ${{ github.ref }}
41-
overwrite: true
42-
file_glob: true
43-
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
44+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

.github/workflows/test.yaml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ permissions:
2929
contents: read
3030

3131
env:
32-
FORCE_COLOR: "1"
32+
FORCE_COLOR: 1
3333
# renovate: datasource=pypi depName=tox
34-
TOX_VERSION: 4.44.0
34+
TOX_VERSION: 4.55.0
3535
# renovate: datasource=pypi depName=tox-uv
36-
TOX_UV_VERSION: 1.29.0
36+
TOX_UV_VERSION: 1.35.2
3737
# renovate: datasource=pypi depName=uv
38-
UV_VERSION: 0.10.7
38+
UV_VERSION: 0.11.17
3939

4040
jobs:
4141
build-package:
@@ -48,7 +48,7 @@ jobs:
4848
with:
4949
fetch-depth: 0
5050
persist-credentials: false
51-
- uses: hynek/build-and-inspect-python-package@efb823f52190ad02594531168b7a2d5790e66516 # v2.14.0
51+
- uses: hynek/build-and-inspect-python-package@d44ca7d91762de7a7d5436ddae667c6da6d1c3df # v2.18.0
5252
id: baipp
5353

5454
test:
@@ -63,33 +63,38 @@ jobs:
6363

6464
steps:
6565
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
66-
- uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
66+
with:
67+
persist-credentials: false
68+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
6769
with:
6870
python-version: ${{ matrix.python-version }}
6971
version: ${{ env.UV_VERSION }}
7072
- name: Run tests
7173
env:
7274
TAP_BETTERSTACK_TOKEN: ${{ secrets.TAP_BETTERSTACK_TOKEN }}
7375
TAP_BETTERSTACK_START_DATE: ${{ secrets.TAP_BETTERSTACK_START_DATE }}
76+
MATRIX_PYTHON_VERSION: ${{ matrix.python-version }}
7477
run: >
7578
uvx
76-
--with tox-uv==${{ env.TOX_UV_VERSION }}
77-
--with tox==${{ env.TOX_VERSION }}
78-
tox -e ${{ matrix.python-version }}
79+
--with tox-uv==${TOX_UV_VERSION}
80+
--with tox==${TOX_VERSION}
81+
tox -e ${MATRIX_PYTHON_VERSION}
7982
8083
lint:
8184
name: Lint
8285
runs-on: ubuntu-24.04
8386
steps:
8487
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
85-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
86-
id: setup-python
87-
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
88+
with:
89+
persist-credentials: false
90+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
8891
with:
8992
version: ${{ env.UV_VERSION }}
90-
- env:
91-
UV_PYTHON: ${{ steps.setup-python.outputs.python-path }}
92-
run: uv tool install --with tox-uv==${{ env.TOX_UV_VERSION }} --from tox==${{ env.TOX_VERSION }} tox
93+
- run: >
94+
uv tool install
95+
--with tox-uv==${TOX_UV_VERSION}
96+
--from tox==${TOX_VERSION}
97+
tox
9398
- name: Static type checking
9499
run: tox -e typing
95100
- name: Unused, missing and transitive dependencies

.pre-commit-config.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ repos:
1818
- id: trailing-whitespace
1919

2020
- repo: https://github.com/tox-dev/pyproject-fmt
21-
rev: "v2.16.2"
21+
rev: v2.23.0
2222
hooks:
2323
- id: pyproject-fmt
2424

2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: "v0.15.4"
26+
rev: v0.15.15
2727
hooks:
2828
- id: ruff-check
2929
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
3030
- id: ruff-format
3131

3232
- repo: https://github.com/python-jsonschema/check-jsonschema
33-
rev: 0.37.0
33+
rev: 0.37.2
3434
hooks:
3535
- id: check-github-workflows
3636
- id: check-renovate
@@ -39,7 +39,7 @@ repos:
3939
- pyjson5==2.0.0
4040

4141
- repo: https://github.com/astral-sh/uv-pre-commit
42-
rev: "0.10.7"
42+
rev: 0.11.17
4343
hooks:
4444
- id: uv-lock
4545
- id: uv-sync
@@ -48,3 +48,8 @@ repos:
4848
rev: 1.0.0
4949
hooks:
5050
- id: mdformat
51+
52+
- repo: https://github.com/crate-ci/typos
53+
rev: v1.47.0
54+
hooks:
55+
- id: typos

meltano.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
version: 1
21
send_anonymous_usage_stats: false
2+
requires_meltano: ">=4.0"
33
project_id: tap-betterstack
44
default_environment: dev
55
environments:
@@ -17,6 +17,7 @@ plugins:
1717
- state
1818
- catalog
1919
- discover
20+
- structured-logging
2021
settings:
2122
- name: token
2223
kind: password
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"plugin_type": "loaders",
3+
"name": "target-jsonl",
4+
"namespace": "target_jsonl",
5+
"variant": "andyh1203",
6+
"label": "JSON Lines (JSONL)",
7+
"docs": "https://hub.meltano.com/loaders/target-jsonl--andyh1203",
8+
"repo": "https://github.com/andyh1203/target-jsonl",
9+
"pip_url": "target-jsonl",
10+
"description": "JSONL loader",
11+
"logo_url": "https://hub.meltano.com/assets/logos/loaders/jsonl.png",
12+
"settings": [
13+
{
14+
"name": "destination_path",
15+
"kind": "string",
16+
"value": "output",
17+
"label": "Destination Path",
18+
"description": "Sets the destination path the JSONL files are written to, relative\nto the project root.\n\nThe directory needs to exist already, it will not be created\nautomatically.\n\nTo write JSONL files to the project root, set an empty string (`\"\"`).\n"
19+
},
20+
{
21+
"name": "do_timestamp_file",
22+
"kind": "boolean",
23+
"value": false,
24+
"label": "Include Timestamp in File Names",
25+
"description": "Specifies if the files should get timestamped.\n\nBy default, the resulting file will not have a timestamp in the file name (i.e. `exchange_rate.jsonl`).\n\nIf this option gets set to `true`, the resulting file will have a timestamp associated with it (i.e. `exchange_rate-{timestamp}.jsonl`).\n"
26+
},
27+
{
28+
"name": "custom_name",
29+
"kind": "string",
30+
"label": "Custom File Name Override",
31+
"description": "Specifies a custom name for the filename, instead of the stream name.\n\nThe file name will be `{custom_name}-{timestamp}.jsonl`, if `do_timestamp_file` is `true`.\nOtherwise the file name will be `{custom_name}.jsonl`.\n\nIf custom name is not provided, the stream name will be used.\n"
32+
}
33+
]
34+
}

pyproject.toml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ keywords = [
1515
"singer.io",
1616
]
1717
license = "Apache-2.0"
18-
license-files = [
19-
"LICENSE",
20-
]
2118
requires-python = ">=3.12"
2219
classifiers = [
2320
"Programming Language :: Python :: 3 :: Only",
@@ -29,7 +26,7 @@ dynamic = [
2926
"version",
3027
]
3128
dependencies = [
32-
"singer-sdk~=0.54.0a4",
29+
"singer-sdk~=0.54.4",
3330
]
3431
[[project.authors]]
3532
name = "Edgar Ramírez-Mondragón"
@@ -43,26 +40,28 @@ Repository = "https://github.com/reservoir-data/tap-betterstack"
4340

4441
[dependency-groups]
4542
dev = [
43+
"deptry>=0.25.1",
4644
{ include-group = "testing" },
4745
{ include-group = "typing" },
4846
]
4947
ci = [
5048
"pytest-github-actions-annotate-failures>=0.3",
5149
]
5250
testing = [
53-
"deptry>=0.12",
5451
"singer-sdk[testing]",
5552
]
5653
typing = [
57-
"mypy>=1.19.1",
58-
"ty>=0.0.19",
59-
"types-requests",
54+
"mypy>=2.1",
55+
"ty>=0.0.40",
6056
]
6157

62-
[tool.hatch]
6358
[tool.hatch.version]
59+
fallback-version = "0.0.0.dev0"
6460
source = "vcs"
6561

62+
[tool.uv]
63+
required-version = ">=0.11"
64+
6665
[tool.ruff]
6766
required-version = ">=0.15"
6867
line-length = 88
@@ -86,41 +85,49 @@ unfixable = [
8685
"ERA001", # commented-out-code
8786
]
8887
flake8-annotations.allow-star-arg-any = true
89-
isort.required-imports = [
90-
"from __future__ import annotations",
91-
]
9288
pydocstyle.convention = "google"
9389

9490
[tool.pyproject-fmt]
9591
table_format = "long"
9692

93+
[tool.mypy]
94+
warn_redundant_casts = true
95+
warn_unused_ignores = true
96+
warn_no_return = true
97+
warn_return_any = true
98+
warn_unreachable = true
99+
enable_error_code = [ "ignore-without-code", "redundant-expr", "truthy-bool" ]
100+
strict = true
101+
warn_unused_configs = true
102+
97103
[tool.pytest]
98104
addopts = [
99-
"-vvv",
100-
"--strict-config",
101-
"--strict-markers",
105+
"-v",
102106
"-ra",
103107
]
104108
filterwarnings = [ "error" ]
105109
log_level = "INFO"
106110
minversion = "9"
111+
strict = true
107112
testpaths = [ "tests" ]
108-
xfail_strict = true
109113

110114
[tool.tox]
111115
min_version = "4.43"
112-
requires = [ "tox", "tox-uv" ]
116+
requires = [
117+
"tox>=4.55",
118+
"tox-uv>=1.35",
119+
]
113120
env_list = [
114121
"dependencies",
115122
"typing",
116-
{ product = [
117-
{ prefix = "3.", start = 12 },
118-
] },
123+
{ prefix = "3.", start = 12 },
119124
]
120125
[tool.tox.env.dependencies]
121-
dependency_groups = [ "testing" ]
126+
description = "check for unused, missing and transitive dependencies"
127+
dependency_groups = [ "dev" ]
122128
commands = [ [ "deptry", "." ] ]
123129
[tool.tox.env.typing]
130+
description = "type checks"
124131
dependency_groups = [ "testing", "typing" ]
125132
commands = [
126133
[ "mypy", { replace = "posargs", default = [ "tap_betterstack", "tests" ], extend = true } ],
@@ -129,15 +136,8 @@ commands = [
129136

130137
[tool.tox.env_run_base]
131138
runner = "uv-venv-lock-runner"
132-
pass_env = [ "TAP_BETTERSTACK_*" ]
139+
description = "run unit tests on Python {py_dot_ver}"
133140
dependency_groups = [ "testing" ]
141+
pass_env = [ "TAP_BETTERSTACK_*" ]
134142
commands = [ [ "pytest", { replace = "posargs", default = [ "tests" ], extend = true } ] ]
135-
136-
[tool.mypy]
137-
enable_error_code = [ "ignore-without-code", "redundant-expr", "truthy-bool" ]
138-
strict = true
139-
warn_no_return = true
140-
warn_redundant_casts = true
141-
warn_unreachable = true
142-
warn_unused_configs = true
143-
warn_unused_ignores = true
143+
base_python_file = [ ".python-version" ]

0 commit comments

Comments
 (0)