Skip to content

Commit

Permalink
Drop support for EOL Python 3.7 and 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkin committed Sep 24, 2024
1 parent 0a9fdca commit 3b81d9a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']
python-version: ['pypy-3.9', '3.9', '3.10', '3.11', '3.12', '3.13-dev']
os: [ubuntu-latest, macos-latest, windows-latest]
continue-on-error: ${{ matrix.python-version == '3.12-dev' }}
continue-on-error: ${{ matrix.python-version == '3.13-dev' }}

steps:
- uses: actions/checkout@v3
Expand All @@ -29,15 +29,15 @@ jobs:
run: |
pip install . -r tests/requirements.txt pre-commit
- name: Linters
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: |
pre-commit run -a
- name: Test with pytest
run: |
pytest --cov --cov-fail-under=100
- name: Report coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v2

pypi-publish:
Expand All @@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.7'
python-version: '3.12'
- name: Install build and publish tools
run: |
pip install build twine
Expand Down
7 changes: 1 addition & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,16 @@ authors = [
{ name = "Taneli Hukkinen", email = "hukkin@users.noreply.github.com" },
]
license = { file = "LICENSE" }
requires-python = ">=3.7"
requires-python = ">=3.9"
dependencies = [
"python-dotenv >=0.10.3",
"typing-extensions >=3.7.4; python_version < '3.8'",
]
readme = "README.md"
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
Expand Down
17 changes: 2 additions & 15 deletions src/typenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@
import json
import os
import string
import sys
from types import MappingProxyType
import typing
from typing import Any, NamedTuple, TypeVar, Union

import dotenv

if sys.version_info < (3, 8): # pragma: no cover
from typing_extensions import Literal
else: # pragma: no cover
from typing import Literal
from typing import Literal


_EMPTY_MAP: MappingProxyType = MappingProxyType({})
Expand Down Expand Up @@ -73,8 +69,7 @@ def _cast_bytes(value: str) -> bytes:
For now this only deals with hex encoded strings.
"""
value = value.lower()
value = _removeprefix(value, "0x")
value = value.lower().removeprefix("0x")
if len(value) % 2:
value = "0" + value
return bytes.fromhex(value)
Expand Down Expand Up @@ -434,11 +429,3 @@ def _validate_name(self, name: _Str) -> None:
raise ValueError(
f'Invalid name "{name}": Environment variable name can not start with a number'
)


# TODO: replace this with stdlib implementation once min Python version
# is 3.9
def _removeprefix(string: str, prefix: str) -> str:
if prefix and string.startswith(prefix):
return string[len(prefix) :]
return string

0 comments on commit 3b81d9a

Please sign in to comment.