Skip to content

Commit a8e50d2

Browse files
authored
Merge branch 'master' into query-separator
2 parents 179fa68 + a6e8c8d commit a8e50d2

29 files changed

+1025
-243
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.22.0
2+
current_version = 2.1.0
33
commit = True
44
tag = True
55
tag_name = v{new_version}

.flake8

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[flake8]
2+
ignore =
3+
# Refers to the max-line length. Let's suppress the error and simply
4+
# let black take care on how it wants to format the lines.
5+
E501,
6+
7+
# Refers to "line break before/after binary operator".
8+
# Similar to above, let black take care of the formatting.
9+
W503,
10+
W504,
11+
12+
# black disagrees with flake8, and inserts whitespace
13+
# E203: whitespace before ':'
14+
E203,

.github/workflows/build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@ on:
1111
jobs:
1212
build:
1313

14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
1717
include:
18-
- python-version: 3.7
18+
- python-version: "3.7"
1919
env:
2020
TOXENV: docs
21-
- python-version: 3.9
21+
- python-version: "3.10"
2222
env:
2323
TOXENV: flake8
24-
- python-version: 3.9
24+
- python-version: "3.10"
2525
env:
2626
TOXENV: pylint
27-
- python-version: 3.9
27+
- python-version: "3.10"
2828
env:
2929
TOXENV: security
30-
- python-version: 3.9
30+
- python-version: "3.10"
3131
env:
3232
TOXENV: black
33-
- python-version: 3.9
33+
- python-version: "3.10"
3434
env:
3535
TOXENV: typing
3636

3737
steps:
38-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v3
3939

4040
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v2
41+
uses: actions/setup-python@v4
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ on:
77

88
jobs:
99
publish:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414

1515
- name: Set up Python 3.9
16-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v4
1717
with:
1818
python-version: 3.9
1919

.github/workflows/tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ on:
1111
jobs:
1212
tests:
1313

14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: [3.6, 3.7, 3.8, 3.9, pypy3]
17+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.7"]
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121

2222
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v4
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626

