Skip to content

Commit 04ddb46

Browse files
authored
Put changelog in doc (#22)
* moved changelog to the documentation * document utilities module * change documentation theme * change documentation theme * renamed actions files * bump version * fix lint
1 parent c54f836 commit 04ddb46

10 files changed

Lines changed: 149 additions & 49 deletions

File tree

NEWS.txt

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
Changelog
2-
3-
0.2.2
4-
- Bugfix: Document can be corrupted by garbage collector when created from data (or from file handle) (fixes #19)
5-
- Feature: Lower minimum required Python version to 3.6
6-
7-
0.2.1
8-
- Bugfix: Fixed byte order in image format string used for Pillow
9-
- Bugfix: Prevent segmentation fault when performing some operations on locked documents (fixes #4)
10-
- Bugfix: Fix include paths in C++ (fixes #2)
11-
- Change namespace syntax to support old compilers (earlier than C++17) (fixes #6)
12-
13-
0.2.0
14-
- Add the font infos to the TextBox object (Poppler 0.89.0)
15-
- Added __version__ to the Python package
16-
- Added buffer interface to Image
17-
- Added __str__ method to Image.Format enum, for interoperability with pillow
18-
- Bugfix: fixed the size of Image.data
1+
Changelog is now located at https://cbrunet.github.io/python-poppler/contribution.html

docs/changelog.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. _changelog:
2+
3+
Changelog
4+
=========
5+
6+
0.2.2 (2020-10-03)
7+
------------------
8+
9+
- Bugfix: Document can be corrupted by garbage collector when created from data (or from file handle) (Fixes :issue:`19`)
10+
- Bugfix: Fix build with some compilers (Fixes :issue:`17`)
11+
- Feature: Lower minimum required Python version to 3.6
12+
- Feature: Lower minimum required poppler version to 0.26.0 (See :pr:`13`) -- by Sandeep Mistry
13+
14+
0.2.1 (2020-06-19)
15+
------------------
16+
17+
- Bugfix: Fixed byte order in image format string used for Pillow
18+
- Bugfix: Prevent segmentation fault when performing some operations on locked documents (Fixes :issue:`4`)
19+
- Bugfix: Fix include paths in C++ (Fixes :issue:`2`)
20+
- Change namespace syntax to support old compilers (earlier than C++17) (Fixes :issue:`6`) -- by bnewbold
21+
22+
0.2.0 (2020-06-04)
23+
------------------
24+
25+
- Add the font infos to the :class:`.TextBox` object (Poppler 0.89.0)
26+
- Added `__version__` to the Python package
27+
- Added buffer interface to :class:`.Image`
28+
- Added `__str__` method to :class:`.Image.Format` enum, for interoperability with pillow
29+
- Bugfix: fixed the size of :attr:`.Image.data`
30+
31+
0.1.x
32+
-----
33+
34+
Project was still in development, and had no formal changelog.
35+
36+
- 0.1.2: 2020-04-20
37+
- 0.1.1: 2020-04-20
38+
- 0.1.0: 2020-04-19 (initial version)

docs/conf.py

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
extensions = [
3232
'sphinx.ext.autodoc',
3333
'sphinx.ext.githubpages',
34+
'sphinx.ext.intersphinx',
3435
'sphinx.ext.napoleon',
36+
'sphinx_issues',
3537
]
3638

3739
# Add any paths that contain templates here, relative to this directory.
@@ -48,22 +50,50 @@
4850
# The theme to use for HTML and HTML Help pages. See the documentation for
4951
# a list of builtin themes.
5052
#
51-
html_theme = 'alabaster'
53+
html_theme = 'sphinx_material'
5254

5355
# Add any paths that contain custom static files (such as style sheets) here,
5456
# relative to this directory. They are copied after the builtin static files,
5557
# so a file named "default.css" will overwrite the builtin "default.css".
5658
html_static_path = ['_static']
5759

60+
# html_theme_options = {
61+
# 'description': "Python binding to poppler-cpp library, to read and render PDF documents.",
62+
# 'github_button': True,
63+
# 'github_user': 'cbrunet',
64+
# 'github_repo': 'python-poppler',
65+
# 'badge_branch': 'master',
66+
# 'extra_nav_links': {
67+
# "GitHub": "https://github.com/cbrunet/python-poppler",
68+
# "Issues tracker": "https://github.com/cbrunet/python-poppler/issues",
69+
# "PyPI": "https://pypi.org/project/python-poppler/",
70+
# }
71+
# }
72+
5873
html_theme_options = {
59-
'description': "Python binding to poppler-cpp library, to read and render PDF documents.",
60-
'github_button': True,
61-
'github_user': 'cbrunet',
62-
'github_repo': 'python-poppler',
63-
'badge_branch': 'master',
64-
'extra_nav_links': {
65-
"GitHub": "https://github.com/cbrunet/python-poppler",
66-
"Issues tracker": "https://github.com/cbrunet/python-poppler/issues",
67-
"PyPI": "https://pypi.org/project/python-poppler/",
68-
}
74+
'nav_title': "Python poppler",
75+
'logo_icon': "&#x1F4D7",
76+
'base_url': "https://cbrunet.github.io/python-poppler",
77+
'repo_url': "https://github.com/cbrunet/python-poppler",
78+
'repo_name': "python-poppler",
79+
80+
'globaltoc_depth': 2,
81+
'globaltoc_collapse': False,
82+
'globaltoc_includehidden': True,
83+
84+
'nav_links': [
85+
{'title': "Issues tracker", 'href': "https://github.com/cbrunet/python-poppler/issues", 'internal': False},
86+
{'title': "PyPI", 'href': "https://pypi.org/project/python-poppler/", 'internal': False},
87+
],
88+
89+
}
90+
91+
html_sidebars = {
92+
"**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"]
6993
}
94+
95+
96+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
97+
98+
99+
issues_github_path = "cbrunet/python-poppler"

docs/contribution.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Contributing
77
Reporting bugs
88
--------------
99

10-
Bugs are reported using the `Issue tracker on GitHub <https://github.com/cbrunet/python-poppler/issues>`.
10+
Bugs are reported using the `Issue tracker on GitHub <https://github.com/cbrunet/python-poppler/issues>`_.
1111

1212
When you report a bug, try to be as specific as possible, and provide all the relevant information:
1313

@@ -30,7 +30,7 @@ If you can, consider pull_request_.
3030
Requesting features
3131
-------------------
3232

33-
Suggestions and feature requests can be submitted using the `Issue tracker on GitHub <https://github.com/cbrunet/python-poppler/issues>` as well.
33+
Suggestions and feature requests can be submitted using the `Issue tracker on GitHub <https://github.com/cbrunet/python-poppler/issues>`_ as well.
3434

3535
However, you should understand that the main goal of **python-poppler** is to provide a Python binding
3636
to the poppler-cpp library. Therefore, if you need a feature that is not currently in poppler-cpp,
@@ -50,9 +50,9 @@ Pull requests are the prefered way for submitting patches, bug corrections, and
5050
When you submit a pull request, verify the following points:
5151

5252
* You agree that the submitted code is under GPL 2.0 license;
53-
* Code is formatted using `black <https://github.com/psf/black>`. Ensure everything
53+
* Code is formatted using `black <https://github.com/psf/black>`_. Ensure everything
5454
is well formated, using `tox -e lint` command;
5555
* Please provide tests proving the bug is corrected, or covering the new feature, when it's possible;
5656
* Ensure that all unit tests pass, using the `tox` command;
57-
* Add a line to the changelog, in the NEWS.txt file;
57+
* Add a line to the changelog, in docs/changelog.rst;
5858
* Update the documentation, when it applies.

docs/index.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
python-poppler's documentation!
77
==========================================
88

9-
.. toctree::
10-
:hidden:
11-
12-
installation
13-
usage
14-
contribution
15-
api/modules
16-
17-
189
**python-poppler** is a Python binding to the poppler-cpp library.
1910
It allows to read PDF documents, render them, and to modify some
2011
informations inside the documents.
@@ -45,6 +36,8 @@ Contents
4536

4637
* :ref:`contributing` section is about submiting bugs or pull requests to the project.
4738

39+
* :ref:`changelog` section gives informations about releases of the project.
40+
4841
* :ref:`reference` lists all modules, classes, and methods. The reference section is still a work in progress...
4942

5043
About poppler
@@ -107,11 +100,21 @@ poppler-glib
107100
You should use poppler-glib directly instead (see above).
108101

109102

103+
Detailed Contents
104+
------------------
105+
106+
.. toctree::
107+
:maxdepth: 2
108+
109+
installation
110+
usage
111+
contribution
112+
changelog
113+
api/modules
114+
115+
110116
Indices and tables
111117
------------------
112118

113119
* :ref:`genindex`
114120
* :ref:`modindex`
115-
* :ref:`search`
116-
117-

src/poppler/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717

1818
__author__ = "Charles Brunet"
19-
__version__ = "0.2.1"
19+
__version__ = "0.2.2"
2020
__version_info__ = tuple(map(int, __version__.split('.')))
2121

2222
__all__ = ["__author__", "__version__", "__version_info__"]

src/poppler/utilities.py

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,76 @@
1515
# with this program; if not, write to the Free Software Foundation, Inc.,
1616
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717

18+
19+
"""This module contains utility functions that are not part of
20+
poppler-cpp, but that helps interacting with it.
21+
"""
22+
1823
from datetime import datetime
1924
import functools
2025

2126
from poppler.cpp.version import version_major, version_minor, version_micro
2227

2328

2429
def from_time_type(timestamp):
30+
"""Convert a timestamp to a :class:`datetime.datetime` object.
31+
32+
Args:
33+
timestamp (int): a positive integer, to be interpreted as 32 bits complement 2.
34+
35+
Returns:
36+
Optional[datetime.datetime]: the date and time,
37+
or None if the timestamp is equivalent to -1.
38+
39+
"""
2540
if timestamp == 2 ** 32 - 1:
2641
return None
2742
return datetime.fromtimestamp(timestamp)
2843

2944

3045
def to_time_type(date_time):
46+
"""Convert a Python :class:`datetime.datetime` object
47+
to a timestamp compatible with poppler.
48+
49+
Args:
50+
date_time (Optional[datetime.datetime]): the date and time, or None
51+
52+
Returns:
53+
int: the timestamp
54+
55+
"""
3156
return int(date_time.timestamp()) if date_time else 2 ** 32 - 1
3257

3358

3459
def version():
60+
"""Get poppler version, as a tuple
61+
62+
Returns:
63+
Tuple[int, int, int]: (major, minor, micro)
64+
65+
"""
3566
return version_major(), version_minor(), version_micro()
3667

3768

38-
def since(maj, min):
69+
def since(major, minor):
70+
"""Decorator used to mark the minimum required version of poppler
71+
needed to execute a function.
72+
73+
If poppler version is lower than the specified version,
74+
it raises a NotImplementedError when called.
75+
76+
Args:
77+
major (int): major version number
78+
minor (int): minor version number
79+
80+
"""
3981
def wrapper(fct):
4082
@functools.wraps(fct)
4183
def wrapped(*args, **kwargs):
42-
if version() < (maj, min, 0):
84+
if version() < (major, minor, 0):
4385
raise NotImplementedError(
4486
"This functionality requires at least Poppler version {}".format(
45-
".".join(map(str, (maj, min, 0)))
87+
".".join(map(str, (major, minor, 0)))
4688
)
4789
)
4890
return fct(*args, **kwargs)

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ commands =
1515

1616
deps =
1717
sphinx
18+
sphinx-issues
19+
sphinx-material
1820
ghp-import
1921
commands =
2022
sphinx-apidoc -o docs/api --separate --module-first src/poppler src/poppler/cpp/
@@ -53,6 +55,8 @@ deps =
5355
flake8
5456
flake8-bugbear
5557
sphinx
58+
sphinx-issues
59+
sphinx-material
5660

5761

5862
[flake8]

0 commit comments

Comments
 (0)