Skip to content

Commit d0ff443

Browse files
authored
Merge pull request #191 from prkumar/master
Release v0.9.1
2 parents ff72f3f + a6a9bcd commit d0ff443

21 files changed

Lines changed: 191 additions & 79 deletions

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ python:
44
- '3.4'
55
- '3.5'
66
- '3.6'
7-
- '3.6-dev'
8-
- '3.7-dev'
7+
- '3.7'
8+
- '3.8'
99
before_script:
1010
- pip install tox
1111
- if [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then pip install flake8 flake8-bugbear; fi

CHANGELOG.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ All notable changes to this project will be documented in this file.
66
The format is based on `Keep a Changelog`_, and this project adheres to the
77
`Semantic Versioning`_ scheme.
88

9+
0.9.1_ - 2020-02-08
10+
===================
11+
Fixed
12+
-----
13+
- Omit ``Header`` argument from request when its value is ``None``.
14+
(`#167`_, `#169`_)
15+
- Fix ``AttributeError`` raised on usage of ``uplink.Url``.
16+
(`#164`_, `#165`_ by `@cognifloyd`_)
17+
18+
Changed
19+
-------
20+
- Exclude ``tests`` subpackages from wheel.
21+
(`#188`_ by `@daa`_)
22+
923
0.9.0_ - 2019-06-05
1024
===================
1125
Added
@@ -29,7 +43,7 @@ Fixed
2943

3044
Changed
3145
-------
32-
- Renamed ``uplink.retry.stop.DISABLE`` to ``uplink.retry.stop.NEVER``
46+
- Rename ``uplink.retry.stop.DISABLE`` to ``uplink.retry.stop.NEVER``
3347

3448
0.8.0_ - 2019-02-16
3549
===================
@@ -294,6 +308,7 @@ Added
294308
.. _`Semantic Versioning`: https://packaging.python.org/tutorials/distributing-packages/#semantic-versioning-preferred
295309

296310
.. Releases
311+
.. _0.9.1: https://github.com/prkumar/uplink/compare/v0.9.1...HEAD
297312
.. _0.9.0: https://github.com/prkumar/uplink/compare/v0.8.0...v0.9.0
298313
.. _0.8.0: https://github.com/prkumar/uplink/compare/v0.7.0...v0.8.0
299314
.. _0.7.0: https://github.com/prkumar/uplink/compare/v0.6.1...v0.7.0
@@ -326,10 +341,16 @@ Added
326341
.. _#154: https://github.com/prkumar/uplink/pull/154
327342
.. _#155: https://github.com/prkumar/uplink/pull/155
328343
.. _#159: https://github.com/prkumar/uplink/pull/159
344+
.. _#164: https://github.com/prkumar/uplink/issues/164
345+
.. _#165: https://github.com/prkumar/uplink/pull/165
346+
.. _#167: https://github.com/prkumar/uplink/issues/167
347+
.. _#169: https://github.com/prkumar/uplink/pull/169
348+
.. _#188: https://github.com/prkumar/uplink/pull/188
329349

330350
.. Contributors
331351
.. _@daa: https://github.com/daa
332352
.. _@SakornW: https://github.com/SakornW
333353
.. _@brandonio21: https://github.com/brandonio21
334354
.. _@itstehkman: https://github.com/itstehkman
335355
.. _@kadrach: https://github.com/kadrach
356+
.. _@cognifloyd: https://github.com/cognifloyd

Pipfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ url = "https://pypi.org/simple"
33
verify_ssl = true
44
name = "pypi"
55

6-
76
[dev-packages]
87
pre-commit = "*"
98
tox = "*"

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ Want to report a bug, request a feature, or contribute code to Uplink?
180180
Checkout the `Contribution Guide`_ for where to start.
181181
Thank you for taking the time to improve an open source project :purple_heart:
182182

183-
.. |Build Status| image:: https://travis-ci.org/prkumar/uplink.svg?branch=master
184-
:target: https://travis-ci.org/prkumar/uplink
183+
.. |Build Status| image:: https://travis-ci.com/prkumar/uplink.svg?branch=master
184+
:target: https://travis-ci.com/prkumar/uplink
185185
.. |Code Climate| image:: https://api.codeclimate.com/v1/badges/d5c5666134763ff1d6c0/maintainability
186186
:target: https://codeclimate.com/github/prkumar/uplink/maintainability
187187
:alt: Maintainability

docs/source/user/quickstart.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ Requests for a different backing HTTP client, such as :ref:`aiohttp <sync_vs_asy
116116

117117
.. |aiohttp| replace:: ``aiohttp``
118118

119-
URL Manipulation
120-
================
119+
Path Parameters
120+
===============
121121

122122
Resource endpoints can include `URI template parameters
123123
<https://tools.ietf.org/html/rfc6570>`__ that depend on method
@@ -139,8 +139,11 @@ or use the :py:class:`~uplink.Path` annotation.
139139
@get("users/{username}")
140140
def get_user(self, name: Path("username")): pass
141141
142-
:py:class:`~uplink.Query` parameters can also be added dynamically
143-
by method arguments.
142+
Query Parameters
143+
================
144+
145+
Query parameters can be added dynamically using the :py:class:`~uplink.Query`
146+
argument annotation.
144147

145148
.. code-block:: python
146149
@@ -193,8 +196,8 @@ parameters that need to be included with every request:
193196
class GitHub(Consumer):
194197
...
195198
196-
Header Manipulation
197-
===================
199+
Request Headers
200+
===============
198201

199202
You can set static headers for a method using the :py:class:`@headers <uplink.headers>`
200203
decorator.

setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ def read(filename):
2121
"marshmallow": ["marshmallow>=2.15.0"],
2222
"aiohttp:python_version <= '3.4'": [],
2323
"aiohttp:python_version >= '3.4'": "aiohttp>=2.3.0",
24-
"twisted:python_version != '3.3'": "twisted>=17.1.0",
24+
"twisted:python_version != '3.3' and python_version != '3.4'": "twisted>=17.1.0",
25+
# Twisted 18.4.0 dropped py3.3 support
2526
"twisted:python_version == '3.3'": "twisted<=17.9.0",
27+
# Twisted 19.7.0 dropped py3.4 support
28+
"twisted:python_version == '3.4'": "twisted<=19.2.1",
2629
"typing": ["typing>=3.6.4"],
27-
"tests": ["pytest<4.1", "pytest-mock", "pytest-cov", "pytest-twisted"],
30+
"tests": ["pytest==4.6.5", "pytest-mock", "pytest-cov", "pytest-twisted"],
2831
}
2932

