Skip to content

Commit

Permalink
Merge pull request #107 from lyz-code/fix/pdm
Browse files Browse the repository at this point in the history
feat: support Python 3.11
  • Loading branch information
lyz-code authored Nov 23, 2023
2 parents 1b439f9 + b2f7d9e commit 3665fc7
Show file tree
Hide file tree
Showing 8 changed files with 713 additions and 985 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
Install:
runs-on: ubuntu-latest
strategy:
max-parallel: 3
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.8, 3.9, '3.10', '3.11']
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.8, 3.9, '3.10', '3.11']
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -32,20 +32,12 @@ jobs:
source .venv/bin/activate
pdm config python.use_venv True
make install
# 3.7 is giving me some issues with flake8 and importlib-metadata, until
# https://github.com/flakeheaven/flakeheaven/issues/132 is done, I won't spend
# time testing in this environment.
# https://github.com/lyz-code/mkdocs-newsletter/actions/runs/3548202587/jobs/5959150030
- name: Test linters
run: if [[ ${{ matrix.python-version }} != '3.7' ]];then make lint; fi
run: make lint
- name: Test type checkers
run: make mypy
# 3.7 is giving me some issues with flake8 and importlib-metadata, until
# https://github.com/flakeheaven/flakeheaven/issues/132 is done, I won't spend
# time testing in this environment.
# https://github.com/lyz-code/mkdocs-newsletter/actions/runs/3548202587/jobs/5959150030
- name: Test security
run: if [[ ${{ matrix.python-version }} != '3.7' ]];then make security; fi
run: make security
- name: Test with pytest
run: make test
# - name: Upload Coverage
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ linting locally.
**tl;dr**: use `make format` to fix formatting, `make` to run tests and linting & `make docs`
to build the docs.

You'll need to have python 3.6, 3.7, or 3.8, virtualenv, git, and make installed.
You'll need to have python 3.8 or greater, virtualenv, git, and make installed.

* Clone your fork and go into the repository directory:

Expand All @@ -88,7 +88,7 @@ You'll need to have python 3.6, 3.7, or 3.8, virtualenv, git, and make installed
* Set up the virtualenv for running tests:

```bash
virtualenv -p `which python3.7` env
virtualenv -p `which python3.8` env
source env/bin/activate
```

