Skip to content

Commit

Permalink
Merge pull request #1 from viseshrp/develop
Browse files Browse the repository at this point in the history
adding back py2 support for now
  • Loading branch information
viseshrp committed Jan 7, 2019
2 parents b2f462a + 13d4cc6 commit 9cbdb88
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
language: python
python:
- 3.6
- 3.5
- 3.4
- 2.7
- 3.7

# Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Before you submit a pull request, check that it meets these guidelines:
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 3.6+, and for PyPy. Check
3. The pull request should work for Python 2.7+, and for PyPy. Check
https://travis-ci.org/viseshrp/whatsonpypi/pull_requests
and make sure that the tests pass for all supported Python versions.

Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ Installation
Requirements
------------

#. Python 3.6+
#. Python 2.7+


Features
--------

* Find the latest version of a package on PyPI

Examples:
Examples:

.. code-block:: bash
.. code-block:: bash
$ whatsonpypi django
2.1.4
$ whatsonpypi django
2.1.4
* More to come ..

Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ test = pytest
[tool:pytest]
collect_ignore = ['setup.py']

[metadata]
license_file = LICENSE
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@

"""The setup script."""
import io
import sys

from setuptools import setup, find_packages

assert sys.version_info >= (3, 6, 0), "whatsonpypi requires Python 3.6+"

# Package meta-data.
NAME = 'whatsonpypi'
VERSION = '0.1.1'
DESCRIPTION = "CLI tool to find package info on PyPI"
AUTHOR = "Visesh Prasad"
EMAIL = 'viseshrprasad@gmail.com'
URL = 'https://github.com/viseshrp/whatsonpypi'
REQUIRES_PYTHON = ">=3.6"
REQUIREMENTS = ['Click>=6.0', 'requests>=2.18.0', ]
REQUIRES_PYTHON = ">=2.7"
REQUIREMENTS = ['future>=0.15.2', 'Click>=6.0', 'requests>=2.18.0', ]
SETUP_REQUIREMENTS = ['pytest-runner', ]
TEST_REQUIREMENTS = ['pytest', ]

Expand Down Expand Up @@ -46,10 +43,13 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Natural Language :: English',
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules',
],
entry_points={
Expand Down
7 changes: 5 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[tox]
envlist = py36, py37, flake8
envlist = py27, py34, py35, py36, flake8

[travis]
python =
3.6: py36
3.7: py37
3.6: py36
3.5: py35
3.4: py34
2.7: py27

[testenv:flake8]
basepython = python
Expand Down
4 changes: 4 additions & 0 deletions whatsonpypi/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# -*- coding: utf-8 -*-

"""
CLI entry point
"""
# enable absolute imports of this module for Python2.x
from __future__ import absolute_import

from .cli import main

if __name__ == '__main__':
Expand Down
3 changes: 2 additions & 1 deletion whatsonpypi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"""
Console script
"""
from __future__ import unicode_literals # unicode support for py2

import click

from whatsonpypi import __version__

from .whatsonpypi import get_query_response


Expand Down
8 changes: 6 additions & 2 deletions whatsonpypi/client.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# -*- coding: utf-8 -*-

"""
API client
"""
from __future__ import unicode_literals # unicode support for py2

from requests import Request, Session, hooks

from .constants import PYPI_BASE_URL
from .exceptions import PackageNotProvidedError, PackageNotFoundError


class WoppResponse:
class WoppResponse(object):
"""
Serializer for the response from PyPI
"""
Expand All @@ -26,7 +30,7 @@ def latest_version(self):
return self.info.get('version')


class WoppClient:
class WoppClient(object):
"""
Client for accessing the PyPI API
"""
Expand Down
2 changes: 2 additions & 0 deletions whatsonpypi/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
"""
Package level constants
"""
from __future__ import unicode_literals # unicode support for py2

PYPI_BASE_URL = 'https://pypi.org/pypi'
3 changes: 3 additions & 0 deletions whatsonpypi/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-

"""Utility methods"""
from __future__ import unicode_literals # unicode support for py2


def clean_response(r, *args, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions whatsonpypi/whatsonpypi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

"""Module containing the core functionality."""
from __future__ import unicode_literals # unicode support for py2

from .client import WoppClient
from .utils import clean_response
Expand Down

0 comments on commit 9cbdb88

Please sign in to comment.