Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Python 3.5 and 3.6 and upgrade GA #393

Merged
merged 6 commits into from Jul 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Expand Up @@ -10,15 +10,15 @@ jobs:
matrix:
os:
- ubuntu-latest
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11.0-alpha - 3.11", pypy3]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-beta.4 - 3.11", pypy3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
run:
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Expand Up @@ -31,7 +31,7 @@ def read_files(files):
package_data={
'dotenv': ['py.typed'],
},
python_requires=">=3.5",
python_requires=">=3.7",
extras_require={
'cli': ['click>=5.0', ],
},
Expand All @@ -45,8 +45,6 @@ def read_files(files):
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
Expand Down
21 changes: 8 additions & 13 deletions src/dotenv/main.py
Expand Up @@ -14,11 +14,6 @@

logger = logging.getLogger(__name__)

if sys.version_info >= (3, 6):
_PathLike = os.PathLike
else:
_PathLike = str


def with_warn_for_invalid_lines(mappings: Iterator[Binding]) -> Iterator[Binding]:
for mapping in mappings:
Expand All @@ -33,14 +28,14 @@ def with_warn_for_invalid_lines(mappings: Iterator[Binding]) -> Iterator[Binding
class DotEnv():
def __init__(
self,
dotenv_path: Optional[Union[str, _PathLike]],
dotenv_path: Optional[Union[str, os.PathLike]],
stream: Optional[IO[str]] = None,
verbose: bool = False,
encoding: Union[None, str] = None,
interpolate: bool = True,
override: bool = True,
) -> None:
self.dotenv_path = dotenv_path # type: Optional[Union[str, _PathLike]]
self.dotenv_path = dotenv_path # type: Optional[Union[str, os.PathLike]]
self.stream = stream # type: Optional[IO[str]]
self._dict = None # type: Optional[Dict[str, Optional[str]]]
self.verbose = verbose # type: bool
Expand Down Expand Up @@ -113,7 +108,7 @@ def get(self, key: str) -> Optional[str]:


def get_key(
dotenv_path: Union[str, _PathLike],
dotenv_path: Union[str, os.PathLike],
key_to_get: str,
encoding: Optional[str] = "utf-8",
) -> Optional[str]:
Expand All @@ -127,7 +122,7 @@ def get_key(

@contextmanager
def rewrite(
path: Union[str, _PathLike],
path: Union[str, os.PathLike],
encoding: Optional[str],
) -> Iterator[Tuple[IO[str], IO[str]]]:
try:
Expand All @@ -146,7 +141,7 @@ def rewrite(


def set_key(
dotenv_path: Union[str, _PathLike],
dotenv_path: Union[str, os.PathLike],
key_to_set: str,
value_to_set: str,
quote_mode: str = "always",
Expand Down Expand Up @@ -195,7 +190,7 @@ def set_key(


def unset_key(
dotenv_path: Union[str, _PathLike],
dotenv_path: Union[str, os.PathLike],
key_to_unset: str,
quote_mode: str = "always",
encoding: Optional[str] = "utf-8",
Expand Down Expand Up @@ -310,7 +305,7 @@ def _is_interactive():


def load_dotenv(
dotenv_path: Union[str, _PathLike, None] = None,
dotenv_path: Union[str, os.PathLike, None] = None,
stream: Optional[IO[str]] = None,
verbose: bool = False,
override: bool = False,
Expand Down Expand Up @@ -348,7 +343,7 @@ def load_dotenv(


def dotenv_values(
dotenv_path: Union[str, _PathLike, None] = None,
dotenv_path: Union[str, os.PathLike, None] = None,
stream: Optional[IO[str]] = None,
verbose: bool = False,
interpolate: bool = True,
Expand Down
8 changes: 2 additions & 6 deletions tox.ini
Expand Up @@ -3,22 +3,20 @@ envlist = lint,py{35,36,37,38,39,310,311},pypy3,manifest,coverage-report

[gh-actions]
python =
3.5: py35, coverage-report
3.6: py36, coverage-report
3.7: py37, coverage-report
3.8: py38, coverage-report
3.9: py39, coverage-report
3.10: py310, lint, manifest, coverage-report
3.11: py311, coverage-report
pypy3: pypy3, coverage-report
pypy-3.9: pypy3, coverage-report

[testenv]
deps =
pytest
coverage
sh
click
py{35,36,37,38,39,310,311,py3}: ipython
py{37,38,39,310,311,py3}: ipython
commands = coverage run --parallel -m pytest {posargs}

[testenv:lint]
Expand All @@ -33,8 +31,6 @@ commands =
mypy --python-version=3.9 src tests
mypy --python-version=3.8 src tests
mypy --python-version=3.7 src tests
mypy --python-version=3.6 src tests
mypy --python-version=3.5 src tests

[testenv:manifest]
deps = check-manifest
Expand Down