Skip to content

Commit

Permalink
Merge pull request #79 from Samreay/packaging
Browse files Browse the repository at this point in the history
Fixes #76 - Swapping over to use package
  • Loading branch information
smarie authored Nov 8, 2023
2 parents 4be0f5f + 43ef718 commit d4c2d7f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### 0.7.9 - (In Progress)

- TBD
- Swapped from deprecated `disutils.version` to `packaging.version`. PR [#79](https://github.com/smarie/mkdocs-gallery/pull/79) by [Samreay](https://github.com/Samreay)

### 0.7.8 - Bugfixes

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ install_requires =
mkdocs>=1,<2
mkdocs-material
tqdm
packaging
tests_require =
pytest
# for some reason these pytest dependencies were not declared in old versions of pytest
Expand Down
6 changes: 3 additions & 3 deletions src/mkdocs_gallery/py_source_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from __future__ import absolute_import, division, print_function

import ast
import platform
import re
import sys
import tokenize
from distutils.version import LooseVersion
from packaging.version import parse as parse_version
from io import BytesIO
from pathlib import Path
from textwrap import dedent
Expand Down Expand Up @@ -106,7 +106,7 @@ def _get_docstring_and_rest(file: Path):
'unless the file is ignored by "ignore_pattern"'
)

if LooseVersion(sys.version) >= LooseVersion("3.7"):
if parse_version(platform.python_version()) >= parse_version("3.7"):
docstring = ast.get_docstring(node)
assert docstring is not None # noqa # should be guaranteed above
# This is just for backward compat
Expand Down
4 changes: 2 additions & 2 deletions src/mkdocs_gallery/scrapers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import os
import re
import sys
from distutils.version import LooseVersion
from packaging.version import parse as parse_version
from pathlib import Path, PurePosixPath
from textwrap import indent
from typing import Dict, List, Optional
Expand Down Expand Up @@ -272,7 +272,7 @@ def _anim_md(anim, image_path, gallery_conf):
thumb_size = gallery_conf["thumbnail_size"]
use_dpi = round(min(t_s / f_s for t_s, f_s in zip(thumb_size, fig_size)))
# FFmpeg is buggy for GIFs before Matplotlib 3.3.1
if LooseVersion(matplotlib.__version__) >= LooseVersion("3.3.1") and FFMpegWriter.isAvailable():
if parse_version(matplotlib.__version__) >= parse_version("3.3.1") and FFMpegWriter.isAvailable():
writer = "ffmpeg"
elif ImageMagickWriter.isAvailable():
writer = "imagemagick"
Expand Down

0 comments on commit d4c2d7f

Please sign in to comment.