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

Commit cc22622

Browse files
authored
Merge pull request #231 from iotaledger/release/2.0.9
PyOTA v2.0.8
2 parents 97cdd1e + a0f901a commit cc22622

13 files changed

+103
-33
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
dist: trusty
21
language: python
32
python:
43
- '2.7'
54
- '3.5'
65
- '3.6'
6+
- '3.7'
77
install:
88
- pip install .
99
- pip install docutils pygments # Used to check package metadata.
@@ -12,7 +12,7 @@ script:
1212
- nosetests
1313
deploy:
1414
on:
15-
python: '3.6'
15+
python: '3.7'
1616
tags: true
1717
provider: pypi
1818
distributions: 'bdist_wheel sdist'

CONTRIBUTING.rst

+9-10
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ There are lots of ways to get involved with PyOTA. Many of them don't require w
1818
- Improving Documentation
1919
- Writing Tutorials
2020
- Reporting Bugs
21-
- Helping Users on the ``#iota-libs-pyota`` Channel on `Slack`_
21+
- Helping Users on the ``#python`` Channel on `Discord`_
2222
- Fixing Bugs and Implementing New Features
2323
- Writing Unit and Functional Tests
2424

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

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

32-
- 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!
32+
- 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!
3333

3434

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

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

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

5959
- Check the traceback, and see if you can narrow down the cause of the bug.
60-
- 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.
60+
- 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.
6161

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

6464
- 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!
65-
- To report security-related bugs, please contact ``@phx`` directly in `Slack`_.
65+
- To report security-related bugs, please contact ``@phx`` directly in `Discord`_.
6666

6767
3. Is this a known issue?
6868

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

125125
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.
126126

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

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

159159
.. _come on over and help us out!: https://github.com/iotaledger/iota.lib.py/issues/145
160160
.. _email you: https://help.github.com/articles/managing-notification-delivery-methods/
161-
.. _forum: https://forum.iota.org
162161
.. _help wanted: https://github.com/iotaledger/iota.lib.py/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22
163162
.. _how to contribute to open source: https://opensource.guide/how-to-contribute/
164163
.. _notifications: https://github.com/notifications
165164
.. _pep-8: https://www.python.org/dev/peps/pep-0008/
166165
.. _pyota bug tracker: https://github.com/iotaledger/iota.lib.py/issues
167-
.. _slack: https://slack.iota.org
168-
.. _tutorials: https://learn.iota.org/tutorials
166+
.. _discord: https://discord.iota.org
167+
.. _tutorials: https://docs.iota.org

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ If you encounter any issues while using PyOTA, please report them using the
2626
============
2727
Dependencies
2828
============
29-
PyOTA is compatible with Python 3.6, 3.5 and 2.7.
29+
PyOTA is compatible with Python 3.7, 3.6, 3.5 and 2.7
3030

3131
============
3232
Installation

docs/api.rst

+46
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,34 @@ This method returns a ``dict`` with the following items:
204204
- ``bundles: List[Bundle]``: Matching bundles, sorted by tail
205205
transaction timestamp.
206206

207+
``is_reattachable``
208+
-------------------
209+
210+
This API function helps you to determine whether you should replay a
211+
transaction or make a new one (either with the same input, or a
212+
different one).
213+
214+
This method takes one or more input addresses (i.e. from spent
215+
transactions) as input and then checks whether any transactions with a
216+
value transferred are confirmed.
217+
218+
If yes, it means that this input address has already been successfully
219+
used in a different transaction, and as such you should no longer replay
220+
the transaction.
221+
222+
Parameters
223+
~~~~~~~~~~
224+
225+
- ``address: Iterable[Address]``: List of addresses.
226+
227+
Return
228+
~~~~~~
229+
230+
This method returns a ``dict`` with the following items:
231+
232+
- ``reattachable: List[Bool]``: Always a list, even if only one address
233+
was queried.
234+
207235
``prepare_transfer``
208236
--------------------
209237

@@ -232,6 +260,24 @@ This method returns a ``dict`` with the following items:
232260
- ``trytes: List[TransactionTrytes]``: Raw trytes for the transactions
233261
in the bundle, ready to be provided to ``send_trytes``.
234262

263+
``promote_transaction``
264+
-----------------------
265+
266+
Promotes a transaction by adding spam on top of it.
267+
268+
- ``transaction: TransactionHash``: Transaction hash. Must be a tail.
269+
- ``depth: int``: Depth at which to attach the bundle.
270+
- ``min_weight_magnitude: Optional[int]``: Min weight magnitude, used
271+
by the node to calibrate Proof of Work.
272+
- If not provided, a default value will be used.
273+
274+
Return
275+
~~~~~~
276+
277+
This method returns a ``dict`` with the following items:
278+
279+
- ``bundle: Bundle``: The newly-published bundle.
280+
235281
``replay_bundle``
236282
-----------------
237283

iota/adapter/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from requests import Response, auth, codes, request
1414
from six import PY2, binary_type, iteritems, moves as compat, text_type, \
15-
with_metaclass
15+
add_metaclass
1616

1717
from iota.exceptions import with_context
1818
from iota.json import JsonEncoder
@@ -139,7 +139,8 @@ def configure(cls, parsed):
139139
return cls(parsed)
140140

141141

