Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
# "3.10" must be a string; otherwise it is interpreted as 3.1.
python-version: ["3.11", "3.10", "3.9", "3.8", "3.7"]
python-version: ["3.11", "3.10", "3.9", "3.8"]
os: [ubuntu-latest, windows-latest, macOS-latest]
fail-fast: false

Expand All @@ -32,7 +32,7 @@ jobs:
make test

- name: Type check with pyright
if: matrix.python-version != '3.7' && steps.install.outcome == 'success' && (success() || failure())
if: steps.install.outcome == 'success' && (success() || failure())
run: |
make pyright

Expand All @@ -51,7 +51,7 @@ jobs:
if: github.event_name != 'release'
strategy:
matrix:
python-version: ["3.11", "3.10", "3.9", "3.8", "3.7"]
python-version: ["3.11", "3.10", "3.9", "3.8"]
os: [ubuntu-latest]
fail-fast: false

Expand All @@ -71,7 +71,7 @@ jobs:
if: github.event_name != 'release'
strategy:
matrix:
python-version: ["3.11", "3.10", "3.9", "3.8", "3.7"]
python-version: ["3.11", "3.10", "3.9", "3.8"]
os: [ubuntu-latest]
fail-fast: false

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Other changes

* Removed Python 3.7 support. (#590)


## [0.4.0] - 2023-06-26

Expand Down
7 changes: 1 addition & 6 deletions e2e/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@
import sys
import time
import typing
from typing import Literal, Protocol

from playwright.sync_api import FilePayload, FloatRect, Locator, Page, Position
from playwright.sync_api import expect as playwright_expect

# Import `shiny`'s typing extentions.
# Since this is a private file, tell pyright to ignore the import
# (Imports split over many import statements due to auto formatting)
from shiny._typing_extensions import (
Literal, # pyright: ignore[reportPrivateImportUsage]
)
from shiny._typing_extensions import (
Protocol, # pyright: ignore[reportPrivateImportUsage]
)
from shiny._typing_extensions import (
TypeGuard, # pyright: ignore[reportPrivateImportUsage]
)
Expand Down
5 changes: 1 addition & 4 deletions e2e/inputs/test_input_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

import datetime
import typing
from typing import Literal

from conftest import ShinyAppProc, create_doc_example_fixture
from controls import InputDate
from playwright.sync_api import Page, expect

from shiny._typing_extensions import (
Literal, # pyright: ignore[reportPrivateImportUsage]
)

app = create_doc_example_fixture("input_date")


Expand Down
5 changes: 1 addition & 4 deletions e2e/inputs/test_input_date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

import datetime
import typing
from typing import Literal

from conftest import ShinyAppProc, create_doc_example_fixture
from controls import InputDateRange
from playwright.sync_api import Page, expect

from shiny._typing_extensions import (
Literal, # pyright: ignore[reportPrivateImportUsage]
)

app = create_doc_example_fixture("input_date_range")


Expand Down
8 changes: 2 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ classifiers =
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -26,7 +25,7 @@ project_urls =
Source Code = https://github.com/rstudio/py-shiny

[options]
python_requires = >=3.7
python_requires = >=3.8
packages = find_namespace:
test_suite = tests
include_package_data = True
Expand All @@ -50,7 +49,6 @@ install_requires =
appdirs>=1.4.4
asgiref>=3.5.2
watchfiles>=0.18.0;platform_system!="Emscripten"
importlib-metadata>=1.1.0,<5;python_version<"3.8"
tests_require =
pytest>=3
zip_safe = False
Expand All @@ -76,9 +74,7 @@ test =
plotly
dev =
black>=23.1.0
# Python 3.7 needs a specific version of flake8 to satisfy other dependencies.
flake8==3.9.2;python_version<="3.7"
flake8>=6.0.0;python_version>"3.7"
flake8>=6.0.0
flake8-bugbear>=23.2.13
isort>=5.10.1
# pyright produces break changes rapidly. Fix to a particular version
Expand Down
4 changes: 1 addition & 3 deletions shiny/_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import json
import os
from typing import Any, Callable, TypeVar

from ._typing_extensions import Literal
from typing import Any, Callable, Literal, TypeVar

ex_dir: str = os.path.join(os.path.dirname(os.path.abspath(__file__)), "examples")

Expand Down
7 changes: 1 addition & 6 deletions shiny/_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

import sys

if sys.version_info >= (3, 8):
from typing import Literal, Protocol, runtime_checkable
else:
from typing_extensions import Literal, Protocol, runtime_checkable

if sys.version_info >= (3, 10):
from typing import Concatenate, ParamSpec, TypeGuard
else:
Expand All @@ -28,4 +23,4 @@
# conditional imports into the .pyi file when generating type stubs. Without this line,
# pyright will not include the above imports in the generated .pyi file, and it will
# result in a lot of red squiggles in user code.
_: 'Literal | Protocol | runtime_checkable | Concatenate[str, ParamSpec("P")] | ParamSpec | TypeGuard | NotRequired | TypedDict | assert_type' # type:ignore
_: 'Concatenate[str, ParamSpec("P")] | ParamSpec | TypeGuard | NotRequired | TypedDict | assert_type' # type:ignore
10 changes: 1 addition & 9 deletions shiny/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@
import random
import secrets
import socketserver
import sys
import tempfile
from typing import Any, Awaitable, Callable, Optional, TypeVar, cast

from ._typing_extensions import ParamSpec, TypeGuard

if sys.version_info >= (3, 8):
CancelledError = asyncio.CancelledError
else:
CancelledError = asyncio.futures.CancelledError
CancelledError = asyncio.CancelledError


# ==============================================================================
Expand Down Expand Up @@ -62,12 +58,8 @@ def guess_mime_type(
Guess the MIME type of a file. This is a wrapper for mimetypes.guess_type, but it
only returns the type (and not encoding), and it allows a default value.
"""
# In Python<=3.7, mimetypes.guess_type only accepts strings.
#
# Note that in the parameters above, "os.PathLike[str]" is in quotes to avoid
# "TypeError: 'ABCMeta' object is not subscriptable", in Python<=3.8.
if sys.version_info < (3, 8):
url = os.fspath(url)
return mimetypes.guess_type(url, strict)[0] or default


Expand Down
3 changes: 1 addition & 2 deletions shiny/experimental/ui/_accordion.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from __future__ import annotations

import random
from typing import Optional, TypeVar
from typing import Literal, Optional, TypeVar

from htmltools import Tag, TagAttrs, TagAttrValue, TagChild, css, tags

from ... import Session
from ..._typing_extensions import Literal
from ..._utils import drop_none
from ...session import require_active_session
from ...types import MISSING, MISSING_TYPE
Expand Down
3 changes: 1 addition & 2 deletions shiny/experimental/ui/_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io
import mimetypes
from pathlib import Path, PurePath
from typing import Optional
from typing import Literal, Optional, Protocol

from htmltools import (
HTML,
Expand All @@ -19,7 +19,6 @@
tags,
)

from ..._typing_extensions import Literal, Protocol
from ...types import MISSING, MISSING_TYPE
from ._css_unit import CssUnit, as_css_padding, as_css_unit
from ._fill import as_fill_carrier, as_fill_item, as_fillable_container
Expand Down
3 changes: 1 addition & 2 deletions shiny/experimental/ui/_fill.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from __future__ import annotations

from typing import Optional, TypeVar
from typing import Literal, Optional, Protocol, TypeVar, runtime_checkable

from htmltools import Tag, TagChild, Tagifiable, css

from ..._typing_extensions import Literal, Protocol, runtime_checkable
from ._css_unit import CssUnit, as_css_unit
from ._htmldeps import fill_dependency
from ._tag import tag_add_style, tag_prepend_class, tag_remove_class
Expand Down
3 changes: 1 addition & 2 deletions shiny/experimental/ui/_input_text.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
__all__ = ("input_text_area",)

from typing import Optional
from typing import Literal, Optional

from htmltools import Tag, TagChild, css, div, tags

# from ..._docstring import add_example
from ..._namespaces import resolve_id
from ..._typing_extensions import Literal
from ...ui._utils import shiny_input_label
from ._htmldeps import autoresize_dependency

Expand Down
3 changes: 1 addition & 2 deletions shiny/experimental/ui/_layout.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from __future__ import annotations

from typing import Optional
from typing import Literal, Optional

from htmltools import TagAttrs, TagAttrValue, TagChild, css, div

from ..._typing_extensions import Literal
from ._css_unit import CssUnit, as_css_unit
from ._fill import as_fill_item, as_fillable_container
from ._utils import consolidate_attrs, is_01_scalar
Expand Down
3 changes: 1 addition & 2 deletions shiny/experimental/ui/_navs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
)

import copy
from typing import Any, Optional, Sequence, cast
from typing import Any, Literal, Optional, Sequence, cast

from htmltools import MetadataNode, Tag, TagChild, TagList, css, div, tags

from ..._namespaces import resolve_id
from ..._typing_extensions import Literal
from ..._utils import private_random_int
from ...types import NavSetArg
from ...ui._html_dependencies import bootstrap_deps
Expand Down
3 changes: 1 addition & 2 deletions shiny/experimental/ui/_page.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Optional, Sequence
from typing import Literal, Optional, Sequence

from htmltools import (
MetadataNode,
Expand All @@ -13,7 +13,6 @@
tags,
)

from ..._typing_extensions import Literal
from ...types import MISSING, MISSING_TYPE, NavSetArg
from ...ui._page import page_bootstrap
from ...ui._utils import get_window_title
Expand Down
3 changes: 1 addition & 2 deletions shiny/experimental/ui/_sidebar.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from __future__ import annotations

import random
from typing import Optional
from typing import Literal, Optional

from htmltools import Tag, TagAttrs, TagAttrValue, TagChild, TagList, css, div
from htmltools import svg as svgtags
from htmltools import tags

from ... import Session
from ..._deprecated import warn_deprecated
from ..._typing_extensions import Literal
from ...session import require_active_session

# from ._color import get_color_contrast
Expand Down
4 changes: 2 additions & 2 deletions shiny/plotutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
__all__ = ("brushed_points", "near_points")


from typing import TYPE_CHECKING, Optional, Union, cast
from typing import TYPE_CHECKING, Literal, Optional, Union, cast

from ._typing_extensions import Literal, TypedDict
from ._typing_extensions import TypedDict
from .types import BrushInfo, CoordInfo, CoordXY

if TYPE_CHECKING:
Expand Down
4 changes: 3 additions & 1 deletion shiny/render/_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@
Any,
Awaitable,
Callable,
Literal,
Optional,
Protocol,
Union,
cast,
overload,
runtime_checkable,
)

from .. import _utils
from .._docstring import add_example
from .._typing_extensions import Literal, Protocol, runtime_checkable
from . import RenderFunction, RenderFunctionAsync

if TYPE_CHECKING:
Expand Down
3 changes: 2 additions & 1 deletion shiny/render/_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@
from ..session._utils import RenderedDeps
import pandas as pd

from typing import Protocol, runtime_checkable

from .. import _utils
from .._namespaces import ResolvedId
from .._typing_extensions import Protocol, runtime_checkable
from ..types import ImgData
from ._try_render_plot import try_render_matplotlib, try_render_pil, try_render_plotnine

Expand Down
4 changes: 2 additions & 2 deletions shiny/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"SilentCancelOutputException",
)

from typing import TYPE_CHECKING, Any, BinaryIO, Optional
from typing import TYPE_CHECKING, Any, BinaryIO, Literal, Optional, Protocol

from htmltools import TagChild

from ._docstring import add_example
from ._typing_extensions import Literal, NotRequired, Protocol, TypedDict
from ._typing_extensions import NotRequired, TypedDict

if TYPE_CHECKING:
from matplotlib.figure import Figure
Expand Down
3 changes: 1 addition & 2 deletions shiny/ui/_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)


from typing import Optional
from typing import Literal, Optional

from htmltools import (
Tag,
Expand All @@ -33,7 +33,6 @@

from .._deprecated import warn_deprecated
from .._docstring import add_example
from .._typing_extensions import Literal
from ..module import current_namespace
from ..types import MISSING, MISSING_TYPE
from ._html_dependencies import jqui_deps
Expand Down
Loading