Skip to content

Commit

Permalink
added the changes in drop support for python 3.7 from v1
Browse files Browse the repository at this point in the history
  • Loading branch information
BuzzCutNorman committed Oct 19, 2023
1 parent dde28c2 commit 77236d9
Show file tree
Hide file tree
Showing 19 changed files with 76 additions and 84 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ body:
description: Version of Python you are using
options:
- "3.6 (deprecated)"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "NA"
validations:
required: true
Expand Down Expand Up @@ -75,6 +75,6 @@ body:
attributes:
label: Code
description: Paste the failing code and/or traceback, if applicable
render: python
render: Python
validations:
required: false
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
matrix:
session: [tests]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
sqlalchemy: ["2.*"]
include:
- { session: tests, python-version: "3.11", os: "ubuntu-latest", sqlalchemy: "1.*" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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"]
steps:
- uses: actions/checkout@v3
- name: Set up Python {{ '${{ matrix.python-version }}' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ keywords = [
"ELT",
"{{cookiecutter.source_name}}",
]
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
license = "Apache-2.0"
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
Expand Down Expand Up @@ -51,7 +59,7 @@ ignore = [
]
select = ["ALL"]
src = ["{{cookiecutter.library_name}}"]
target-version = "py37"
target-version = "py38"


[tool.ruff.flake8-annotations]
Expand Down
4 changes: 2 additions & 2 deletions cookiecutter/tap-template/{{cookiecutter.tap_id}}/tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file can be used to customize tox tests as well as other test frameworks like flake8 and mypy

[tox]
envlist = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311
isolated_build = true

[testenv]
Expand All @@ -13,7 +13,7 @@ commands =
[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
envlist = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311
commands =
poetry install -v
poetry run pytest
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ from {{ cookiecutter.library_name }}.auth import {{ cookiecutter.source_name }}A

{% endif -%}

{%- if cookiecutter.auth_method in ("OAuth2", "JWT") -%}
if sys.version_info >= (3, 8):
from functools import cached_property
else:
from cached_property import cached_property

{% endif -%}

_Auth = Callable[[requests.PreparedRequest], requests.PreparedRequest]
SCHEMAS_DIR = Path(__file__).parent / Path("./schemas")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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"]
steps:
- uses: actions/checkout@v3
- name: Set up Python {{ '${{ matrix.python-version }}' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ keywords = [
"ELT",
"{{cookiecutter.destination_name}}",
]
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
license = "Apache-2.0"
{%- if cookiecutter.variant != "None (Skip)" %}
packages = [
Expand Down Expand Up @@ -41,7 +49,7 @@ ignore = [
]
select = ["ALL"]
src = ["{{cookiecutter.library_name}}"]
target-version = "py37"
target-version = "py38"

[tool.ruff.flake8-annotations]
allow-star-arg-any = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file can be used to customize tox tests as well as other test frameworks like flake8 and mypy

[tox]
envlist = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311
isolated_build = true

[testenv]
Expand All @@ -13,7 +13,7 @@ commands =
[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
envlist = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311
commands =
poetry install -v
poetry run pytest
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
COOKIECUTTER_REPLAY_FILES = list(Path("./e2e-tests/cookiecutters").glob("*.json"))

package = "singer_sdk"
python_versions = ["3.11", "3.10", "3.9", "3.8", "3.7"]
python_versions = ["3.11", "3.10", "3.9", "3.8"]
main_python_version = "3.10"
locations = "singer_sdk", "tests", "noxfile.py", "docs/conf.py"
nox.options.sessions = (
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ license = "Apache-2.0"
"Youtube" = "https://www.youtube.com/meltano"

[tool.poetry.dependencies]
python = ">=3.8,<4"
python = "<4,>=3.8"
backoff = ">=2.0.0"
click = "~=8.0"
cryptography = ">=3.4.6,<42.0.0"
fs = ">=2.4.16"
importlib-metadata = {version = "<7.0.0", markers = "python_version < \"3.8\""}
importlib-resources = {version = ">=5.12.0", markers = "python_version < \"3.9\""}
inflection = ">=0.5.1"
joblib = ">=1.0.1"
Expand Down Expand Up @@ -71,7 +70,7 @@ sphinx-copybutton = {version = ">=0.3.1", optional = true}
myst-parser = {version = ">=1", optional = true}
sphinx-autobuild = {version = ">=2021.3.14", optional = true}
sphinx-reredirects = {version = ">=0.1.1", optional = true}
sphinx-inline-tabs = {version = ">=2023.4.21", optional = true, markers = "python_version >= \"3.8\""}
sphinx-inline-tabs = {version = ">=2023.4.21", optional = true}

# File storage dependencies installed as optional 'filesystem' extras
fs-s3fs = {version = ">=1.1.1", optional = true}
Expand Down Expand Up @@ -104,10 +103,7 @@ coverage = {extras = ["toml"], version = ">=7.2"}
duckdb = ">=0.8.0"
duckdb-engine = ">=0.9.2"
mypy = ">=1.0"
numpy = [
{ version = "<1.22", python = "<3.8" },
{ version = ">=1.22", python = ">=3.8" },
]
numpy = ">=1.22"
pyarrow = ">=11,<13"
pytest-benchmark = "^4.0.0"
pytest-snapshot = ">=0.9.0"
Expand Down Expand Up @@ -285,8 +281,6 @@ unfixable = [
"tests/*" = ["ANN", "D1", "D2", "FBT001", "FBT003", "PLR2004", "S101"]
# Disabled some checks in samples code
"samples/*" = ["ANN", "D"]
# Don't require docstrings conventions or type annotations in private modules
"singer_sdk/helpers/_*.py" = ["ANN", "D105"]
# Templates support a generic resource of type Any.
"singer_sdk/testing/*.py" = ["S101"]
"singer_sdk/testing/templates.py" = ["ANN401"]
Expand Down
10 changes: 5 additions & 5 deletions singer_sdk/helpers/_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SDKBatchMessage(Message):
manifest: list[str] = field(default_factory=list)
"""The manifest of files in the batch."""

def __post_init__(self):
def __post_init__(self) -> None:
if isinstance(self.encoding, dict):
self.encoding = BaseBatchFileEncoding.from_dict(self.encoding)

Expand All @@ -102,7 +102,7 @@ class StorageTarget:
params: dict = field(default_factory=dict)
""""The storage parameters."""

def asdict(self):
def asdict(self) -> dict[str, t.Any]:
"""Return a dictionary representation of the message.
Returns:
Expand Down Expand Up @@ -134,7 +134,7 @@ def split_url(url: str) -> tuple[str, str]:
"""
if platform.system() == "Windows" and "\\" in url:
# Original code from pyFileSystem split
# Augemnted slitly to properly Windows paths
# Augmented slightly to properly handle Windows path
split = url.rsplit("\\", 1)
return (split[0] or "\\", split[1])

Expand Down Expand Up @@ -214,7 +214,7 @@ class BatchConfig:
batch_size: int = DEFAULT_BATCH_SIZE
"""The max number of records in a batch."""

def __post_init__(self):
def __post_init__(self) -> None:
if isinstance(self.encoding, dict):
self.encoding = BaseBatchFileEncoding.from_dict(self.encoding)

Expand All @@ -224,7 +224,7 @@ def __post_init__(self):
if self.batch_size is None:
self.batch_size = DEFAULT_BATCH_SIZE

def asdict(self):
def asdict(self) -> dict[str, t.Any]:
"""Return a dictionary representation of the message.
Returns:
Expand Down
12 changes: 8 additions & 4 deletions singer_sdk/helpers/_flattening.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def flatten_key(key_name: str, parent_keys: list[str], separator: str = "__") ->
inflection.camelize(inflected_key[reducer_index]),
)
inflected_key[reducer_index] = (
reduced_key if len(reduced_key) > 1 else inflected_key[reducer_index][0:3]
reduced_key if len(reduced_key) > 1 else inflected_key[reducer_index][:3]
).lower()
reducer_index += 1

Expand Down Expand Up @@ -358,8 +358,8 @@ def _flatten_schema( # noqa: C901, PLR0912
items.append((new_key, next(iter(field_schema.values()))[0]))

# Sort and check for duplicates
def _key_func(item):
return item[0] # first item is tuple is the key name.
def _key_func(item: tuple[str, dict]) -> str:
return item[0] # first item in tuple is the key name.

sorted_items = sorted(items, key=_key_func)
for field_name, g in itertools.groupby(sorted_items, key=_key_func):
Expand Down Expand Up @@ -451,7 +451,11 @@ def _flatten_record(
return dict(items)


def _should_jsondump_value(key: str, value: t.Any, flattened_schema=None) -> bool:
def _should_jsondump_value(
key: str,
value: t.Any, # noqa: ANN401
flattened_schema: dict[str, t.Any] | None = None,
) -> bool:
"""Return True if json.dump() should be used to serialize the value.
Args:
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/helpers/_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def is_common_secret_key(key_name: str) -> bool:
class SecretString(str):
"""For now, this class wraps a sensitive string to be identified as such later."""

def __init__(self, contents):
def __init__(self, contents: str) -> None:
"""Initialize secret string."""
self.contents = contents

Expand Down
Loading

0 comments on commit 77236d9

Please sign in to comment.