Skip to content

Commit

Permalink
Declare missing dependencies (#290)
Browse files Browse the repository at this point in the history
* Sort dependencies
* Add missing dependencies to `setup.py`
* Don't require importlib_metadata on Python 3.8+
* Don't require typing-extensions on Python 3.8+
  • Loading branch information
squahtx authored Dec 14, 2021
1 parent 2a532dc commit d85aa6c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
1 change: 1 addition & 0 deletions changelog.d/290.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add missing dependencies to `setup.py`.
26 changes: 15 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,38 @@
from setuptools import find_packages, setup

INSTALL_REQUIRES = [
"Twisted>=19.7",
"prometheus_client>=0.7.0,<0.8",
"aioapns>=1.10",
"attrs>=19.2.0",
"cryptography>=2.6.1",
"pyyaml>=5.1.1",
"service_identity>=18.1.0",
"idna>=2.8",
'importlib_metadata;python_version<"3.8"',
"jaeger-client>=4.0.0",
"matrix-common==1.0.0",
"opentracing>=2.2.0",
"prometheus_client>=0.7.0,<0.8",
"py-vapid>=1.7.0",
"pyOpenSSL>=17.5.0",
"pywebpush>=1.13.0",
"pyyaml>=5.1.1",
"sentry-sdk>=0.10.2",
"service_identity>=18.1.0",
"Twisted>=19.7",
'typing-extensions>=3.7.4;python_version<"3.8"',
"zope.interface>=4.6.0",
"idna>=2.8",
"importlib_metadata",
"pywebpush>=1.13.0",
"py-vapid>=1.7.0",
"matrix-common==1.0.0",
]

EXTRAS_REQUIRE = {
"dev": [
"coverage~=5.5",
"black==21.6b0",
"coverage~=5.5",
"flake8==3.9.0",
"isort~=5.0",
"mypy==0.812",
"mypy-zope==0.3.0",
"tox",
"towncrier",
"tox",
"types-opentracing>=2.4.2",
"typing-extensions>=3.7.4",
]
}

Expand Down
11 changes: 10 additions & 1 deletion sygnal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from importlib_metadata import PackageNotFoundError, version
try:
from importlib.metadata import ( # type: ignore[attr-defined]
PackageNotFoundError,
version,
)
except ImportError:
from importlib_metadata import ( # type: ignore[misc,no-redef]
PackageNotFoundError,
version,
)

try:
__version__ = version(__name__)
Expand Down
8 changes: 6 additions & 2 deletions sygnal/apnstruncate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
# Copied and adapted from
# https://raw.githubusercontent.com/matrix-org/pushbaby/master/pushbaby/truncate.py
import json
from typing import Any, Dict, List, Optional, Tuple, Union
import sys
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union

from typing_extensions import Literal
if TYPE_CHECKING or sys.version_info < (3, 8, 0):
from typing_extensions import Literal
else:
from typing import Literal

Choppable = Union[
Tuple[Literal["alert", "alert.body"]], Tuple[Literal["alert.loc-args"], int]
Expand Down

0 comments on commit d85aa6c

Please sign in to comment.