3033
metadata = {
@@ -50,7 +53,7 @@ def read(filename):
5053
"Programming Language :: Python :: Implementation :: PyPy",
5154
],
5255
"keywords": "http api rest client retrofit",
53-
"packages": find_packages(exclude=("tests",)),
56+
"packages": find_packages(exclude=("tests", "tests.*")),
5457
"install_requires": install_requires,
5558
"extras_require": extras_require,
5659
}

tests/integration/test_basic.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ def list_repos(self, user):
2121
def get_repo(self, user, repo):
2222
pass
2323

24+
@uplink.get(args={"url": uplink.Url})
25+
def forward(self, url):
26+
pass
27+
2428

2529
def test_list_repo(mock_client):
2630
github = GitHubService(base_url=BASE_URL, client=mock_client)
@@ -51,6 +55,15 @@ def test_get_repo(mock_client, mock_response):
5155
assert expected_json == actual_json
5256

5357

58+
def test_forward(mock_client):
59+
github = GitHubService(base_url=BASE_URL, client=mock_client)
60+
github.forward("/users/prkumar/repos")
61+
request = mock_client.history[0]
62+
assert request.method == "GET"
63+
assert request.has_base_url(BASE_URL)
64+
assert request.has_endpoint("/users/prkumar/repos")
65+
66+
5467
def test_handle_client_exceptions(mock_client):
5568
# Setup: mock client exceptions
5669

tests/unit/test_arguments.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def test_modify_request_definition(self, request_definition_builder):
249249

250250
def test_modify_request(self, request_builder):
251251
arguments.Path("name").modify_request(request_builder, "value")
252-
request_builder.url.set_variable.assert_called_with({"name": "value"})
252+
request_builder.set_url_variable.assert_called_with({"name": "value"})
253253

254254

255255
class TestQuery(ArgumentTestCase, FuncDecoratorTestCase):
@@ -327,6 +327,10 @@ def test_modify_request(self, request_builder):
327327
arguments.Header("hello").modify_request(request_builder, "world")
328328
assert request_builder.info["headers"] == {"hello": "world"}
329329

330+
def test_skip_none(self, request_builder):
331+
arguments.Header("hello").modify_request(request_builder, None)
332+
assert request_builder.info["headers"] == {}
333+
330334

331335
class TestHeaderMap(ArgumentTestCase, FuncDecoratorTestCase):
332336
type_cls = arguments.HeaderMap
@@ -421,7 +425,7 @@ def test_modify_request_definition_failure(
421425

422426
def test_modify_request(self, request_builder):
423427
arguments.Url().modify_request(request_builder, "/some/path")
424-
assert request_builder.url == "/some/path"
428+
assert request_builder.relative_url == "/some/path"
425429

426430

427431
class TestTimeout(ArgumentTestCase, FuncDecoratorTestCase):

tests/unit/test_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def uplink_builder(http_client_mock):
2525
class TestRequestPreparer(object):
2626
def test_prepare_request(self, mocker, request_builder):
2727
request_builder.method = "METHOD"
28-
request_builder.url = "/example/path"
28+
request_builder.relative_url = "/example/path"
2929
request_builder.return_type = None
3030
request_builder.transaction_hooks = ()
3131
request_builder.request_template = "request_template"
@@ -45,7 +45,7 @@ def test_prepare_request_with_transaction_hook(
4545
self, mocker, uplink_builder, request_builder, transaction_hook_mock
4646
):
4747
request_builder.method = "METHOD"
48-
request_builder.url = "/example/path"
48+
request_builder.relative_url = "/example/path"
4949
request_builder.request_template = "request_template"
5050
uplink_builder.base_url = "https://example.com"
5151
request_builder.transaction_hooks = [transaction_hook_mock]

tests/unit/test_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def test_define_request(self, request_builder, mocker):
228228
)
229229
definition.define_request(request_builder, (), {})
230230
assert request_builder.method == method
231-
assert request_builder.url == uri
231+
assert request_builder.relative_url == uri
232232
assert request_builder.return_type is str
233233

234234
def test_make_converter_registry(self, annotation_handler_mock):

0 commit comments

Comments
 (0)