Skip to content

Commit f953676

Browse files
authored
Merge pull request python#209 from python/feature/skeleton
Adopt best practices from jaraco/skeleton
2 parents 2ffd851 + 840c0bf commit f953676

32 files changed

+499
-456
lines changed

.coveragerc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[run]
2+
omit = .tox/*
3+
4+
[report]
5+
show_missing = True

.flake8

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[flake8]
2+
max-line-length = 88
3+
ignore =
4+
# W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513
5+
W503
6+
# W504 has issues https://github.com/OCA/maintainer-quality-tools/issues/545
7+
W504
8+
# Black creates whitespace before colon
9+
E203
10+
exclude =
11+
# Exclude the entire top-level __init__.py file since its only purpose is
12+
# to expose the version string and to handle Python 2/3 compatibility.
13+
importlib_resources/__init__.py

.github/workflows/automerge.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: automerge
2+
on:
3+
pull_request:
4+
types:
5+
- labeled
6+
- unlabeled
7+
- synchronize
8+
- opened
9+
- edited
10+
- ready_for_review
11+
- reopened
12+
- unlocked
13+
pull_request_review:
14+
types:
15+
- submitted
16+
check_suite:
17+
types:
18+
- completed
19+
status: {}
20+
jobs:
21+
automerge:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: automerge
25+
uses: "pascalgn/[email protected]"
26+
env:
27+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/main.yml

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
test:
77
strategy:
88
matrix:
9-
python: [3.6, 3.7, 3.8, 3.9]
9+
python: [3.6, 3.8, 3.9]
1010
platform: [ubuntu-latest, macos-latest, windows-latest]
1111
runs-on: ${{ matrix.platform }}
1212
steps:
@@ -20,40 +20,6 @@ jobs:
2020
python -m pip install tox
2121
- name: Run tests
2222
run: tox
23-
env:
24-
TOXENV: python
25-
26-
qa:
27-
runs-on: ubuntu-latest
28-
steps:
29-
- uses: actions/checkout@v2
30-
- name: Setup Python
31-
uses: actions/setup-python@v2
32-
with:
33-
python-version: 3.9
34-
- name: Install tox
35-
run: |
36-
python -m pip install tox
37-
- name: Run checks
38-
run: tox
39-
env:
40-
TOXENV: qa
41-
42-
coverage:
43-
runs-on: ubuntu-latest
44-
steps:
45-
- uses: actions/checkout@v2
46-
- name: Setup Python
47-
uses: actions/setup-python@v2
48-
with:
49-
python-version: 3.9
50-
- name: Install tox
51-
run: |
52-
python -m pip install tox
53-
- name: Evaluate coverage
54-
run: tox
55-
env:
56-
TOXENV: cov
5723

5824
diffcov:
5925
runs-on: ubuntu-latest
@@ -73,22 +39,6 @@ jobs:
7339
env:
7440
TOXENV: diffcov
7541

76-
docs:
77-
runs-on: ubuntu-latest
78-
steps:
79-
- uses: actions/checkout@v2
80-
- name: Setup Python
81-
uses: actions/setup-python@v2
82-
with:
83-
python-version: 3.9
84-
- name: Install tox
85-
run: |
86-
python -m pip install tox
87-
- name: Build docs
88-
run: tox
89-
env:
90-
TOXENV: docs
91-
9242
release:
9343
needs: test
9444
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: stable
4+
hooks:
5+
- id: black
6+
7+
- repo: https://github.com/asottile/blacken-docs
8+
rev: v1.8.0
9+
hooks:
10+
- id: blacken-docs

.readthedocs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
version: 2
12
python:
2-
version: 3
3-
extra_requirements:
4-
- docs
5-
pip_install: true
3+
install:
4+
- path: .
5+
extra_requirements:
6+
- docs

CHANGES.rst

Whitespace-only changes.

README.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
.. image:: https://img.shields.io/pypi/v/skeleton.svg
2+
:target: `PyPI link`_
3+
4+
.. image:: https://img.shields.io/pypi/pyversions/skeleton.svg
5+
:target: `PyPI link`_
6+
7+
.. _PyPI link: https://pypi.org/project/skeleton
8+
9+
.. image:: https://github.com/jaraco/skeleton/workflows/Automated%20Tests/badge.svg
10+
:target: https://github.com/jaraco/skeleton/actions?query=workflow%3A%22Automated+Tests%22
11+
:alt: Automated Tests
12+
13+
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
14+
:target: https://github.com/psf/black
15+
:alt: Code style: Black
16+
17+
.. .. image:: https://readthedocs.org/projects/skeleton/badge/?version=latest
18+
.. :target: https://skeleton.readthedocs.io/en/latest/?badge=latest
19+
120
``importlib_resources`` is a backport of Python standard library
221
`importlib.resources
322
<https://docs.python.org/3/library/importlib.html#module-importlib.resources>`_

coverage.ini

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

coverplug.py

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

docs/conf.py

Lines changed: 13 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,30 @@
1-
extensions = [
2-
'rst.linker',
3-
'sphinx.ext.autodoc',
4-
'sphinx.ext.doctest',
5-
'sphinx.ext.intersphinx',
6-
'sphinx.ext.coverage',
7-
'sphinx.ext.viewcode',
8-
'jaraco.packaging.sphinx',
9-
]
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
103

11-
# Add any paths that contain templates here, relative to this directory.
12-
templates_path = ['_templates']
13-
14-
# The suffix(es) of source filenames.
15-
# You can specify multiple suffix as a list of string:
16-
#
17-
# source_suffix = ['.rst', '.md']
18-
source_suffix = '.rst'
19-
20-
# The master toctree document.
21-
master_doc = 'index'
22-
23-
# General information about the project.
24-
copyright = '2017-2019, Brett Cannon, Barry Warsaw'
25-
26-
# The language for content autogenerated by Sphinx. Refer to documentation
27-
# for a list of supported languages.
28-
#
29-
# This is also used if you do content translation via gettext catalogs.
30-
# Usually you set "language" from the command line for these cases.
31-
language = None
32-
33-
# List of patterns, relative to source directory, that match files and
34-
# directories to ignore when looking for source files.
35-
# This patterns also effect to html_static_path and html_extra_path
36-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
37-
38-
# The name of the Pygments (syntax highlighting) style to use.
39-
pygments_style = 'sphinx'
40-
41-
# If true, `todo` and `todoList` produce output, else they produce nothing.
42-
todo_include_todos = False
43-
44-
45-
# -- Options for HTML output ----------------------------------------------
46-
47-
# The theme to use for HTML and HTML Help pages. See the documentation for
48-
# a list of builtin themes.
49-
#
50-
html_theme = 'default'
51-
52-
# Custom sidebar templates, must be a dictionary that maps document names
53-
# to template names.
54-
#
55-
# This is required for the alabaster theme
56-
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
57-
html_sidebars = {
58-
'**': [
59-
'relations.html', # needs 'show_related': True theme option to display
60-
'searchbox.html',
61-
]
62-
}
63-
64-
65-
# -- Options for HTMLHelp output ------------------------------------------
66-
67-
# Output file base name for HTML help builder.
68-
htmlhelp_basename = 'importlib_resourcesdoc'
69-
70-
71-
# -- Options for LaTeX output ---------------------------------------------
72-
73-
# Grouping the document tree into LaTeX files. List of tuples
74-
# (source start file, target name, title,
75-
# author, documentclass [howto, manual, or own class]).
76-
latex_documents = [
77-
(master_doc, 'importlib_resources.tex',
78-
'importlib\\_resources Documentation',
79-
'Brett Cannon, Barry Warsaw', 'manual'),
80-
]
81-
82-
83-
# -- Options for manual page output ---------------------------------------
84-
85-
# One entry per manual page. List of tuples
86-
# (source start file, name, description, authors, manual section).
87-
man_pages = [
88-
(master_doc, 'importlib_resources', 'importlib_resources Documentation',
89-
['unknown'], 1)
90-
]
91-
92-
93-
# -- Options for Texinfo output -------------------------------------------
94-
95-
# Grouping the document tree into Texinfo files. List of tuples
96-
# (source start file, target name, title, author,
97-
# dir menu entry, description, category)
98-
texinfo_documents = [
99-
(master_doc, 'importlib_resources', 'importlib_resources Documentation',
100-
'unknown', 'importlib_resources', 'One line description of project.',
101-
'Miscellaneous'),
102-
]
103-
104-
105-
# Example configuration for intersphinx: refer to the Python standard library.
106-
intersphinx_mapping = {
107-
'python': ('https://docs.python.org/3', None),
108-
}
4+
extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker']
1095

6+
master_doc = "index"
1107

1118
link_files = {
112-
'changelog.rst': dict(
9+
'../CHANGES.rst': dict(
11310
using=dict(GH='https://github.com'),
11411
replace=[
11512
dict(
11613
pattern=r'(Issue #|\B#)(?P<issue>\d+)',
11714
url='{package_url}/issues/{issue}',
118-
),
15+
),
11916
dict(
120-
pattern=r'^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n',
17+
pattern=r'(?m:^((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n)',
12118
with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n',
122-
),
19+
),
12320
dict(
12421
pattern=r'PEP[- ](?P<pep_number>\d+)',
12522
url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/',
126-
),
23+
),
12724
dict(
12825
pattern=r'(Python #|bpo-)(?P<python>\d+)',
12926
url='http://bugs.python.org/issue{python}',
130-
),
131-
],
132-
),
133-
}
27+
),
28+
],
29+
),
30+
}

docs/history.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:tocdepth: 2
2+
3+
.. _changes:
4+
5+
History
6+
*******
7+
8+
.. include:: ../CHANGES (links).rst

importlib_resources/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""Read resources contained within a package."""
22

33
from ._common import (
4-
as_file, files,
5-
)
4+
as_file,
5+
files,
6+
)
67

78
from importlib_resources._py3 import (
89
Package,
@@ -14,7 +15,7 @@
1415
path,
1516
read_binary,
1617
read_text,
17-
)
18+
)
1819
from importlib_resources.abc import ResourceReader
1920

2021
# For compatibility. Ref #88.
@@ -35,4 +36,4 @@
3536
'path',
3637
'read_binary',
3738
'read_text',
38-
]
39+
]

0 commit comments

Comments
 (0)