Skip to content

Commit 402bc01

Browse files
committed
🐛 make pkg Python 3.9 compatible
- import future anntotations and use external pkg to make StrEnum availble for python below 3.11
1 parent 50c53a7 commit 402bc01

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ itables = "^2.2.2"
2626
kaleido = "0.2.0"
2727
vl-convert-python = "^1.7.0"
2828
dataframe-image = "^0.2.6"
29-
29+
strenum = { version = "^0.4.15", python = "<3.11" }
3030

3131
[tool.poetry.group.dev.dependencies]
3232
ipykernel = "^6.29.5"

vuegen/report.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
import os
44
from abc import ABC, abstractmethod
55
from dataclasses import dataclass, field
6-
from enum import StrEnum, auto
6+
from enum import auto
7+
8+
try:
9+
from enum import StrEnum
10+
except ImportError:
11+
from strenum import StrEnum
12+
713
from typing import ClassVar, List, Optional
814

915
import matplotlib.pyplot as plt
@@ -738,4 +744,4 @@ def _generate_subsection(self, subsection: Subsection) -> tuple[List[str], List[
738744
- list of subsection content lines (List[str])
739745
- list of imports for the subsection (List[str])
740746
"""
741-
pass
747+
pass

vuegen/utils.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1+
from __future__ import annotations
2+
3+
import argparse
4+
import json
5+
import logging
16
import os
27
import sys
3-
import yaml
48
from datetime import datetime
5-
import logging
6-
import argparse
7-
import requests
8-
import networkx as nx
9-
import json
9+
10+
try:
11+
from enum import StrEnum
12+
except ImportError:
13+
from strenum import StrEnum
14+
1015
from io import StringIO
11-
from enum import StrEnum
1216
from typing import Type
13-
from bs4 import BeautifulSoup
1417
from urllib.parse import urlparse
1518

19+
import networkx as nx
20+
import requests
21+
import yaml
22+
from bs4 import BeautifulSoup
23+
24+
1625
## CHECKS
1726
def check_path(filepath: str) -> bool:
1827
"""

0 commit comments

Comments
 (0)