diff --git a/.github/workflows/changelog_check.yml b/.github/workflows/changelog_check.yml index 0416535a..a8d592b1 100644 --- a/.github/workflows/changelog_check.yml +++ b/.github/workflows/changelog_check.yml @@ -12,6 +12,6 @@ jobs: ref: ${{github.event.pull_request.head.sha}} - uses: actions/setup-python@v4 with: - python-version: "3.7" + python-version: "3.10" - run: python -m pip install towncrier - run: "scripts-dev/check_newsfragment.sh ${{ github.event.number }}" diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index f747f349..78fd285e 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -4,36 +4,36 @@ on: branches: ["main"] pull_request: -jobs: +jobs: check-code-style: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.7" + python-version: "3.10" - run: python -m pip install tox - run: tox -e check_codestyle - + check-types-mypy: runs-on: ubuntu-latest - steps: + steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.7" - - run: python -m pip install tox + python-version: "3.10" + - run: python -m pip install tox - run: tox -e check_types run-unit-tests: name: Unit tests needs: [check-code-style, check-types-mypy] runs-on: ubuntu-latest - steps: + steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.7" + python-version: "3.10" - run: python -m pip install -e . - run: python -m twisted.trial tests @@ -45,7 +45,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.7" + python-version: "3.8" - name: Patch pyproject.toml to require oldest dependencies run: | # Ugly. Could use something like https://pyproject-parser.readthedocs.io/en/latest/cli.html#info in the future. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a2d2a7d3..7790857d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ this case, the [Apache Software License v2](LICENSE). ### Create a virtualenv -To contribute to Sygnal, ensure you have Python 3.7 or newer and then run: +To contribute to Sygnal, ensure you have Python 3.8 or newer and then run: ```bash python3 -m venv venv @@ -17,8 +17,8 @@ This creates an isolated virtual Python environment ("virtualenv") just for use with Sygnal, then installs Sygnal along with its dependencies, and lastly installs a handful of useful tools -If you get `ConnectTimeoutError`, this is caused by slow internet whereby -`pip` has a default time out of _15 sec_. You can specify a larger timeout +If you get `ConnectTimeoutError`, this is caused by slow internet whereby +`pip` has a default time out of _15 sec_. You can specify a larger timeout by passing `--timeout 120` to the `pip install` command above. Finally, activate the virtualenv by running: @@ -90,7 +90,7 @@ Many of the conventions are enforced by scripts which are run as part of the [continuous integration system](#continuous-integration-and-testing). To help check and fix adherence to the code style, you can run `tox` -locally. You'll need Python 3.7 or later, and a virtual environment configured and +locally. You'll need Python 3.8 or later, and a virtual environment configured and active: ```bash @@ -251,7 +251,7 @@ and update your branch. After installing tox with `pip install tox`, you can use the following to run unit tests and lints in a local development environment: -- `tox -e py37` to run unit tests on Python 3.7. +- `tox -e py38` to run unit tests on Python 3.8. - `tox -e check_codestyle` to check code style and formatting. - `tox -e check_types` to check types with MyPy. - `tox` **to do all of the above.** diff --git a/README.md b/README.md index b4e67fee..fb11ce66 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ With custom configuration file name: SYGNAL_CONF=/path/to/custom_sygnal.conf python -m sygnal.sygnal ``` -Python 3.7 or higher is required. +Python 3.8 or higher is required. Log Rotation diff --git a/changelog.d/343.removal b/changelog.d/343.removal new file mode 100644 index 00000000..e08df4c1 --- /dev/null +++ b/changelog.d/343.removal @@ -0,0 +1 @@ +Remove support for Python 3.7. diff --git a/docker/Dockerfile b/docker/Dockerfile index 2b3acb64..0b37cc3f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,7 +9,7 @@ ### ### Stage 0: builder ### -FROM python:3.7-slim as builder +FROM python:3.10-slim as builder # Install git; Sygnal uses it to obtain the package version from the state of the # git repository. @@ -25,7 +25,7 @@ RUN pip install --prefix="/install" --no-warn-script-location /sygnal ### Stage 1: runtime ### -FROM python:3.7-slim +FROM python:3.10-slim COPY --from=builder /install /usr/local EXPOSE 5000/tcp diff --git a/mypy.ini b/mypy.ini index d8fb16ad..221bcf20 100644 --- a/mypy.ini +++ b/mypy.ini @@ -30,9 +30,6 @@ ignore_missing_imports = True [mypy-prometheus_client] ignore_missing_imports = True -[mypy-importlib_metadata] -ignore_missing_imports = True - [mypy-setuptools] ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml index 2ebd7ee1..24674ee7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,7 +68,7 @@ name = "matrix-sygnal" dynamic = ["version"] description = "Reference Push Gateway for Matrix Notifications" readme = {file = "README.md", content-type = "text/markdown"} -requires-python = "~=3.7" +requires-python = "~=3.8" license = {file = "LICENSE"} authors = [ {name = "Matrix.org Team and contributors", email = "packages@matrix.org"} @@ -78,7 +78,6 @@ dependencies = [ "attrs>=19.2.0", "cryptography>=2.6.1", "idna>=2.8", - 'importlib_metadata;python_version<"3.8"', "jaeger-client>=4.0.0", "matrix-common==1.0.0", "opentracing>=2.2.0", @@ -90,8 +89,7 @@ dependencies = [ "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", + "zope.interface>=5.0.0", ] [project.optional-dependencies] diff --git a/sygnal.yaml.sample b/sygnal.yaml.sample index 0a2c9b3c..9a700e8d 100644 --- a/sygnal.yaml.sample +++ b/sygnal.yaml.sample @@ -8,7 +8,7 @@ # log: # Specify a Python logging 'dictConfig', as described at: - # https://docs.python.org/3.7/library/logging.config.html#logging.config.dictConfig + # https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig # setup: version: 1 @@ -189,7 +189,7 @@ apps: # #inflight_request_limit: 512 # # # Specifies whether to use the production or sandbox APNs server. Note that - # # sandbox tokens should only be used with the sandbox server and vice versa. + # # sandbox tokens should only be used with the sandbox server and vice versa. # # # # Valid options are: # # * production diff --git a/sygnal/__init__.py b/sygnal/__init__.py index 88c75c6e..aafeb56a 100644 --- a/sygnal/__init__.py +++ b/sygnal/__init__.py @@ -13,16 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - from importlib.metadata import ( # type: ignore[attr-defined] - PackageNotFoundError, - version, - ) -except ImportError: - from importlib_metadata import ( # type: ignore[misc,no-redef] - PackageNotFoundError, - version, - ) +from importlib.metadata import PackageNotFoundError, version try: __version__ = version(__name__)