Skip to content

Commit 3d7d2aa

Browse files
committed
Merge branch 'feature/packaging' into 'master'
Refresh packaging See merge request python-devs/importlib_resources!87
2 parents 7410529 + 02443d3 commit 3d7d2aa

File tree

11 files changed

+60
-39
lines changed

11 files changed

+60
-39
lines changed

MANIFEST.in

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

importlib_resources/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import sys
44

5+
from ._compat import metadata
6+
57

68
__all__ = [
79
'Package',
@@ -46,5 +48,4 @@
4648
del __all__[:3]
4749

4850

49-
__version__ = \
50-
files('importlib_resources').joinpath('version.txt').read_text().strip()
51+
__version__ = metadata.version('importlib_resources')

importlib_resources/_compat.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ class ABC(object): # type: ignore
2929
FileNotFoundError = OSError # type: ignore
3030

3131

32+
try:
33+
from importlib import metadata
34+
except ImportError:
35+
import importlib_metadata as metadata # type: ignore
36+
37+
3238
try:
3339
from zipfile import Path as ZipPath # type: ignore
3440
except ImportError:

importlib_resources/docs/changelog.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
importlib_resources NEWS
33
==========================
44

5-
1.1.0 (2020-02-29)
6-
==================
5+
v1.1.0
6+
======
77
* Add support for retrieving resources from subdirectories of packages
88
through the new ``files()`` function, which returns a ``Traversable``
99
object with ``joinpath`` and ``read_*`` interfaces matching those
@@ -21,61 +21,61 @@
2121
consequence of the ResourceReader interface only operating on
2222
Python packages).
2323

24-
1.0.2 (2018-11-01)
25-
==================
24+
1.0.2
25+
=====
2626
* Fix ``setup_requires`` and ``install_requires`` metadata in ``setup.cfg``.
2727
Given by Anthony Sottile.
2828

29-
1.0.1 (2018-06-29)
30-
==================
29+
1.0.1
30+
=====
3131
* Update Trove classifiers. Closes #63
3232

33-
1.0 (2018-06-28)
34-
================
33+
1.0
34+
===
3535
* Backport fix for test isolation from Python 3.8/3.7. Closes #61
3636

37-
0.8 (2018-05-17)
38-
================
37+
0.8
38+
===
3939
* Strip ``importlib_resources.__version__``. Closes #56
4040
* Fix a metadata problem with older setuptools. Closes #57
4141
* Add an ``__all__`` to ``importlib_resources``. Closes #59
4242

43-
0.7 (2018-05-15)
44-
================
43+
0.7
44+
===
4545
* Fix ``setup.cfg`` metadata bug. Closes #55
4646

47-
0.6 (2018-05-15)
48-
================
47+
0.6
48+
===
4949
* Move everything from ``pyproject.toml`` to ``setup.cfg``, with the added
5050
benefit of fixing the PyPI metadata. Closes #54
5151
* Turn off mypy's ``strict_optional`` setting for now.
5252

53-
0.5 (2018-05-01)
54-
================
53+
0.5
54+
===
5555
* Resynchronize with Python 3.7; changes the return type of ``contents()`` to
5656
be an ``Iterable``. Closes #52
5757

58-
0.4 (2018-03-27)
59-
================
58+
0.4
59+
===
6060
* Correctly find resources in subpackages inside a zip file. Closes #51
6161

62-
0.3 (2018-02-17)
63-
================
62+
0.3
63+
===
6464
* The API, implementation, and documentation is synchronized with the Python
6565
3.7 standard library. Closes #47
6666
* When run under Python 3.7 this API shadows the stdlib versions. Closes #50
6767

68-
0.2 (2017-12-13)
69-
================
68+
0.2
69+
===
7070
* **Backward incompatible change**. Split the ``open()`` and ``read()`` calls
7171
into separate binary and text versions, i.e. ``open_binary()``,
7272
``open_text()``, ``read_binary()``, and ``read_text()``. Closes #41
7373
* Fix a bug where unrelated resources could be returned from ``contents()``.
7474
Closes #44
7575
* Correctly prevent namespace packages from containing resources. Closes #20
7676

77-
0.1 (2017-12-05)
78-
================
77+
0.1
78+
===
7979
* Initial release.
8080

8181

importlib_resources/docs/conf.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
# Add any Sphinx extension module names here, as strings. They can be
3434
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3535
# ones.
36-
extensions = ['sphinx.ext.autodoc',
36+
extensions = [
37+
'rst.linker',
38+
'sphinx.ext.autodoc',
3739
'sphinx.ext.doctest',
3840
'sphinx.ext.intersphinx',
3941
'sphinx.ext.coverage',
@@ -178,3 +180,16 @@
178180
intersphinx_mapping = {
179181
'python': ('https://docs.python.org/3', None),
180182
}
183+
184+
185+
# For rst.linker, inject release dates into changelog.rst
186+
link_files = {
187+
'changelog.rst': dict(
188+
replace=[
189+
dict(
190+
pattern=r'^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n',
191+
with_scm='{text}\n{rev[timestamp]:%Y-%m-%d}\n\n',
192+
),
193+
],
194+
),
195+
}

importlib_resources/docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The documentation here includes a general :ref:`usage <using>` guide and a
2929

3030
using.rst
3131
migration.rst
32-
changelog.rst
32+
changelog (links).rst
3333

3434

3535
Project details

importlib_resources/version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[build-system]
2-
requires = ["setuptools>=30.3", "wheel"]
2+
requires = ["setuptools>=30.3", "wheel", "setuptools_scm[toml]>=3.4.1"]
3+
4+
[tool.setuptools_scm]

setup.cfg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[metadata]
2+
license_file = LICENSE
23
name = importlib_resources
3-
version = file: importlib_resources/version.txt
44
author = Barry Warsaw
55
author_email = [email protected]
66
url = http://importlib-resources.readthedocs.io/
77
description = Read resources from Python packages
88
long_description = file: README.rst
9-
license = Apache Software License
109
classifiers =
1110
Development Status :: 5 - Production/Stable
1211
Intended Audience :: Developers
@@ -22,6 +21,8 @@ install_requires =
2221
typing; python_version < '3.5'
2322
zipp >= 0.4; python_version < '3.8'
2423
singledispatch; python_version < '3.4'
24+
importlib_metadata; python_version < '3.8'
25+
setup_requires = setuptools_scm[toml] >= 3.4.1
2526
packages = find:
2627

2728
[options.package_data]
@@ -48,3 +49,4 @@ universal=1
4849
docs =
4950
sphinx
5051
docutils==0.12
52+
rst.linker

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from setuptools import setup
2-
setup()
2+
3+
setup(use_scm_version=True)

0 commit comments

Comments
 (0)