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

Bump python version #343

Merged
merged 5 commits into from
Jul 18, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/changelog_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
18 changes: 9 additions & 9 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions changelog.d/343.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove support for Python 3.7.
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -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",
Expand All @@ -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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

]

[project.optional-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions sygnal.yaml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions sygnal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down