Skip to content

Commit

Permalink
Merge pull request #242 from prkumar/master
Browse files Browse the repository at this point in the history
Release v0.9.5
  • Loading branch information
prkumar committed Jan 4, 2022
2 parents 1649e43 + 1d7cc2b commit a013758
Show file tree
Hide file tree
Showing 25 changed files with 134 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ about: Pose an inquiry
---

--
**Important:** Before creating an issue, please consider posting your question to our [Gitter Lobby](https://gitter.im/python-uplink/Lobby) first, especially if you suspect that the underlying problem is not a bug nor a feature request.
**Important:** Before creating an issue, please consider posting your question to our [GitHub Discussions](https://github.com/prkumar/uplink/discussions) page first, especially if you suspect that the underlying problem is not a bug nor a feature request.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ instance/

# Sphinx documentation
docs/source/.doctrees/
docs/source/_build/
docs/_build/

# PyBuilder
Expand Down Expand Up @@ -118,3 +119,7 @@ ENV/
# [2]: https://docs.pipenv.org/advanced/#pipfile-vs-setup-py
#
Pipfile.lock

# macOS
.DS_Store

10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/ambv/black
rev: 18.6b4
rev: 21.12b0
hooks:
- id: black
python-version: python3.6
python-version: python3.8
files: ^((uplink|examples|tests)\/.+|setup|docs\/conf)\.py$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
- repo: https://github.com/pycqa/flake8
rev: '4.0.1'
hooks:
- id: flake8
name: flake8
python-version: python3.6
python-version: python3.8
files: ^((uplink|examples|tests)\/.+|setup|docs\/conf)\.py$
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
language: python
dist: bionic # Ubuntu 18.04
python:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10.1'
before_script:
- pip install tox
- if [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then pip install flake8 flake8-bugbear; fi
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Contributors
- Sakorn Waungwiwatsin (`@SakornW <https://github.com/SakornW>`_)
- Jacob Floyd (`@cognifloyd <https://github.com/cognifloyd>`_)
- Guilherme Crocetti (`@gmcrocetti <https://github.com/gmcrocetti/>`_)
- Alexander Shadchin (`@shadchin <https://github.com/shadchin>`_)
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_, and this project adheres to the
`Semantic Versioning`_ scheme.

0.9.5_ - 2022-01-04
====================
Added
-----
- Add Python 3.8, 3.9, and 3.10 as officially supported. (`#237`_)

Fixed
-----
- Fix ``FieldMap`` and ``PartMap`` from raising ``NoneType`` error. (`#221`_)
- Fix Python 2.7 support. (`#217`_)

Deprecated
----------
- Python 2.7 support will be removed in v0.10.0.

0.9.4_ - 2021-02-15
====================
Fixed
Expand Down Expand Up @@ -341,6 +356,7 @@ Added
.. _pydantic: https://pydantic-docs.helpmanual.io/

.. Releases
.. _0.9.5: https://github.com/prkumar/uplink/compare/v0.9.4...v0.9.5
.. _0.9.4: https://github.com/prkumar/uplink/compare/v0.9.3...v0.9.4
.. _0.9.3: https://github.com/prkumar/uplink/compare/v0.9.2...v0.9.3
.. _0.9.2: https://github.com/prkumar/uplink/compare/v0.9.1...v0.9.2
Expand Down Expand Up @@ -389,6 +405,9 @@ Added
.. _#204: https://github.com/prkumar/uplink/pull/204
.. _#207: https://github.com/prkumar/uplink/pull/207
.. _#209: https://github.com/prkumar/uplink/pull/209
.. _#217: https://github.com/prkumar/uplink/issues/217
.. _#221: https://github.com/prkumar/uplink/issues/221
.. _#237: https://github.com/prkumar/uplink/discussions/237

.. Commits
.. _3653a672ee: https://github.com/prkumar/uplink/commit/3653a672ee0703119720d0077bb450649af5459c
Expand Down
15 changes: 12 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Uplink
******
|PyPI Version| |Build Status| |Coverage Status| |Code Climate| |Documentation Status|
|Gitter| |Code Style|
|GitHub Discussions| |Gitter| |Code Style|

- Builds Reusable Objects for Consuming Web APIs.
- Works with **Requests**, **aiohttp**, and **Twisted**.
Expand Down Expand Up @@ -82,7 +82,9 @@ Features
- Built-in support for `Basic Authentication`_
- Use existing auth libraries for supported clients (e.g., |requests-oauthlib|_)

Uplink officially supports Python 2.7 & 3.3-3.7.
Uplink officially supports Python 2.7 and 3.5+.

**Note:** Python 2.7 suport will be removed in v0.10.0.

.. |marshmallow| replace:: ``marshmallow``
.. |pydantic| replace:: ``pydantic``
Expand Down Expand Up @@ -169,9 +171,14 @@ For new users, a good place to start is this `quick tutorial`_.
Community
=========

Join the conversation on `Gitter`_ to ask questions, provide feedback,
Use the `Discussions`_ tab on GitHub to join the conversation! Ask questions, provide feedback,
and meet other users!

We're migrating our community from `Gitter`_ to GitHub `Discussions`_. Feel free to search our
Gitter lobby for past questions and answers. However, to help us transition, please start new
threads/posts in GitHub Discussions instead of Gitter.

.. _Discussions: https://github.com/prkumar/uplink/discussions
.. _Gitter: https://gitter.im/python-uplink/Lobby


Expand All @@ -182,6 +189,8 @@ Want to report a bug, request a feature, or contribute code to Uplink?
Checkout the `Contribution Guide`_ for where to start.
Thank you for taking the time to improve an open source project :purple_heart:

.. |GitHub Discussions| image:: https://img.shields.io/github/discussions/prkumar/uplink.png
:target: https://github.com/prkumar/uplink/discussions
.. |Build Status| image:: https://travis-ci.com/prkumar/uplink.svg?branch=master
:target: https://travis-ci.com/prkumar/uplink
.. |Code Climate| image:: https://api.codeclimate.com/v1/badges/d5c5666134763ff1d6c0/maintainability
Expand Down
14 changes: 9 additions & 5 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Uplink 📡
A Declarative HTTP Client for Python. Inspired by `Retrofit
<http://square.github.io/retrofit/>`__.

|Release| |Python Version| |License| |Coverage Status| |Gitter|
|Release| |Python Version| |License| |Coverage Status| |GitHub Discussions|

.. _`Contribution Guide on GitHub`: https://github.com/prkumar/uplink/blob/master/CONTRIBUTING.rst
.. _Hacktoberfest: https://hacktoberfest.digitalocean.com/
Expand Down Expand Up @@ -85,10 +85,15 @@ Features
- Built-in support for :ref:`Basic Authentication <basic_authentication>`
- Use existing auth libraries for supported clients (e.g., |requests-oauthlib|_)

Uplink officially supports Python 2.7 & 3.3-3.7.
Uplink officially supports Python 2.7 & 3.5+.

.. note::

Python 2.7 suport will be removed in v0.10.0.

.. |marshmallow| replace:: ``marshmallow``
.. |requests-oauthlib| replace:: ``requests-oauthlib``

.. _`Non-blocking I/O support`: https://github.com/prkumar/uplink/tree/master/examples/async-requests
.. _`marshmallow`: https://github.com/prkumar/uplink/tree/master/examples/marshmallow
.. _`custom response and error handling`: https://uplink.readthedocs.io/en/latest/user/quickstart.html#response-and-error-handling
Expand Down Expand Up @@ -154,12 +159,11 @@ Miscellaneous
changes.rst


.. |GitHub Discussions| image:: https://img.shields.io/github/discussions/prkumar/uplink.png
:target: https://github.com/prkumar/uplink/discussions
.. |Coverage Status| image:: https://img.shields.io/codecov/c/github/prkumar/uplink.svg
:alt: Codecov
:target: https://codecov.io/gh/prkumar/uplink
.. |Gitter| image:: https://badges.gitter.im/python-uplink/Lobby.svg
:target: https://gitter.im/python-uplink/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
:alt: Join the chat at https://gitter.im/python-uplink/Lobby
.. |License| image:: https://img.shields.io/github/license/prkumar/uplink.svg
:target: https://github.com/prkumar/uplink/blob/master/LICENSE
.. |Python Version| image:: https://img.shields.io/pypi/pyversions/uplink.svg
Expand Down
11 changes: 5 additions & 6 deletions examples/async-requests/asyncio_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Example of using Uplink with aiohttp for non-blocking HTTP requests.
This should work on Python 3.4 and above.
This should work on Python 3.7 and above.
"""
import asyncio
import uplink
Expand All @@ -9,11 +9,10 @@
from github import BASE_URL, GitHub


@asyncio.coroutine
def get_contributors(full_name):
async def get_contributors(full_name):
print("Getting GitHub repository `{}`".format(full_name))
response = yield from gh_async.get_contributors(*full_name.split("/"))
json = yield from response.json()
response = await gh_async.get_contributors(*full_name.split("/"))
json = await response.json()
print("response for {}: {}".format(full_name, json))
return json

Expand All @@ -34,4 +33,4 @@ def get_contributors(full_name):
# Concurrently fetch the contributors for those repositories.
futures = [get_contributors(repo["full_name"]) for repo in repos]
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(futures))
loop.run_until_complete(asyncio.gather(*futures))
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def read(filename):
# Twisted 19.7.0 dropped py3.4 support
"twisted:python_version == '3.4'": "twisted<=19.2.1",
"typing": ["typing>=3.6.4"],
"tests": ["pytest==4.6.5", "pytest-mock", "pytest-cov", "pytest-twisted"],
"tests": ["pytest", "pytest-mock", "pytest-cov", "pytest-twisted"],
}

metadata = {
Expand All @@ -45,11 +45,12 @@ def read(filename):
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ def headers(self):
def data(self):
return self._extras.get("data", None)

@property
def files(self):
return self._extras.get("files", None)

@property
def json(self):
return self._extras.get("json", None)
Expand Down
23 changes: 23 additions & 0 deletions tests/integration/test_form_url_encoded.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Local imports
from uplink import Consumer, form_url_encoded, put, FieldMap

# Constants
BASE_URL = "https://example.com/"


def test_without_converter(mock_response, mock_client):
class Calendar(Consumer):
@form_url_encoded
@put("/user/repos", args={"event_data": FieldMap})
def add_event(self, **event_data):
pass

mock_client.with_response(mock_response)
calendar = Calendar(base_url=BASE_URL, client=mock_client)

# Run
calendar.add_event(name="Weekly Stand-up", public=True)

# Assertions: should not convert if converter is None
request = mock_client.history[0]
assert request.data == {"name": "Weekly Stand-up", "public": True}
24 changes: 24 additions & 0 deletions tests/integration/test_multipart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Local imports
from uplink import Consumer, PartMap, post, multipart

# Constants
BASE_URL = "https://example.com/"


def test_without_converter(mock_response, mock_client):
class Calendar(Consumer):
@multipart
@post("/attachments", args={"files": PartMap})
def upload_attachments(self, **files):
pass

mock_client.with_response(mock_response)
calendar = Calendar(base_url=BASE_URL, client=mock_client)
file = object()

# Run
calendar.upload_attachments(file=file)

# Assertion: should not convert if converter is None
request = mock_client.history[0]
assert request.files == {"file": file}
2 changes: 1 addition & 1 deletion tests/unit/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_tuple(self):

def test_callable(self):
def func():
None
pass

output = auth.get_auth(func)
assert output is func
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# Website (June 2016): http://tox.readthedocs.io/en/latest/

[testenv]
deps = pipenv
deps =
pipenv == 2018.11.26 ; python_version == '2.7'
pipenv ; python_version > '2.7'
commands = pipenv install --skip-lock
pipenv run py.test tests \
--cov-config .coveragerc \
Expand Down
2 changes: 1 addition & 1 deletion uplink/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
that is used both in distribution (i.e., setup.py) and within the
codebase.
"""
__version__ = "0.9.4"
__version__ = "0.9.5"
6 changes: 3 additions & 3 deletions uplink/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"""
# Standard library imports
import collections
from collections import abc
import functools
import inspect

# Local imports
from uplink import exceptions, hooks, interfaces, utils
from uplink.compat import abc
from uplink.converters import keys

__all__ = [
Expand Down Expand Up @@ -288,7 +288,7 @@ class Path(NamedArgument):
.. code-block:: python
class TodoService(object):
@get("/todos{/id}")
@get("/todos/{id}")
def get_todo(self, todo_id: Path("id")): pass
Then, invoking :code:`get_todo` with a consumer instance:
Expand All @@ -308,7 +308,7 @@ def get_todo(self, todo_id: Path("id")): pass
.. code-block:: python
@get("/todos{/id}")
@get("/todos/{id}")
def get_todo(self, id): pass
"""

Expand Down
4 changes: 1 addition & 3 deletions uplink/auth.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"""This module implements the auth layer."""

# Standard library imports
from collections import abc

# Third-party imports
from requests import auth

# Local imports
from uplink import utils
from uplink.compat import abc

__all__ = [
"ApiTokenParam",
Expand Down
5 changes: 1 addition & 4 deletions uplink/clients/io/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Standard library imports
from collections import abc

# Local imports
from uplink import compat

Expand Down Expand Up @@ -69,7 +66,7 @@ def on_failure(self, exc_type, exc_val, exc_tb):
raise NotImplementedError


class Executable(abc.Iterator):
class Executable(compat.abc.Iterator):
"""An abstraction for iterating over the execution of a request."""

def __next__(self):
Expand Down
Loading

0 comments on commit a013758

Please sign in to comment.