Expand Down
4 changes: 2 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ If you're using github, you can use the next configuration:
# https://github.com/actions/virtual-environments/issues/1202
# uses: actions/setup-python@v1
# with:
# python-version: '3.7'
# python-version: '3.8'
uses: actions/setup-python@v2
with:
python-version: 3.7.7
python-version: 3.8
architecture: x64
- name: Cache dependencies
Expand Down
1,610 changes: 674 additions & 936 deletions pdm.lock

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ authors = [
{name = "Lyz", email = "[email protected]"},
]
license = {text = "GPL-3.0-only"}
requires-python = ">=3.7.2"
requires-python = ">=3.8"
dependencies = [
"beautifulsoup4>=4.10.0",
"mkdocs>=1.2.3",
Expand All @@ -49,10 +49,10 @@ classifiers=[
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Utilities",
"Natural Language :: English",
]
Expand All @@ -66,13 +66,16 @@ documentation = "https://lyz-code.github.io/mkdocs-newsletter"
mkdocs-newsletter = "mkdocs_newsletter:Newsletter"

[tool.pdm]
version = {from = "src/mkdocs_newsletter/version.py"}
package-dir = "src"
source-includes = ["tests/"]
allow_prereleases = true

[tool.pdm.build]
editable-backend = "path"
package-dir = "src"
source-includes = ["tests/"]

[tool.pdm.version]
source = "file"
path = "src/mkdocs_newsletter/version.py"

[tool.pdm.overrides]
# To be removed once https://github.com/flakeheaven/flakeheaven/issues/132 is solved
Expand Down Expand Up @@ -150,8 +153,8 @@ dependencies = [
]

[build-system]
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api"
requires = ["pdm-backend"]
build-backend = "pdm.backend"

# --------- Black -------------

Expand Down Expand Up @@ -199,6 +202,9 @@ filterwarnings = [
"error",
# Until https://github.com/ktosiek/pytest-freezegun/issues/35 is merged
"ignore::DeprecationWarning:pytest_freezegun.*",
# Until https://github.com/kurtmckee/feedparser/issues/330 is solved
"ignore::DeprecationWarning:cgi",
"ignore::DeprecationWarning:feedparser.*",
]

# --------- Coverage -------------
Expand Down
24 changes: 8 additions & 16 deletions tests/e2e/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test the plugin entrypoint."""

import re
from datetime import datetime

import feedparser
Expand Down Expand Up @@ -33,15 +34,11 @@ def test_plugin_builds_newsletters(full_repo: Repo, config: MkDocsConfig) -> Non
newsletter = newsletter_file.read()
assert "<title>February of 2021 - The Blue Book</title>" in newsletter
assert "<h1>February of 2021</h1>" in newsletter
assert (
'<a href="../2021_03_02/" class="md-footer__link '
'md-footer__link--prev" aria-label="Previous: 2nd March 2021" rel="prev">'
in newsletter
assert re.search(
r'href="../2021_03_02/"[^>]*aria-label="Previous: 2nd March 2021"', newsletter
)
assert (
'<a href="../2021_w06/" class="md-footer__link '
'md-footer__link--next" aria-label="Next: 6th Week of 2021" rel="next">'
in newsletter
assert re.search(
r'href="../2021_w06/"[^>]*aria-label="Next: 6th Week of 2021"', newsletter
)


Expand Down Expand Up @@ -330,15 +327,10 @@ def test_plugin_creates_landing_page(full_repo: Repo, config: MkDocsConfig) -> N
in landing_page
)
assert "<h1>Newsletters</h1>" in landing_page
assert (
'<a href="../../emojis/" class="md-footer__link '
'md-footer__link--prev" aria-label="Previous: Emojis" rel="prev">'
in landing_page
)
assert (
'<a href="../2021/" class="md-footer__link '
'md-footer__link--next" aria-label="Next: 2021" rel="next">' in landing_page
assert re.search(
r'href="../../emojis/"[^>]*aria-label="Previous: Emojis"', landing_page
)
assert re.search(r'href="../2021/"[^>]*aria-label="Next: 2021"', landing_page)


def test_build_rss_feed_without_logo(config: MkDocsConfig, full_repo: Repo) -> None:
Expand Down
18 changes: 9 additions & 9 deletions tests/unit/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def test_newslettersection_can_order_objects() -> None: # noqa: AAA01
unimportant = NewsletterSection(title="Unimportant section", order=1)

assert important > unimportant
# SIM204, C0113: We don't want to simplify to important > unimportant because we
# want to test the __lt__ method
assert not important < unimportant # noqa: C0113, SIM204
# SIM204, C0113, C0117: We don't want to simplify to important > unimportant
# because we want to test the __lt__ method
assert not important < unimportant # noqa: C0113, SIM204, C0117


# AAA01: No act block
Expand All @@ -70,9 +70,9 @@ def test_newsletter_can_order_objects() -> None: # noqa: AAA01
smaller = Newsletter(file_=Path("2020_01.md"))

assert greater > smaller
# SIM204, C0113: We don't want to simplify to important > unimportant because we
# want to test the __lt__ method
assert not greater < smaller # noqa: C0113, SIM204
# SIM204, C0113, C0117: We don't want to simplify to important > unimportant
# because we want to test the __lt__ method
assert not greater < smaller # noqa: C0113, SIM204, C0117


# AAA01: No act block
Expand All @@ -96,9 +96,9 @@ def test_feedentry_can_order_objects() -> None: # noqa: AAA01
)

assert greater > smaller
# SIM204, C0113: We don't want to simplify to important > unimportant because we
# want to test the __lt__ method
assert not greater < smaller # noqa: C0113, SIM204
# SIM204, C0113, C0117: We don't want to simplify to important > unimportant
# because we want to test the __lt__ method
assert not greater < smaller # noqa: C0113, SIM204, C0117


@pytest.mark.parametrize(
Expand Down

0 comments on commit 3665fc7

Please sign in to comment.