Skip to content

Commit 7415fc5

Browse files
Add py.typed file to mark package as type-annotated, merge into pyproject.toml (#58)
* Add `py.typed` file to mark package as type-annotated, merge into `pyproject.toml` (#57) * Fix `borders` type hint * Clean up `.gitignore` * Merge dependencies and setup.cfg into Pyproject.toml * Repair Makefile and GHAs (`requirements -> pyproject.toml`) * Fix bad Python3.8 type hint * Fix package build. * update history.txt * restore build/.gitignore file * cosmetic --------- Co-authored-by: Parker L <166864283+parker-research@users.noreply.github.com>
1 parent 566312f commit 7415fc5

12 files changed

Lines changed: 56 additions & 50 deletions

File tree

.github/workflows/pep257.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: pep257
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main

.github/workflows/py3.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: py3
33

44
on:
5+
workflow_dispatch:
56
push:
67
branches:
78
- main
@@ -28,8 +29,7 @@ jobs:
2829
- name: Install dependencies
2930
run: |
3031
python -m pip install --upgrade pip
31-
pip install -r requirements.txt
32-
pip install -r tests/requirements.txt
32+
pip install '.[dev]'
3333
3434
- name: flake8
3535
run: |
@@ -67,8 +67,7 @@ jobs:
6767
- name: Install dependencies
6868
run: |
6969
python -m pip install --upgrade pip
70-
pip install -r requirements_38.txt
71-
pip install -r tests/requirements.txt
70+
pip install '.[dev]'
7271
7372
- name: flake8
7473
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ htmlcov/*
77
venv*
88
dist/
99
*.egg-info/
10+
build/
11+
.pytest_cache/

history.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
+ Added file py.typed.
2+
3+
* Package completely managed by pyproject.toml.
4+
15
03.04.2025 ver.1.6
26
------------------
37

makefile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ example:
4444
$(PYTHON) makepdf.py README_ru.md examples/markdown_pdf_ru.pdf
4545

4646
package:
47-
$(PYTHON) -m build -n
47+
$(PYTHON) -m build
4848

4949
pypitest: package
5050
$(PYTHON) -m twine upload --config-file .pypirc --repository testpypi dist/*
@@ -54,18 +54,9 @@ pypi: package
5454

5555
setup: setup_python setup_pip
5656

57-
setup38: setup_python setup_pip38
58-
59-
setup_pip38:
60-
$(PIP) --upgrade pip
61-
$(PIP) -r $(TESTS)/requirements.txt
62-
$(PIP) -r requirements_38.txt
63-
$(PIP) -r deploy.txt
64-
6557
setup_pip:
6658
$(PIP) --upgrade pip
67-
$(PIP) -r $(TESTS)/requirements.txt
68-
$(PIP) -r requirements.txt
59+
$(PIP) '.[dev]'
6960
$(PIP) -r deploy.txt
7061

7162
setup_python:

markdown_pdf/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import io
33
import typing
44
import pathlib
5+
6+
57
from markdown_it import MarkdownIt
68
import fitz
79

@@ -15,7 +17,7 @@ def __init__(
1517
toc: bool = True,
1618
root: str = ".",
1719
paper_size: str = "A4",
18-
borders: tuple = (36, 36, -36, -36)
20+
borders: typing.Tuple[int, int, int, int] = (36, 36, -36, -36)
1921
):
2022
"""Create md section with given properties."""
2123
self.text = text

markdown_pdf/py.typed

Whitespace-only changes.

pyproject.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,44 @@ requires = [
44
"wheel"
55
]
66
build-backend = "setuptools.build_meta"
7+
8+
[project]
9+
name = "markdown_pdf"
10+
version = "1.6"
11+
description = "Markdown to pdf renderer"
12+
readme = { file = "README.md", content-type = "text/markdown" }
13+
requires-python = ">=3.8"
14+
license = { text = "GNU Affero General Public License v3" }
15+
authors = [
16+
{ name = "Vitaly Bogomolov", email = "mail@vitaly-bogomolov.ru" }
17+
]
18+
classifiers = [
19+
"Programming Language :: Python :: 3",
20+
"License :: OSI Approved :: GNU Affero General Public License v3",
21+
"Operating System :: OS Independent"
22+
]
23+
dependencies = [
24+
"PyMuPDF==1.24.6; python_version<'3.9'",
25+
"PyMuPDF==1.25.3; python_version>'3.8'",
26+
"markdown-it-py==3.0.0; python_version>='3.8'"
27+
]
28+
29+
[project.optional-dependencies]
30+
dev = [
31+
"flake8",
32+
"pylint",
33+
"pydocstyle",
34+
"pytest",
35+
"pytest-cov",
36+
"codacy-coverage",
37+
]
38+
39+
[project.urls]
40+
"Homepage" = "https://github.com/vb64/markdown-pdf"
41+
"Bug Tracker" = "https://github.com/vb64/markdown-pdf/issues"
42+
43+
[tool.setuptools]
44+
packages = ["markdown_pdf"]
45+
46+
[tool.setuptools.package-data]
47+
"markdown_pdf" = ["py.typed"]

requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements_38.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)