Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Python publish for v3 (#2383)
Browse files Browse the repository at this point in the history
* Remove pre-release suffixes from version numbers

* For wrapper test, pull latest ganache image first

* For wrapper test, unpin ganache, use beta snapshot

* In docs, advise using beta ganache snapshot

Because we haven't yet published the non-beta snapshot

* Unpin package interdependencies

* unpin tests from beta 0xorg/ganache-cli version

* use beta ganache snapshot

* Set release date in CHANGELOGs

* In testing deployment, stop testing pre-releases

* Include rmtree("build") in all clean commands

* Fix clean not cleaning what it thought it was

* In monorepo script, install pkgs 1st then dev deps

* Stop pinning ganache snapshot version

* In test setup, wait longer for mesh to start up

* Fix broken hyperlinks in docs

* fix missing \n that was breaking doc rendering

* In monorepo script comment, fix typo, and clarify
  • Loading branch information
feuGeneA authored Dec 4, 2019
1 parent 8685cf9 commit 4f17a25
Show file tree
Hide file tree
Showing 28 changed files with 74 additions and 61 deletions.
7 changes: 2 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,7 @@ jobs:
working_directory: ~/repo
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: 0xorg/ganache-cli:4.4.0-beta.1
environment:
VERSION: latest
SNAPSHOT_NAME: 0x_ganache_snapshot-v3-beta
- image: 0xorg/ganache-cli
- image: 0xorg/mesh:0xV3
environment:
ETHEREUM_RPC_URL: 'http://localhost:8545'
Expand All @@ -219,7 +216,7 @@ jobs:
TAKER_FEE_UNIT_AMOUNT: 0
MESH_ENDPOINT: 'ws://localhost:60557'
command: |
sh -c "waitForMesh () { sleep 5; }; waitForMesh && node_modules/.bin/forever ts/lib/index.js"
sh -c "waitForMesh () { sleep 30; }; waitForMesh && node_modules/.bin/forever ts/lib/index.js"
steps:
- checkout
- restore_cache:
Expand Down
2 changes: 1 addition & 1 deletion python-packages/contract_addresses/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 3.0.0 - TBD
## 3.0.0 - 2019-12-03

- Addresses are now indexed by chain ID rather than by network ID.

Expand Down
3 changes: 2 additions & 1 deletion python-packages/contract_addresses/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class CleanCommandExtension(clean):
def run(self):
"""Run the regular clean, followed by our custom commands."""
super().run()
rmtree("build", ignore_errors=True)
rmtree("dist", ignore_errors=True)
rmtree(".mypy_cache", ignore_errors=True)
rmtree(".tox", ignore_errors=True)
Expand Down Expand Up @@ -151,7 +152,7 @@ def run_tests(self):

setup(
name="0x-contract-addresses",
version="3.0.0.dev3",
version="3.0.0",
description="Addresses at which the 0x smart contracts have been deployed",
long_description=README_MD,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion python-packages/contract_addresses/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ commands =
[testenv:run_tests_against_deployment]
setenv = PY_IGNORE_IMPORTMISMATCH = 1
commands=
pip install --pre 0x-contract-addresses[dev]
pip install 0x-contract-addresses[dev]
pytest --doctest-modules src
2 changes: 1 addition & 1 deletion python-packages/contract_artifacts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 3.0.0 - TBD
## 3.0.0 - 2019-12-03

- Updated with artifacts for version 3 of the protocol.

Expand Down
3 changes: 2 additions & 1 deletion python-packages/contract_artifacts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class CleanCommandExtension(clean):
def run(self):
"""Run the regular clean, followed by our custom commands."""
super().run()
rmtree("build", ignore_errors=True)
rmtree("dist", ignore_errors=True)
rmtree(".mypy_cache", ignore_errors=True)
rmtree(".tox", ignore_errors=True)
Expand Down Expand Up @@ -152,7 +153,7 @@ def run_tests(self):

setup(
name="0x-contract-artifacts",
version="3.0.0.dev2",
version="3.0.0",
description="0x smart contract compilation artifacts",
long_description=README_MD,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion python-packages/contract_artifacts/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ commands =
[testenv:run_tests_against_deployment]
setenv = PY_IGNORE_IMPORTMISMATCH = 1
commands=
pip install --pre 0x-contract-artifacts[dev]
pip install 0x-contract-artifacts[dev]
pytest --doctest-modules src
2 changes: 1 addition & 1 deletion python-packages/contract_wrappers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 2.0.0 - TBD
## 2.0.0 - 2019-12-03

- Updated for version 3 of the protocol.
- Allow wrappers to be instantiated with EITHER a Web3.py `BaseProvider` OR an already-instantiated `Web3` client object.
Expand Down
19 changes: 10 additions & 9 deletions python-packages/contract_wrappers/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class CleanCommandExtension(clean):
def run(self):
"""Run the regular clean, followed by our custom commands."""
super().run()
rmtree("build", ignore_errors=True)
rmtree("dist", ignore_errors=True)
rmtree(".mypy_cache", ignore_errors=True)
rmtree(".tox", ignore_errors=True)
Expand Down Expand Up @@ -183,10 +184,10 @@ class GanacheCommand(distutils.command.build_py.build_py):

def run(self):
"""Run ganache."""
cmd_line = (
"docker run -d -p 8545:8545 0xorg/ganache-cli:2.2.2"
).split()
subprocess.call(cmd_line) # nosec
subprocess.call(("docker pull 0xorg/ganache-cli").split()) # nosec
subprocess.call( # nosec
("docker run -d -p 8545:8545 0xorg/ganache-cli").split()
)


with open("README.md", "r") as file_handle:
Expand All @@ -195,7 +196,7 @@ def run(self):

setup(
name="0x-contract-wrappers",
version="2.0.0.dev10",
version="2.0.0",
description="Python wrappers for 0x smart contracts",
long_description=README_MD,
long_description_content_type="text/markdown",
Expand All @@ -216,10 +217,10 @@ def run(self):
"ganache": GanacheCommand,
},
install_requires=[
"0x-contract-addresses==3.0.0.dev3",
"0x-contract-artifacts==3.0.0.dev2",
"0x-json-schemas==2.1.0.dev2",
"0x-order-utils==4.0.0.dev8",
"0x-contract-addresses",
"0x-contract-artifacts",
"0x-json-schemas",
"0x-order-utils",
"web3",
"attrs",
"eth_utils",
Expand Down
10 changes: 5 additions & 5 deletions python-packages/contract_wrappers/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,23 @@ zero_ex.contract_wrappers.exchange: Generated Tuples

.. autoclass:: zero_ex.contract_wrappers.exchange.LibOrderOrder

This is the generated class representing `the Order struct <https://0x.org/docs/contracts#structs-Order>`_.
This is the generated class representing `the Order struct <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/v3-specification.md#order>`_.

.. autoclass:: zero_ex.contract_wrappers.exchange.LibFillResultsFillResults

This is the generated class representing `the FillResults struct <https://0x.org/docs/contracts#structs-FillResults>`_.
This is the generated class representing `the FillResults struct <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/v3-specification.md#fillresults>`_.

.. autoclass:: zero_ex.contract_wrappers.exchange.LibFillResultsMatchedFillResults

This is the generated class representing `the MatchedFillResults struct <https://0x.org/docs/contracts#structs-MatchedFillResults>`_.
This is the generated class representing `the MatchedFillResults struct <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/v3-specification.md#matchedfillresults>`_.

.. autoclass:: zero_ex.contract_wrappers.exchange.LibOrderOrderInfo

This is the generated class representing `the OrderInfo struct <https://0x.org/docs/contracts#structs-OrderInfo>`_.
This is the generated class representing `the OrderInfo struct <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/v3-specification.md#orderinfo>`_.

.. autoclass:: zero_ex.contract_wrappers.exchange.LibZeroExTransactionZeroExTransaction

This is the generated class representing `the ZeroExTransaction struct <https://0x.org/docs/contracts#structs-ZeroExTransaction>`_.
This is the generated class representing `the ZeroExTransaction struct <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/v3-specification.md#zeroextransaction>`_.

Indices and tables
==================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
We need a Web3 provider to allow us to talk to the blockchain. You can
read `more about providers in the Web3.py documentation
<https://web3py.readthedocs.io/en/stable/providers.htm>`_. The examples below
assume there's a local instance of Ganache listening on port 8545:
<https://web3py.readthedocs.io/en/stable/>`_. The examples below assume
there's a local instance of Ganache listening on port 8545:
>>> from web3 import HTTPProvider
>>> ganache = HTTPProvider("http://localhost:8545")
To replicate these examples, one can use the `0xorg/ganache-cli`:code: docker
image, which comes with the 0x contracts pre-deployed. To start it::
docker run docker run -d -p 8545:8545 0xorg/ganache-cli
docker run -d -p 8545:8545 0xorg/ganache-cli
Accounts
--------
Expand Down
2 changes: 1 addition & 1 deletion python-packages/contract_wrappers/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ commands =
[testenv:run_tests_against_deployment]
setenv = PY_IGNORE_IMPORTMISMATCH = 1
commands =
pip install --pre 0x-contract-wrappers[dev]
pip install 0x-contract-wrappers[dev]
pytest --doctest-modules src test
15 changes: 14 additions & 1 deletion python-packages/install_editable
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@
from os import path
import subprocess

# install all packages
# Install all packages, WITHOUT dev dependencies first, because some packages
# have dev-only dependencies on other local pacakges, to support tests and
# examples, and if we don't do this then those dev-only cross-dependencies will
# trigger premature dependency satisfaction, via PyPI rather than the local
# filesystem, completely messing up our "install."
subprocess.check_call(
(
path.join(".", "cmd_pkgs_in_dep_order.py") + " pip install -e ."
).split()
)

# Now that the dev-only cross-dependencies will be considered already
# satisfied, due to the previous installation of all the pacakges in the
# local filestystem, go ahead and install the (rest of the) dev dependencies.
subprocess.check_call(
(
path.join(".", "cmd_pkgs_in_dep_order.py") + " pip install -e .[dev]"
Expand Down
2 changes: 1 addition & 1 deletion python-packages/json_schemas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 1.2.0 - TBD
## 1.2.0 - 2019-12-03

- Removed dev dependency on package `0x-contract-wrappers`
- Migrated examples to using new version of `0x-contract-addresses`.
Expand Down
7 changes: 4 additions & 3 deletions python-packages/json_schemas/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ class CleanCommandExtension(clean):
def run(self):
"""Run the regular clean, followed by our custom commands."""
super().run()
rmtree("build", ignore_errors=True)
rmtree("dist", ignore_errors=True)
rmtree(".mypy_cache", ignore_errors=True)
rmtree(".tox", ignore_errors=True)
rmtree(".pytest_cache", ignore_errors=True)
rmtree("src/*.egg-info", ignore_errors=True)
rmtree("src/0x_json_schemas.egg-info", ignore_errors=True)


class TestPublishCommand(distutils.command.build_py.build_py):
Expand Down Expand Up @@ -143,7 +144,7 @@ def run(self):

setup(
name="0x-json-schemas",
version="2.1.0.dev2",
version="2.1.0",
description="JSON schemas for 0x applications",
long_description=README_MD,
long_description_content_type="text/markdown",
Expand All @@ -165,7 +166,7 @@ def run(self):
install_requires=["jsonschema", "mypy_extensions", "stringcase"],
extras_require={
"dev": [
"0x-contract-addresses==3.0.0.dev3",
"0x-contract-addresses",
"bandit",
"black",
"coverage",
Expand Down
2 changes: 1 addition & 1 deletion python-packages/json_schemas/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ commands =
[testenv:run_tests_against_deployment]
setenv = PY_IGNORE_IMPORTMISMATCH = 1
commands =
pip install --pre 0x-json-schemas[dev]
pip install 0x-json-schemas[dev]
pytest --doctest-modules src test
2 changes: 1 addition & 1 deletion python-packages/middlewares/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changelog

## 1.0.0 - TBD
## 1.0.0 - 2019-12-03

- Initial release.
3 changes: 2 additions & 1 deletion python-packages/middlewares/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class CleanCommandExtension(clean):
def run(self):
"""Run the regular clean, followed by our custom commands."""
super().run()
rmtree("build", ignore_errors=True)
rmtree("dist", ignore_errors=True)
rmtree(".mypy_cache", ignore_errors=True)
rmtree(".tox", ignore_errors=True)
Expand Down Expand Up @@ -136,7 +137,7 @@ def run(self):

setup(
name="0x-middlewares",
version="1.0.0.dev0",
version="1.0.0",
description="Web3 middlewares for 0x applications",
long_description=README_MD,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion python-packages/middlewares/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ commands =
[testenv:run_tests_against_deployment]
setenv = PY_IGNORE_IMPORTMISMATCH = 1
commands =
pip install --pre 0x-middlewares[dev]
pip install 0x-middlewares[dev]
pytest --doctest-modules test
2 changes: 1 addition & 1 deletion python-packages/order_utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 4.0.0 - TBD
## 4.0.0 - 2019-12-03

- Upgraded to protocol version 3.
- `is_valid_signature()` now returns just a boolean. (Formerly, it returned a tuple consisting of the boolean and a reason string.)
Expand Down
8 changes: 4 additions & 4 deletions python-packages/order_utils/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def run(self):

setup(
name="0x-order-utils",
version="4.0.0.dev8",
version="4.0.0",
description="Order utilities for 0x applications",
long_description=README_MD,
long_description_content_type="text/markdown",
Expand All @@ -176,9 +176,9 @@ def run(self):
"ganache": GanacheCommand,
},
install_requires=[
"0x-contract-addresses==3.0.0.dev3",
"0x-contract-artifacts==3.0.0.dev2",
"0x-json-schemas==2.1.0.dev2",
"0x-contract-addresses",
"0x-contract-artifacts",
"0x-json-schemas",
"deprecated",
"web3",
"eth-abi",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Order utilities for 0x applications.
r"""Order utilities for 0x applications.
Setup
-----
Expand All @@ -11,8 +11,9 @@
For local testing one may construct such a provider pointing at an instance of
`ganache-cli <https://www.npmjs.com/package/ganache-cli>`_ which has the 0x
contracts deployed on it. For convenience, a docker container is provided for
just this purpose. To start it:
`docker run -d -p 8545:8545 0xorg/ganache-cli:2.2.2`:code:.
just this purpose. To start it::
docker run -d -p 8545:8545 0xorg/ganache-cli
"""

Expand Down
2 changes: 1 addition & 1 deletion python-packages/order_utils/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ commands =
[testenv:run_tests_against_deployment]
setenv = PY_IGNORE_IMPORTMISMATCH = 1
commands =
pip install --pre 0x-order-utils[dev]
pip install 0x-order-utils[dev]
pytest --doctest-modules src test
2 changes: 1 addition & 1 deletion python-packages/sra_client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 4.0.0 - TBD
## 4.0.0 - 2019-12-03

- Migrated from v2 to v3 of the 0x protocol.

Expand Down
12 changes: 6 additions & 6 deletions python-packages/sra_client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from setuptools.command.test import test as TestCommand

NAME = "0x-sra-client"
VERSION = "4.0.0.dev0"
VERSION = "4.0.0"
# To install the library, run the following
#
# python setup.py install
Expand All @@ -43,7 +43,7 @@ def run(self):
rmtree(".mypy_cache", ignore_errors=True)
rmtree(".tox", ignore_errors=True)
rmtree(".pytest_cache", ignore_errors=True)
rmtree("0x_sra_client.egg-info", ignore_errors=True)
rmtree("src/0x_sra_client.egg-info", ignore_errors=True)
rmtree("build", ignore_errors=True)
rmtree("dist", ignore_errors=True)
subprocess.check_call( # nosec
Expand Down Expand Up @@ -213,10 +213,10 @@ def run(self):
},
extras_require={
"dev": [
"0x-contract-artifacts==3.0.0.dev2",
"0x-contract-addresses==3.0.0.dev3",
"0x-contract-wrappers==2.0.0.dev10",
"0x-order-utils==4.0.0.dev8",
"0x-contract-artifacts",
"0x-contract-addresses",
"0x-contract-wrappers",
"0x-order-utils",
"web3",
"bandit",
"black",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@
(Due to `an Issue with the Launch Kit Backend
<https://github.com/0xProject/0x-launch-kit-backend/issues/73>`_, we need to
checksum the address in the order before filling it.)
>>> order['makerAddress'] = Web3.toChecksumAddress(order['makerAddress'])
Finally, filling an order requires paying a protocol fee, which can be sent as
Expand Down
Loading

0 comments on commit 4f17a25

Please sign in to comment.