142-
class BaseAdapter(with_metaclass(AdapterMeta)):
142+
@add_metaclass(AdapterMeta)
143+
class BaseAdapter(object):
143144
"""
144145
Interface for IOTA API adapters.
145146

iota/adapter/wrappers.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from abc import ABCMeta, abstractmethod as abstract_method
66
from typing import Dict, Text
77

8-
from six import with_metaclass
8+
from six import add_metaclass
99

1010
from iota.adapter import AdapterSpec, BaseAdapter, resolve_adapter
1111

@@ -14,7 +14,8 @@
1414
]
1515

1616

17-
class BaseWrapper(with_metaclass(ABCMeta, BaseAdapter)):
17+
@add_metaclass(ABCMeta)
18+
class BaseWrapper(BaseAdapter):
1819
"""
1920
Base functionality for "adapter wrappers", used to extend the
2021
functionality of IOTA adapters.

iota/api.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from typing import Dict, Iterable, Optional, Text
66

7-
from six import with_metaclass
7+
from six import add_metaclass
88

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

5555

56-
class StrictIota(with_metaclass(ApiMeta)):
56+
@add_metaclass(ApiMeta)
57+
class StrictIota(object):
5758
"""
5859
API to send HTTP requests for communicating with an IOTA node.
5960
@@ -907,6 +908,19 @@ def promote_transaction(
907908
"""
908909
Promotes a transaction by adding spam on top of it.
909910
911+
:param transaction:
912+
Transaction hash. Must be a tail transaction.
913+
914+
:param depth:
915+
Depth at which to attach the bundle.
916+
Defaults to 3.
917+
918+
:param min_weight_magnitude:
919+
Min weight magnitude, used by the node to calibrate Proof of
920+
Work.
921+
922+
If not provided, a default value will be used.
923+
910924
:return:
911925
Dict with the following structure::
912926

iota/bin/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from sys import exit
1111
from typing import Any, Optional, Text
1212

13-
from six import text_type, with_metaclass
13+
from six import text_type, add_metaclass
1414

1515
from iota import Iota, __version__
1616
from iota.crypto.types import Seed
@@ -20,7 +20,8 @@
2020
]
2121

2222

23-
class IotaCommandLineApp(with_metaclass(ABCMeta)):
23+
@add_metaclass(ABCMeta)
24+
class IotaCommandLineApp(object):
2425
"""
2526
Base functionality for a PyOTA-powered command-line application.
2627
"""

iota/commands/__init__.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from typing import Any, Dict, Mapping, Optional, Text, Union
1212

1313
import filters as f
14-
from six import string_types, with_metaclass
14+
import six
1515

1616
from iota.adapter import BaseAdapter
1717
from iota.exceptions import with_context
@@ -48,7 +48,7 @@ def discover_commands(package, recursively=True):
4848
command name (note: not class name).
4949
"""
5050
# http://stackoverflow.com/a/25562415/
51-
if isinstance(package, string_types):
51+
if isinstance(package, six.string_types):
5252
package = import_module(package) # type: ModuleType
5353

5454
commands = {}
@@ -87,8 +87,8 @@ def __init__(cls, what, bases=None, dict=None):
8787
if command:
8888
command_registry[command] = cls
8989

90-
91-
class BaseCommand(with_metaclass(CommandMeta)):
90+
@six.add_metaclass(CommandMeta)
91+
class BaseCommand(object):
9292
"""
9393
An API command ready to send to the node.
9494
"""
@@ -260,7 +260,8 @@ def _apply_none(self):
260260
return self._apply({})
261261

262262

263-
class FilterCommand(with_metaclass(ABCMeta, BaseCommand)):
263+
@six.add_metaclass(ABCMeta)
264+
class FilterCommand(BaseCommand):
264265
"""
265266
Uses filters to manipulate request/response values.
266267
"""

iota/json.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
from json.encoder import JSONEncoder as BaseJsonEncoder
77
from typing import Iterable, Mapping
88

9-
from six import with_metaclass
9+
from six import add_metaclass
1010

1111

12-
class JsonSerializable(with_metaclass(ABCMeta)):
12+
@add_metaclass(ABCMeta)
13+
class JsonSerializable(object):
1314
"""
1415
Interface for classes that can be safely converted to JSON.
1516
"""

setup.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
name='PyOTA',
4040
description='IOTA API library for Python',
4141
url='https://github.com/iotaledger/iota.lib.py',
42-
version='2.0.7',
42+
version='2.0.8',
4343

4444
long_description=long_description,
4545

@@ -57,8 +57,12 @@
5757
],
5858
},
5959

60+
# filters is no longer maintained and does not support Python 3.7
61+
# phx-filters is a fork that supports 3.7 and 3.8 but not 2.7
62+
6063
install_requires=[
61-
'filters',
64+
'filters; python_version < "3.5"',
65+
'phx-filters; python_version >= "3.5"',
6266
'pysha3',
6367

6468
# ``security`` extra wasn't introduced until 2.4.1
@@ -90,6 +94,7 @@
9094
'Programming Language :: Python :: 3',
9195
'Programming Language :: Python :: 3.5',
9296
'Programming Language :: Python :: 3.6',
97+
'Programming Language :: Python :: 3.7',
9398
'Topic :: Software Development :: Libraries :: Python Modules',
9499
],
95100

test/api_test.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from abc import ABCMeta
66
from unittest import TestCase
77

8-
from six import with_metaclass
8+
from six import add_metaclass
99

1010
from iota import InvalidCommand, StrictIota
1111
from iota.adapter import MockAdapter
@@ -150,5 +150,6 @@ class definition raises an exception.
150150
# This statement will raise an exception if the regression is
151151
# present; no assertions necessary.
152152
# noinspection PyUnusedLocal
153-
class CustomClient(with_metaclass(ABCMeta)):
153+
@add_metaclass(ABCMeta)
154+
class CustomClient(object):
154155
client = StrictIota(MockAdapter())

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py27, py35, py36
7+
envlist = py27, py35, py36, py37
88

99
[testenv]
1010
commands = nosetests

0 commit comments

Comments
 (0)