Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #229 from pdecol/python_37
Browse files Browse the repository at this point in the history
Add support for Python 3.7
  • Loading branch information
todofixthis committed Sep 8, 2019
2 parents 7c8bc80 + cbb5180 commit 7182496
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dist: trusty
language: python
python:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
install:
- pip install .
- pip install docutils pygments # Used to check package metadata.
Expand All @@ -12,7 +12,7 @@ script:
- nosetests
deploy:
on:
python: '3.6'
python: '3.7'
tags: true
provider: pypi
distributions: 'bdist_wheel sdist'
Expand Down
19 changes: 9 additions & 10 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ There are lots of ways to get involved with PyOTA. Many of them don't require w
- Improving Documentation
- Writing Tutorials
- Reporting Bugs
- Helping Users on the ``#iota-libs-pyota`` Channel on `Slack`_
- Helping Users on the ``#python`` Channel on `Discord`_
- Fixing Bugs and Implementing New Features
- Writing Unit and Functional Tests

A Few Things that We Can't Accept
---------------------------------
We're pretty open about how people contribute to PyOTA, but there are a few things that we can't accept:

- Please do not post support requests here. Use the ``#iota-libs-pyota`` channel on `Slack`_ or post in the `forum`_ to ask for help.
- Please do not post support requests here. Use the ``#python`` channel on `Discord`_
- Please do not propose new API methods here. There are multiple IOTA API libraries out there, and they must all have the same functionality.

- That said, if you have an idea for a new API method, please share it on the ``#developers`` channel in `Slack`_ so that IOTA Foundation members can evaluate it!
- That said, if you have an idea for a new API method, please share it on the ``#developers`` channel in `Discord`_ so that IOTA Foundation members can evaluate it!


Need Some Inspiration?
Expand All @@ -38,7 +38,7 @@ If you would like to help out but don't know how to get started, here are some
places you can look for inspiration:

- Look for issues marked `help wanted`_ in the `PyOTA Bug Tracker`_
- Introduce yourself in the `#iota-libs-pyota` channel in `Slack`_ and watch for questions or issues that you can help with.
- Introduce yourself in the `#python` channel in `Discord`_ and watch for questions or issues that you can help with.
- Browse existing `tutorials`_ for other programming languages and create Python versions.

Is This Your First Contribution?
Expand All @@ -57,12 +57,12 @@ Instructions
1. Make sure it really is a PyOTA bug.

- Check the traceback, and see if you can narrow down the cause of the bug.
- If the error is not directly caused by PyOTA, or if you are unable to figure out what is causing the problem, we're still here for for you! Post in the ``#iota-libs-pyota`` channel in `Slack`_ for assistance.
- If the error is not directly caused by PyOTA, or if you are unable to figure out what is causing the problem, we're still here for for you! Post in the ``#python`` channel in `Discord`_ for assistance.

2. Is it safe to publish details about this bug publicly?