CODE_OF_CONDUCT.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series of
86+
actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or permanent
93+
ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within the
113+
community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.1, available at
119+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120+
121+
Community Impact Guidelines were inspired by
122+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123+
124+
For answers to common questions about this code of conduct, see the FAQ at
125+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126+
[https://www.contributor-covenant.org/translations][translations].
127+
128+
[homepage]: https://www.contributor-covenant.org
129+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130+
[Mozilla CoC]: https://github.com/mozilla/diversity
131+
[FAQ]: https://www.contributor-covenant.org/faq
132+
[translations]: https://www.contributor-covenant.org/translations

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ recursive-include docs Makefile make.bat conf.py *.rst
66

77
# Miscellaneous assets
88
include LICENSE
9+
include NEWS
910
include README.rst
1011
include pytest.ini
1112
include tox.ini

NEWS

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,109 @@
11
w3lib release notes
22
===================
33

4+
2.1.0 (2022-11-28)
5+
------------------
6+
7+
- Dropped Python 3.6 support, and made Python 3.11 support official. (#195,
8+
#200)
9+
10+
- :func:`~w3lib.url.safe_url_string` now generates safer URLs.
11+
12+
To make URLs safer for the `URL living standard`_:
13+
14+
.. _URL living standard: https://url.spec.whatwg.org/
15+
16+
- ``;=`` are percent-encoded in the URL username.
17+
18+
- ``;:=`` are percent-encoded in the URL password.
19+
20+
- ``'`` is percent-encoded in the URL query if the URL scheme is `special
21+
<https://url.spec.whatwg.org/#special-scheme>`__.
22+
23+
To make URLs safer for `RFC 2396`_ and `RFC 3986`_, ``|[]`` are
24+
percent-encoded in URL paths, queries, and fragments.
25+
26+
.. _RFC 2396: https://www.ietf.org/rfc/rfc2396.txt
27+
.. _RFC 3986: https://www.ietf.org/rfc/rfc3986.txt
28+
29+
(#80, #203)
30+
31+
- :func:`~w3lib.encoding.html_to_unicode` now checks for the `byte order
32+
mark`_ before inspecting the ``Content-Type`` header when determining the
33+
content encoding, in line with the `URL living standard`_. (#189, #191)
34+
35+
.. _byte order mark: https://en.wikipedia.org/wiki/Byte_order_mark
36+
37+
- :func:`~w3lib.url.canonicalize_url` now strips spaces from the input URL,
38+
to be more in line with the `URL living standard`_. (#132, #136)
39+
40+
- :func:`~w3lib.html.get_base_url` now ignores HTML comments. (#70, #77)
41+
42+
- Fixed :func:`~w3lib.url.safe_url_string` re-encoding percent signs on
43+
the URL username and password even when they were being used as part of an
44+
escape sequence. (#187, #196)
45+
46+
- Fixed :func:`~w3lib.http.basic_auth_header` using the wrong flavor of
47+
base64 encoding, which could prevent authentication in rare cases. (#181,
48+
#192)
49+
50+
- Fixed :func:`~w3lib.html.replace_entities` raising :exc:`OverflowError` in
51+
some cases due to `a bug in CPython
52+
<https://github.com/python/cpython/issues/76763>`__. (#199, #202)
53+
54+
- Improved typing and fixed typing issues. (#190, #206)
55+
56+
- Made CI and test improvements. (#197, #198)
57+
58+
- Adopted a Code of Conduct. (#194)
59+
60+
61+
2.0.1 (2022-08-11)
62+
------------------
63+
Minor documentation fix (release date is set in the changelog).
64+
65+
2.0.0 (2022-08-11)
66+
------------------
67+
68+
Backwards incompatible changes:
69+
70+
- Python 2 is no longer supported; Python 3.6+ is required now (#168, #175).
71+
- :func:`w3lib.url.safe_url_string` and :func:`w3lib.url.canonicalize_url`
72+
no longer convert "%23" to "#" when it appears in the URL path. This is a bug
73+
fix. It's listed as a backward-incomatible change because in some cases the
74+
output of :func:`w3lib.url.canonicalize_url` is going to change, and so, if
75+
this output is used to generate URL fingerprints, new fingerprints might be
76+
incompatible with those created with the previous w3lib versions
77+
(#141).
78+
79+
Deprecation removals (#169):
80+
81+
- The ``w3lib.form`` module is removed.
82+
- The ``w3lib.html.remove_entities`` function is removed.
83+
- The ``w3lib.url.urljoin_rfc`` function is removed.
84+
85+
The following functions are deprecated, and will be removed in future releases
86+
(#170):
87+
88+
- ``w3lib.util.str_to_unicode``
89+
- ``w3lib.util.unicode_to_str``
90+
- ``w3lib.util.to_native_str``
91+
92+
Other improvements and bug fixes:
93+
94+
- Type annotations are added (#172, #184).
95+
- Added support for Python 3.9 and 3.10 (#168, #176).
96+
- Fixed :func:`w3lib.html.get_meta_refresh` for ``<meta>`` tags where
97+
``http-equiv`` is written after ``content`` (#179).
98+
- Fixed :func:`w3lib.url.safe_url_string` for IDNA domains with ports (#174).
99+
- :func:`w3lib.url.url_query_cleaner` no longer adds an unneeded ``#`` when
100+
``keep_fragments=True`` is passed, and the URL doesn't have a fragment
101+
(#159).
102+
- Removed a workaround for an ancient pathname2url bug (#142)
103+
- CI is migrated to GitHub Actions (#166, #177); other CI improvements (#160,
104+
#182).
105+
- The code is formatted using black (#173).
106+
4107
1.22.0 (2020-05-13)
5108
-------------------
6109

@@ -84,8 +187,6 @@ w3lib release notes
84187
- ``url_query_cleaner()``: support new ``keep_fragments`` argument
85188
(defaulting to ``False``)
86189

87-
.. _RFC 3986: https://tools.ietf.org/html/rfc3986#section-3.2
88-
89190
1.15.0 (2016-07-29)
90191
-------------------
91192

README.rst

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

5-
.. image:: https://secure.travis-ci.org/scrapy/w3lib.png?branch=master
6-
:target: http://travis-ci.org/scrapy/w3lib
5+
.. image:: https://github.com/scrapy/w3lib/actions/workflows/tests.yml/badge.svg
6+
:target: https://github.com/scrapy/w3lib/actions
77

88
.. image:: https://img.shields.io/codecov/c/github/scrapy/w3lib/master.svg
99
:target: http://codecov.io/github/scrapy/w3lib?branch=master
@@ -27,7 +27,7 @@ This is a Python library of web-related functions, such as:
2727
Requirements
2828
============
2929

30-
Python 3.6+
30+
Python 3.7+
3131

3232
Install
3333
=======

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
# built documents.
5454
#
5555
# The full version, including alpha/beta/rc tags.
56-
release = '1.22.0'
56+
release = '2.1.0'
5757
# The short X.Y version.
5858
version = '.'.join(release.split('.')[:2])
5959

0 commit comments

Comments
 (0)