Skip to content

Commit df689f6

Browse files
committed
LITE-29500: Bump dependencies, deprecate Python 3.8 and add 3.12 to test matrix
1 parent 1e97498 commit df689f6

File tree

7 files changed

+1088
-1021
lines changed

7 files changed

+1088
-1021
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: ["3.8", "3.9", "3.10", "3.11"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1717
steps:
1818
- uses: actions/checkout@v3
1919
with:

README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ This library is reponsible for validation of reports definition, choosing of ren
1010

1111
## Install
1212

13-
`Connect Reports Core` requires python 3.8 or later and has the following dependencies:
14-
15-
* openpyxl>=2.5.14
16-
* WeasyPrint>=53.4
17-
* Jinja2>=2.11.3
18-
* jsonschema<=3.2.0
19-
* pytz>=2021.1
20-
* lxml>=4.7.1
21-
13+
`Connect Reports Core` requires python 3.9 or later and has the following dependencies:
14+
15+
* openpyxl >=2.5.14
16+
* WeasyPrint >=59,<64
17+
* Jinja2 >=2,<4
18+
* jsonschema >=3,<5
19+
* pytz *
20+
* lxml >=4.9
21+
* orjson >=3.5.2,<4
22+
* plotly >=5.9.0,<6
23+
* kaleido >=0.4,<1
2224
`Connect Reports Core` can be installed from [pypi.org](https://pypi.org/project/connect-reports-core/) using pip:
2325

2426
```

connect/reports/renderers/pdf.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ def generate_report(self, data, output_file):
4848
template_dir=os.path.dirname(self.template),
4949
cwd=self.current_working_directory,
5050
)
51-
kwargs = {}
51+
options = {'uncompressed_pdf': True}
5252
css_file = self.args.get('css_file')
5353
if css_file:
5454
css = CSS(filename=os.path.join(self.root_dir, css_file), url_fetcher=fetcher)
55-
kwargs['stylesheets'] = [css]
55+
options.update({'stylesheets': [css]})
5656
html = HTML(filename=rendered_file, url_fetcher=fetcher)
57-
html.write_pdf(output_file, **kwargs)
57+
html.write_pdf(output_file, **options)
5858
return output_file
5959

6060
async def generate_report_async(self, data, output_file):
@@ -71,13 +71,13 @@ async def generate_report_async(self, data, output_file):
7171
)
7272

7373
def _generate():
74-
kwargs = {}
74+
options = {'uncompressed_pdf': True}
7575
css_file = self.args.get('css_file')
7676
if css_file:
7777
css = CSS(filename=os.path.join(self.root_dir, css_file), url_fetcher=fetcher)
78-
kwargs['stylesheets'] = [css]
78+
options.update({'stylesheets': [css]})
7979
html = HTML(filename=rendered_file, url_fetcher=fetcher)
80-
html.write_pdf(output_file, **kwargs)
80+
html.write_pdf(output_file, **options)
8181
await self._to_thread(_generate)
8282
return output_file
8383

poetry.lock

+1,046-981
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+18-18
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@ classifiers = [
1515
"Environment :: Console",
1616
"Operating System :: OS Independent",
1717
"Intended Audience :: Developers",
18-
"Programming Language :: Python :: 3.8",
1918
"Programming Language :: Python :: 3.9",
2019
"Programming Language :: Python :: 3.10",
2120
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
2222
"Topic :: Utilities",
2323
"Topic :: Software Development :: Libraries",
2424
]
2525

2626
[tool.poetry.dependencies]
27-
python = ">=3.8,<4"
27+
python = ">=3.9,<4"
2828
openpyxl = ">=2.5.14"
29-
WeasyPrint = "^53.4"
29+
WeasyPrint = ">=59,<64"
3030
Jinja2 = ">=2,<4"
3131
jsonschema = ">=3,<5"
32-
pytz = ">=2022"
32+
pytz = "*"
3333
lxml = ">=4.9"
34-
orjson = "^3.5.2"
35-
plotly = "5.9.0"
36-
kaleido = "0.2.1"
34+
orjson = ">=3.5.2,<4"
35+
plotly = ">=5.9.0,<6"
36+
kaleido = ">=0.4,<1"
3737

3838
[tool.poetry.group.test.dependencies]
3939
ipython = "^8"
40-
pytest = ">=6.1.2,<8"
41-
pytest-cov = ">=2.10.1,<5"
42-
pytest-mock = "^3.3.1"
40+
pytest = ">=6.1.2,<9"
41+
pytest-cov = ">=2.10.1,<7"
42+
pytest-mock = "^3.14"
4343
coverage = {extras = ["toml"], version = ">=5.3,<7"}
44-
flake8 = ">=3.8,<6"
45-
flake8-bugbear = ">=20,<23"
44+
flake8 = ">=3.8,<8"
45+
flake8-bugbear = ">=20,<25"
4646
flake8-cognitive-complexity = "^0.1"
47-
flake8-commas = "~2.1"
47+
flake8-commas = "^4.0"
4848
flake8-future-import = "~0.4"
49-
flake8-broken-line = ">=0.3,<0.7"
50-
flake8-pyproject = "^1.2.2"
51-
fs = "^2.4.12"
52-
pytest-asyncio = "^0.20.1"
53-
flake8-isort = "^6.0.0"
49+
flake8-broken-line = "^1.0"
50+
flake8-pyproject = "^1.2.3"
51+
fs = "^2.4.16"
52+
pytest-asyncio = "^0.24"
53+
flake8-isort = "^6.1.0"
5454

5555
[build-system]
5656
requires = ["poetry-core>=1.0.0", "setuptools"]

tests/reports/renderers/test_pdf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_generate_report(mocker, account_factory, report_factory, report_data):
9898
assert mocked_html.mock_calls[0].kwargs['filename'] == 'report.pdf.html'
9999
assert mocked_html.mock_calls[0].kwargs['url_fetcher'] == fetcher
100100

101-
html.write_pdf.assert_called_once_with('report.pdf')
101+
html.write_pdf.assert_called_once_with('report.pdf', uncompressed_pdf=True)
102102

103103

104104
def test_generate_report_external_css(mocker, account_factory, report_factory, report_data):
@@ -132,7 +132,7 @@ def test_generate_report_external_css(mocker, account_factory, report_factory, r
132132
assert mocked_css.mock_calls[0].kwargs['filename'] == 'root_dir/report_dir/template.css'
133133
assert mocked_css.mock_calls[0].kwargs['url_fetcher'] == fetcher
134134

135-
html.write_pdf.assert_called_once_with('report.pdf', stylesheets=[css])
135+
html.write_pdf.assert_called_once_with('report.pdf', uncompressed_pdf=True, stylesheets=[css])
136136

137137

138138
def test_validate_tmpfs_template_wrong_name():

tests/reports/test_schema.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_repo_object_reports_minitem(repo_json):
6969
errors = validate_with_schema(repo)
7070

7171
assert errors is not None
72-
assert '[] is too short' == errors.splitlines()[0]
72+
assert '[] should be non-empty' == errors.splitlines()[0]
7373

7474

7575
@pytest.mark.parametrize(
@@ -151,7 +151,7 @@ def test_reportv1_object_array_minitems_audience(repo_json, report_v1_json):
151151
errors = validate_with_schema(repo)
152152

153153
assert errors is not None
154-
assert '[] is too short' == errors.splitlines()[0]
154+
assert '[] should be non-empty' == errors.splitlines()[0]
155155

156156

157157
def test_reportv1_object_audience_string_items(repo_json, report_v1_json):
@@ -229,7 +229,7 @@ def test_reportv2_object_array_minitems(repo_json, report_v2_json, field):
229229
errors = validate_with_schema(repo)
230230

231231
assert errors is not None
232-
assert '[] is too short' == errors.splitlines()[0]
232+
assert '[] should be non-empty' == errors.splitlines()[0]
233233

234234

235235
def test_reportv2_object_audience_string_items(repo_json, report_v2_json):
@@ -334,7 +334,7 @@ def test_parameter_object_minitem_choices_field(repo_json, report_v2_json):
334334
errors = validate_with_schema(repo)
335335

336336
assert errors is not None
337-
assert "[] is too short" == errors.splitlines()[0]
337+
assert '[] should be non-empty' == errors.splitlines()[0]
338338

339339

340340
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)