- If the bug is security-related (e.g., could compromise a user's seed if exploited), or if it requires sensitive information in order to reproduce (e.g., the private key for an address), please do not post in in the PyOTA Bug Tracker!
- To report security-related bugs, please contact ``@phx`` directly in `Slack`_.
- To report security-related bugs, please contact ``@phx`` directly in `Discord`_.

3. Is this a known issue?

Expand Down Expand Up @@ -124,7 +124,7 @@ PyOTA is a critical component for many applications, and as such its code must b

This is a big list, but don't let it intimidate you! Many of these are "common sense" things that you probably do already, but we have to list them here anyway, just so that there's no confusion.

If you have any questions, please feel free to post in the ``#iota-libs-pyota`` channel in `Slack`_!
If you have any questions, please feel free to post in the ``#python`` channel in `Discord`_!

- Please create Pull Requests against the ``develop`` branch.
- Please limit each Pull Request to a single bugfix/enhancement.
Expand Down Expand Up @@ -158,11 +158,10 @@ When you submit a Pull Request, here is what you can expect from the individual

.. _come on over and help us out!: https://github.com/iotaledger/iota.lib.py/issues/145
.. _email you: https://help.github.com/articles/managing-notification-delivery-methods/
.. _forum: https://forum.iota.org
.. _help wanted: https://github.com/iotaledger/iota.lib.py/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22
.. _how to contribute to open source: https://opensource.guide/how-to-contribute/
.. _notifications: https://github.com/notifications
.. _pep-8: https://www.python.org/dev/peps/pep-0008/
.. _pyota bug tracker: https://github.com/iotaledger/iota.lib.py/issues
.. _slack: https://slack.iota.org
.. _tutorials: https://learn.iota.org/tutorials
.. _discord: https://discord.iota.org
.. _tutorials: https://docs.iota.org
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If you encounter any issues while using PyOTA, please report them using the
============
Dependencies
============
PyOTA is compatible with Python 3.6, 3.5 and 2.7.
PyOTA is compatible with Python 3.7, 3.6, 3.5 and 2.7

============
Installation
Expand Down
5 changes: 3 additions & 2 deletions iota/adapter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from requests import Response, auth, codes, request
from six import PY2, binary_type, iteritems, moves as compat, text_type, \
with_metaclass
add_metaclass

from iota.exceptions import with_context
from iota.json import JsonEncoder
Expand Down Expand Up @@ -139,7 +139,8 @@ def configure(cls, parsed):
return cls(parsed)


class BaseAdapter(with_metaclass(AdapterMeta)):
@add_metaclass(AdapterMeta)
class BaseAdapter(object):
"""
Interface for IOTA API adapters.
Expand Down
5 changes: 3 additions & 2 deletions iota/adapter/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from abc import ABCMeta, abstractmethod as abstract_method
from typing import Dict, Text

from six import with_metaclass
from six import add_metaclass

from iota.adapter import AdapterSpec, BaseAdapter, resolve_adapter

Expand All @@ -14,7 +14,8 @@
]


class BaseWrapper(with_metaclass(ABCMeta, BaseAdapter)):
@add_metaclass(ABCMeta)
class BaseWrapper(BaseAdapter):
"""
Base functionality for "adapter wrappers", used to extend the
functionality of IOTA adapters.
Expand Down
5 changes: 3 additions & 2 deletions iota/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Dict, Iterable, Optional, Text

from six import with_metaclass
from six import add_metaclass

from iota import AdapterSpec, Address, BundleHash, ProposedTransaction, Tag, \
TransactionHash, TransactionTrytes, TryteString, TrytesCompatible
Expand Down Expand Up @@ -53,7 +53,8 @@ def __init__(cls, name, bases=None, attrs=None):
cls.commands = commands


class StrictIota(with_metaclass(ApiMeta)):
@add_metaclass(ApiMeta)
class StrictIota(object):
"""
API to send HTTP requests for communicating with an IOTA node.
Expand Down
5 changes: 3 additions & 2 deletions iota/bin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sys import exit
from typing import Any, Optional, Text

from six import text_type, with_metaclass
from six import text_type, add_metaclass

from iota import Iota, __version__
from iota.crypto.types import Seed
Expand All @@ -20,7 +20,8 @@
]


class IotaCommandLineApp(with_metaclass(ABCMeta)):
@add_metaclass(ABCMeta)
class IotaCommandLineApp(object):
"""
Base functionality for a PyOTA-powered command-line application.
"""
Expand Down
11 changes: 6 additions & 5 deletions iota/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from typing import Any, Dict, Mapping, Optional, Text, Union

import filters as f
from six import string_types, with_metaclass
import six

from iota.adapter import BaseAdapter
from iota.exceptions import with_context
Expand Down Expand Up @@ -48,7 +48,7 @@ def discover_commands(package, recursively=True):
command name (note: not class name).
"""
# http://stackoverflow.com/a/25562415/
if isinstance(package, string_types):
if isinstance(package, six.string_types):
package = import_module(package) # type: ModuleType

commands = {}
Expand Down Expand Up @@ -87,8 +87,8 @@ def __init__(cls, what, bases=None, dict=None):
if command:
command_registry[command] = cls


class BaseCommand(with_metaclass(CommandMeta)):
@six.add_metaclass(CommandMeta)
class BaseCommand(object):
"""
An API command ready to send to the node.
"""
Expand Down Expand Up @@ -260,7 +260,8 @@ def _apply_none(self):
return self._apply({})


class FilterCommand(with_metaclass(ABCMeta, BaseCommand)):
@six.add_metaclass(ABCMeta)
class FilterCommand(BaseCommand):
"""
Uses filters to manipulate request/response values.
"""
Expand Down
5 changes: 3 additions & 2 deletions iota/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from json.encoder import JSONEncoder as BaseJsonEncoder
from typing import Iterable, Mapping

from six import with_metaclass
from six import add_metaclass


class JsonSerializable(with_metaclass(ABCMeta)):
@add_metaclass(ABCMeta)
class JsonSerializable(object):
"""
Interface for classes that can be safely converted to JSON.
"""
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
name='PyOTA',
description='IOTA API library for Python',
url='https://github.com/iotaledger/iota.lib.py',
version='2.0.7',
version='2.0.8',

long_description=long_description,

Expand All @@ -56,9 +56,13 @@
'pyota-cli=iota.bin.repl:main',
],
},

# filters is no longer maintained and does not support Python 3.7
# phx-filters is a fork that supports 3.7 and 3.8 but not 2.7

install_requires=[
'filters',
'filters; python_version < "3.5"',
'phx-filters; python_version >= "3.5"',
'pysha3',

# ``security`` extra wasn't introduced until 2.4.1
Expand Down Expand Up @@ -90,6 +94,7 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules',
],

Expand Down
5 changes: 3 additions & 2 deletions test/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from abc import ABCMeta
from unittest import TestCase

from six import with_metaclass
from six import add_metaclass

from iota import InvalidCommand, StrictIota
from iota.adapter import MockAdapter
Expand Down Expand Up @@ -150,5 +150,6 @@ class definition raises an exception.
# This statement will raise an exception if the regression is
# present; no assertions necessary.
# noinspection PyUnusedLocal
class CustomClient(with_metaclass(ABCMeta)):
@add_metaclass(ABCMeta)
class CustomClient(object):
client = StrictIota(MockAdapter())
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py27, py35, py36
envlist = py27, py35, py36, py37

[testenv]
commands = nosetests
Expand Down

0 comments on commit 7182496

Please sign in to comment.