Skip to content

Commit

Permalink
Prep for the 3.3.0 release (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
brettcannon committed Jan 18, 2020
1 parent 92f3da8 commit 0cc6cc4
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
6 changes: 4 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Changelog
=========

vNext
3.3.0
'''''

- Adapt to the new ``httpx`` api to support versions >= 0.8.0 (thanks `Dave Hirschfeld <https://github.com/dhirschfeld>`_)
- Adapt to the new ``httpx`` API to support
`versions >= 0.11.0 <https://github.com/encode/httpx/blob/master/CHANGELOG.md>`_
(thanks `Dave Hirschfeld <https://github.com/dhirschfeld>`_)

3.2.0
'''''
Expand Down
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@
# The short X.Y version.
version = ''
# The full version, including alpha/beta/rc tags.
release = ''
sys.path.insert(0, os.path.abspath('..'))
import gidgethub
release = gidgethub.__version__
del sys.path[0]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/httpx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import gidgethub.httpx


async with httpx.Client() as client:
async with httpx.AsyncClient() as client:
gh = gidgethub.httpx.GitHubAPI(client, requester,
oauth_token=oauth_token)
# Make your requests, e.g. ...
Expand Down
2 changes: 1 addition & 1 deletion gidgethub/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""An async GitHub API library"""
__version__ = '3.2.0'
__version__ = '3.3.0'

import http
from typing import Any
Expand Down
7 changes: 2 additions & 5 deletions gidgethub/httpx.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import asyncio
from typing import Mapping, Tuple, Any

try:
from httpx import AsyncClient as Client
except ImportError:
from httpx import Client
import httpx

from . import abc as gh_abc


class GitHubAPI(gh_abc.GitHubAPI):
def __init__(self, client: Client, *args: Any,
def __init__(self, client: httpx.AsyncClient, *args: Any,
**kwargs: Any) -> None:
self._client = client
super().__init__(*args, **kwargs)
Expand Down
11 changes: 4 additions & 7 deletions gidgethub/test/test_httpx.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import datetime

try:
from httpx import AsyncClient as Client # type: ignore
except ImportError:
from httpx import Client
import httpx

import pytest

Expand All @@ -15,7 +12,7 @@
async def test_sleep():
delay = 1
start = datetime.datetime.now()
async with Client() as client:
async with httpx.AsyncClient() as client:
gh = gh_httpx.GitHubAPI(client, "gidgethub")
await gh.sleep(delay)
stop = datetime.datetime.now()
Expand All @@ -26,7 +23,7 @@ async def test_sleep():
async def test__request():
"""Make sure that that abstract method is implemented properly."""
request_headers = sansio.create_headers("gidgethub")
async with Client() as client:
async with httpx.AsyncClient() as client:
gh = gh_httpx.GitHubAPI(client, "gidgethub")
aio_call = await gh._request("GET", "https://api.github.com/rate_limit",
request_headers)
Expand All @@ -37,7 +34,7 @@ async def test__request():
@pytest.mark.asyncio
async def test_get():
"""Integration test."""
async with Client() as client:
async with httpx.AsyncClient() as client:
gh = gh_httpx.GitHubAPI(client, "gidgethub")
data = await gh.getitem("/rate_limit")
assert "rate" in data
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dev = ["aiohttp", "httpx", "mypy", "pytest-cov", "treq", "twisted[tls]", "tornad
aiohttp = ["aiohttp"]
treq = ["treq", "twisted[tls]"]
tornado = ["tornado"]
httpx = ["httpx"]
httpx = ["httpx>=0.11.0"]

[tool.flit.metadata.urls]
Documentation = "https://gidgethub.readthedocs.io"
Expand Down

0 comments on commit 0cc6cc4

Please sign in to comment.