Skip to content

Commit

Permalink
LITE-29500: Bump dependencies, deprecate Python 3.8 and add 3.12 to t…
Browse files Browse the repository at this point in the history
…est matrix
  • Loading branch information
r-s11v committed Nov 18, 2024
1 parent 1e97498 commit df689f6
Show file tree
Hide file tree
Showing 7 changed files with 1,088 additions and 1,021 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
with:
Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ This library is reponsible for validation of reports definition, choosing of ren

## Install

`Connect Reports Core` requires python 3.8 or later and has the following dependencies:

* openpyxl>=2.5.14
* WeasyPrint>=53.4
* Jinja2>=2.11.3
* jsonschema<=3.2.0
* pytz>=2021.1
* lxml>=4.7.1

`Connect Reports Core` requires python 3.9 or later and has the following dependencies:

* openpyxl >=2.5.14
* WeasyPrint >=59,<64
* Jinja2 >=2,<4
* jsonschema >=3,<5
* pytz *
* lxml >=4.9
* orjson >=3.5.2,<4
* plotly >=5.9.0,<6
* kaleido >=0.4,<1
`Connect Reports Core` can be installed from [pypi.org](https://pypi.org/project/connect-reports-core/) using pip:

```
Expand Down
12 changes: 6 additions & 6 deletions connect/reports/renderers/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def generate_report(self, data, output_file):
template_dir=os.path.dirname(self.template),
cwd=self.current_working_directory,
)
kwargs = {}
options = {'uncompressed_pdf': True}
css_file = self.args.get('css_file')
if css_file:
css = CSS(filename=os.path.join(self.root_dir, css_file), url_fetcher=fetcher)
kwargs['stylesheets'] = [css]
options.update({'stylesheets': [css]})
html = HTML(filename=rendered_file, url_fetcher=fetcher)
html.write_pdf(output_file, **kwargs)
html.write_pdf(output_file, **options)
return output_file

async def generate_report_async(self, data, output_file):
Expand All @@ -71,13 +71,13 @@ async def generate_report_async(self, data, output_file):
)

def _generate():
kwargs = {}
options = {'uncompressed_pdf': True}
css_file = self.args.get('css_file')
if css_file:
css = CSS(filename=os.path.join(self.root_dir, css_file), url_fetcher=fetcher)
kwargs['stylesheets'] = [css]
options.update({'stylesheets': [css]})
html = HTML(filename=rendered_file, url_fetcher=fetcher)
html.write_pdf(output_file, **kwargs)
html.write_pdf(output_file, **options)
await self._to_thread(_generate)
return output_file

Expand Down
2,027 changes: 1,046 additions & 981 deletions poetry.lock

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,42 @@ classifiers = [
"Environment :: Console",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Utilities",
"Topic :: Software Development :: Libraries",
]

[tool.poetry.dependencies]
python = ">=3.8,<4"
python = ">=3.9,<4"
openpyxl = ">=2.5.14"
WeasyPrint = "^53.4"
WeasyPrint = ">=59,<64"
Jinja2 = ">=2,<4"
jsonschema = ">=3,<5"
pytz = ">=2022"
pytz = "*"
lxml = ">=4.9"
orjson = "^3.5.2"
plotly = "5.9.0"
kaleido = "0.2.1"
orjson = ">=3.5.2,<4"
plotly = ">=5.9.0,<6"
kaleido = ">=0.4,<1"

[tool.poetry.group.test.dependencies]
ipython = "^8"
pytest = ">=6.1.2,<8"
pytest-cov = ">=2.10.1,<5"
pytest-mock = "^3.3.1"
pytest = ">=6.1.2,<9"
pytest-cov = ">=2.10.1,<7"
pytest-mock = "^3.14"
coverage = {extras = ["toml"], version = ">=5.3,<7"}
flake8 = ">=3.8,<6"
flake8-bugbear = ">=20,<23"
flake8 = ">=3.8,<8"
flake8-bugbear = ">=20,<25"
flake8-cognitive-complexity = "^0.1"
flake8-commas = "~2.1"
flake8-commas = "^4.0"
flake8-future-import = "~0.4"
flake8-broken-line = ">=0.3,<0.7"
flake8-pyproject = "^1.2.2"
fs = "^2.4.12"
pytest-asyncio = "^0.20.1"
flake8-isort = "^6.0.0"
flake8-broken-line = "^1.0"
flake8-pyproject = "^1.2.3"
fs = "^2.4.16"
pytest-asyncio = "^0.24"
flake8-isort = "^6.1.0"

[build-system]
requires = ["poetry-core>=1.0.0", "setuptools"]
Expand Down
4 changes: 2 additions & 2 deletions tests/reports/renderers/test_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_generate_report(mocker, account_factory, report_factory, report_data):
assert mocked_html.mock_calls[0].kwargs['filename'] == 'report.pdf.html'
assert mocked_html.mock_calls[0].kwargs['url_fetcher'] == fetcher

html.write_pdf.assert_called_once_with('report.pdf')
html.write_pdf.assert_called_once_with('report.pdf', uncompressed_pdf=True)


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

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


def test_validate_tmpfs_template_wrong_name():
Expand Down
8 changes: 4 additions & 4 deletions tests/reports/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_repo_object_reports_minitem(repo_json):
errors = validate_with_schema(repo)

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


@pytest.mark.parametrize(
Expand Down Expand Up @@ -151,7 +151,7 @@ def test_reportv1_object_array_minitems_audience(repo_json, report_v1_json):
errors = validate_with_schema(repo)

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


def test_reportv1_object_audience_string_items(repo_json, report_v1_json):
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_reportv2_object_array_minitems(repo_json, report_v2_json, field):
errors = validate_with_schema(repo)

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


def test_reportv2_object_audience_string_items(repo_json, report_v2_json):
Expand Down Expand Up @@ -334,7 +334,7 @@ def test_parameter_object_minitem_choices_field(repo_json, report_v2_json):
errors = validate_with_schema(repo)

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


@pytest.mark.parametrize(
Expand Down

0 comments on commit df689f6

Please sign in to comment.