Skip to content

Commit f279dd3

Browse files
committed
Fix URI resolution with scheme-only URI
Prepare for 2.0 release which drops support for 2.7, 3.3, 3.4, 3.5, 3.6 and sets the foundation for better future development practices (declarative packaging configuration, pre-commit enforcement, etc.) Closes #81
1 parent b2efb2d commit f279dd3

39 files changed

+345
-284
lines changed

.github/workflows/main.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
tags:
7+
pull_request:
8+
9+
jobs:
10+
main:
11+
strategy:
12+
matrix:
13+
include:
14+
# linux
15+
- os: ubuntu-latest
16+
python: pypy-3.7
17+
toxenv: py
18+
- os: ubuntu-latest
19+
python: 3.7
20+
toxenv: py
21+
- os: ubuntu-latest
22+
python: 3.8
23+
toxenv: py
24+
- os: ubuntu-latest
25+
python: 3.9
26+
toxenv: py
27+
- os: ubuntu-latest
28+
python: '3.10'
29+
toxenv: py
30+
# windows
31+
- os: windows-latest
32+
python: 3.7
33+
toxenv: py
34+
# misc
35+
- os: ubuntu-latest
36+
python: 3.9
37+
toxenv: docs
38+
- os: ubuntu-latest
39+
python: 3.9
40+
toxenv: pre-commit
41+
runs-on: ${{ matrix.os }}
42+
steps:
43+
- uses: actions/checkout@v2
44+
- uses: actions/setup-python@v2
45+
with:
46+
python-version: ${{ matrix.python }}
47+
- run: python -mpip install --upgrade setuptools pip tox virtualenv
48+
- run: tox -e ${{ matrix.toxenv }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
.coverage
33
.tox
44
*.egg-info
5+
.pytest_cache
6+
.cache/
57
build/
68
doc/_build/
79
dist/
10+
t.py

.pre-commit-config.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.1.0
4+
hooks:
5+
- id: check-yaml
6+
- id: debug-statements
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
- repo: https://github.com/asottile/reorder_python_imports
10+
rev: v2.6.0
11+
hooks:
12+
- id: reorder-python-imports
13+
args: [--application-directories, '.:src', --py37-plus]
14+
- repo: https://github.com/psf/black
15+
rev: 21.12b0
16+
hooks:
17+
- id: black
18+
args: [--line-length=79]
19+
- repo: https://github.com/asottile/pyupgrade
20+
rev: v2.31.0
21+
hooks:
22+
- id: pyupgrade
23+
args: [--py37-plus]
24+
- repo: https://github.com/pycqa/flake8
25+
rev: 4.0.1
26+
hooks:
27+
- id: flake8
28+
exclude: ^(tests/|docs/|setup.py)
29+
additional_dependencies:
30+
- flake8-docstrings
31+
- flake8-import-order
32+
#- repo: https://github.com/pre-commit/mirrors-mypy
33+
# rev: v0.910-1
34+
# hooks:
35+
# - id: mypy
36+
# exclude: ^(docs/|example-plugin/)

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
rfc3986
22
=======
33

4-
A Python implementation of `RFC 3986`_ including validation and authority
4+
A Python implementation of `RFC 3986`_ including validation and authority
55
parsing.
66

77
Installation

docs/source/api-ref/miscellaneous.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Miscellaneous Submodules
33
==========================
44

5-
There are several submodules in |rfc3986| that are not meant to be exposed to
5+
There are several submodules in |rfc3986| that are not meant to be exposed to
66
users directly but which are valuable to document, regardless.
77

88
.. data:: rfc3986.misc.UseExisting

docs/source/conf.py

+33-30
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# rfc3986 documentation build configuration file, created by
43
# sphinx-quickstart on Tue Mar 14 07:06:46 2017.
@@ -11,7 +10,6 @@
1110
#
1211
# All configuration values have a default; values that are commented out
1312
# serve to show the default.
14-
1513
# If extensions (or modules to document with autodoc) are in another directory,
1614
# add these directories to sys.path here. If the directory is relative to the
1715
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -35,29 +33,29 @@
3533
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3634
# ones.
3735
extensions = [
38-
'sphinx.ext.autodoc',
39-
'sphinx.ext.doctest',
40-
'sphinx.ext.intersphinx',
41-
'sphinx.ext.coverage',
42-
'sphinx-prompt',
36+
"sphinx.ext.autodoc",
37+
"sphinx.ext.doctest",
38+
"sphinx.ext.intersphinx",
39+
"sphinx.ext.coverage",
40+
"sphinx-prompt",
4341
]
4442

4543
# Add any paths that contain templates here, relative to this directory.
46-
templates_path = ['_templates']
44+
templates_path = ["_templates"]
4745

4846
# The suffix(es) of source filenames.
4947
# You can specify multiple suffix as a list of string:
5048
#
5149
# source_suffix = ['.rst', '.md']
52-
source_suffix = '.rst'
50+
source_suffix = ".rst"
5351

5452
# The master toctree document.
55-
master_doc = 'index'
53+
master_doc = "index"
5654

5755
# General information about the project.
58-
project = u'rfc3986'
59-
copyright = u'2017, Ian Stapleton Cordasco'
60-
author = u'Ian Stapleton Cordasco'
56+
project = "rfc3986"
57+
copyright = "2017, Ian Stapleton Cordasco"
58+
author = "Ian Stapleton Cordasco"
6159

6260
# The version info for the project you're documenting, acts as replacement for
6361
# |version| and |release|, also used in various other places throughout the
@@ -81,7 +79,7 @@
8179
exclude_patterns = []
8280

8381
# The name of the Pygments (syntax highlighting) style to use.
84-
pygments_style = 'sphinx'
82+
pygments_style = "sphinx"
8583

8684
# If true, `todo` and `todoList` produce output, else they produce nothing.
8785
todo_include_todos = False
@@ -92,7 +90,7 @@
9290
# The theme to use for HTML and HTML Help pages. See the documentation for
9391
# a list of builtin themes.
9492
#
95-
html_theme = 'sphinx_rtd_theme'
93+
html_theme = "sphinx_rtd_theme"
9694

9795
# Theme options are theme-specific and customize the look and feel of a theme
9896
# further. For a list of options available for each theme, see the
@@ -103,13 +101,13 @@
103101
# Add any paths that contain custom static files (such as style sheets) here,
104102
# relative to this directory. They are copied after the builtin static files,
105103
# so a file named "default.css" will overwrite the builtin "default.css".
106-
html_static_path = ['_static']
104+
html_static_path = ["_static"]
107105

108106

109107
# -- Options for HTMLHelp output ------------------------------------------
110108

111109
# Output file base name for HTML help builder.
112-
htmlhelp_basename = 'rfc3986doc'
110+
htmlhelp_basename = "rfc3986doc"
113111

114112

115113
# -- Options for LaTeX output ---------------------------------------------
@@ -118,15 +116,12 @@
118116
# The paper size ('letterpaper' or 'a4paper').
119117
#
120118
# 'papersize': 'letterpaper',
121-
122119
# The font size ('10pt', '11pt' or '12pt').
123120
#
124121
# 'pointsize': '10pt',
125-
126122
# Additional stuff for the LaTeX preamble.
127123
#
128124
# 'preamble': '',
129-
130125
# Latex figure (float) alignment
131126
#
132127
# 'figure_align': 'htbp',
@@ -136,19 +131,21 @@
136131
# (source start file, target name, title,
137132
# author, documentclass [howto, manual, or own class]).
138133
latex_documents = [
139-
(master_doc, 'rfc3986.tex', u'rfc3986 Documentation',
140-
u'Ian Stapleton Cordasco', 'manual'),
134+
(
135+
master_doc,
136+
"rfc3986.tex",
137+
"rfc3986 Documentation",
138+
"Ian Stapleton Cordasco",
139+
"manual",
140+
),
141141
]
142142

143143

144144
# -- Options for manual page output ---------------------------------------
145145

146146
# One entry per manual page. List of tuples
147147
# (source start file, name, description, authors, manual section).
148-
man_pages = [
149-
(master_doc, 'rfc3986', u'rfc3986 Documentation',
150-
[author], 1)
151-
]
148+
man_pages = [(master_doc, "rfc3986", "rfc3986 Documentation", [author], 1)]
152149

153150

154151
# -- Options for Texinfo output -------------------------------------------
@@ -157,11 +154,17 @@
157154
# (source start file, target name, title, author,
158155
# dir menu entry, description, category)
159156
texinfo_documents = [
160-
(master_doc, 'rfc3986', u'rfc3986 Documentation',
161-
author, 'rfc3986', 'One line description of project.',
162-
'Miscellaneous'),
157+
(
158+
master_doc,
159+
"rfc3986",
160+
"rfc3986 Documentation",
161+
author,
162+
"rfc3986",
163+
"One line description of project.",
164+
"Miscellaneous",
165+
),
163166
]
164167

165168

166169
# Example configuration for intersphinx: refer to the Python standard library.
167-
intersphinx_mapping = {'https://docs.python.org/': None}
170+
intersphinx_mapping = {"https://docs.python.org/": None}

docs/source/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
rfc3986
33
=========
44

5-
|rfc3986| is a Python implementation of :rfc:`3986` including validation and
5+
|rfc3986| is a Python implementation of :rfc:`3986` including validation and
66
authority parsing. This module also supports :rfc:`6874` which adds support
77
for zone identifiers to IPv6 Addresses.
88

9-
The maintainers strongly suggest using `pip`_ to install |rfc3986|. For
9+
The maintainers strongly suggest using `pip`_ to install |rfc3986|. For
1010
example,
1111

1212
.. prompt:: bash

docs/source/release-notes/0.2.2.rst

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
- Update the regular name regular expression to accept all of the characters
55
allowed in the RFC. Closes bug #11 (Thanks Viktor Haag). Previously URIs
66
similar to "http://http-bin.org" would be considered invalid.
7-

docs/source/release-notes/1.1.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
1.1.0 -- 2017-07-18
22
-------------------
33

4-
- Correct the regular expression for the User Information sub-component of the
4+
- Correct the regular expression for the User Information sub-component of the
55
Authority Component.
66

77
See also `GitHub #26`_

docs/source/release-notes/1.4.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Security
77
- Prevent users from receiving an invalid authority parsed from a malicious
88
URL. Previously we did not stop parsing the authority section at the first
99
backslash (``\\``) character. As a result, it was possible to trick our
10-
parser into parsing up to the first forward-slash (``/``) and thus
10+
parser into parsing up to the first forward-slash (``/``) and thus
1111
generating an invalid authority.
1212

1313
See also `GitHub pr-64`_ and `the blog post that sparked this change`_
+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
1.x.y - 202z-aa-bb
1+
2.0.0 - 202z-aa-bb
22
------------------
33

4+
- Drop support for Python 2.7, 3.3, 3.4, 3.5, 3.6
5+
6+
- Add support for Python 3.8, 3.9, 3.10
7+
8+
- Fix bug in resolving URIs that only contain schemes which are valid per the
9+
RFC - `bug 81`_
10+
411
.. links below here
12+
.. _bug 81:
13+
https://github.com/python-hyper/rfc3986/issues/81

docs/source/user/validating.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ Checking the Validity of Components
143143
-----------------------------------
144144

145145
As of version 1.1.0, |rfc3986| allows users to check the validity of a URI
146-
Reference using a :class:`~rfc3986.validators.Validator`. Along with the above
146+
Reference using a :class:`~rfc3986.validators.Validator`. Along with the above
147147
examples we can also check that a URI is valid per :rfc:`3986`. The validation
148-
of the components is pre-determined so all we need to do is specify which
148+
of the components is pre-determined so all we need to do is specify which
149149
components we want to validate:
150150

151151
>>> from rfc3986 import validators, uri_reference

setup.cfg

+35
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
1+
[metadata]
2+
name = rfc3986
3+
version = attr: rfc3986.__version__
4+
description = Validating URI References per RFC 3986
5+
long_description = file: README.rst
6+
author = Ian Stapleton Cordasco
7+
author_email = [email protected]
8+
url = http://rfc3986.readthedocs.io
9+
license = Apache 2.0
10+
classifiers =
11+
Development Status :: 5 - Production/Stable
12+
Intended Audience :: Developers
13+
Natural Language :: English
14+
License :: OSI Approved :: Apache Software License
15+
Programming Language :: Python
16+
Programming Language :: Python :: 3.7
17+
Programming Language :: Python :: 3.8
18+
Programming Language :: Python :: 3.9
19+
Programming Language :: Python :: 3.10
20+
21+
[options]
22+
packages = find:
23+
package_dir = =src
24+
include_package_data = True
25+
26+
[options.packages.find]
27+
where = src
28+
29+
[options.extras_require]
30+
idna2008 = idna
31+
32+
[options.package_data]
33+
* =
34+
LICENSE
35+
136
[bdist_wheel]
237
universal = 1

0 commit comments

Comments
 (0)