From 49404cebc501b92ae3387376fa20a590a74d605a Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Thu, 17 Mar 2022 12:44:28 -0300 Subject: [PATCH] Reorganize the python-examples module - Use requirements.txt to install dependencies to local venv. - Use setup.py to build/install example packages to local venv. - Adjust reference-doc-builder to new Python pkg imports. --- .gitignore | 10 +++++---- python-examples/README.md | 4 ++++ python-examples/generate-python-protos.sh | 6 +++--- .../{bots => python_examples}/__init__.py | 0 .../api => python_examples/bisqapi}/README.md | 1 + .../bots}/__init__.py | 0 .../bots/assets/bisq_logo.png | Bin .../bots/assets/btc_amount_entry.png | Bin .../bots/assets/payment_received_button.png | Bin .../bots/assets/payment_sent_button.png | Bin .../assets/reference_price_margin_entry.png | Bin .../bots/assets/spread_entry.png | Bin .../bots/assets/start_button.png | Bin .../bots/assets/stop_button.png | Bin .../bots/assets/window_icon.png | Bin .../bots/best_priced_offer_bot.ini | 2 +- .../bots/best_priced_offer_bot.py | 0 .../{ => python_examples}/bots/bisq_client.py | 4 ++-- .../bots/bisq_events}/__init__.py | 0 .../bots/bisq_events}/event.py | 0 .../bots/bisq_events}/event_dispatcher.py | 0 .../bots/bisq_events}/test_trade_event.py | 0 .../bots/bisq_events}/trade_event.py | 2 +- .../bots/bisq_events}/trade_event_data.py | 0 .../bots/bisq_events}/trade_event_listener.py | 3 ++- .../bots/bisq_events}/trade_event_sender.py | 0 .../bots/bisqswap_mm_bot.ini | 0 .../bots/bisqswap_mm_bot.py | 0 .../{ => python_examples}/bots/logger.py | 0 .../{ => python_examples}/bots/path_config.py | 2 +- .../bots/protocol_step.py | 2 +- .../{ => python_examples}/bots/run-main.py | 2 -- .../bots/sepa_mm_bot.ini | 0 .../{ => python_examples}/bots/sepa_mm_bot.py | 4 ++-- .../bots/sepa_mm_bot_ui.py | 7 +++--- .../{ => python_examples}/rpccalls/README.md | 0 .../python_examples/rpccalls/__init__.py | 0 .../rpccalls/cancel_offer.py | 4 ++-- .../rpccalls/close_trade.py | 4 ++-- .../rpccalls/confirm_payment_received.py | 4 ++-- .../rpccalls/confirm_payment_started.py | 4 ++-- .../rpccalls/create_bsq_swap_offer.py | 4 ++-- .../create_crypto_currency_payment_account.py | 4 ++-- .../rpccalls/create_offer.py | 4 ++-- .../rpccalls/create_payment_account.py | 4 ++-- .../rpccalls/edit_offer.py | 4 ++-- .../rpccalls/fail_trade.py | 4 ++-- .../rpccalls/get_address_balance.py | 4 ++-- .../rpccalls/get_balances.py | 4 ++-- .../rpccalls/get_bsq_swap_offer.py | 4 ++-- .../rpccalls/get_bsq_swap_offers.py | 4 ++-- .../get_crypto_currency_payment_methods.py | 4 ++-- .../rpccalls/get_funding_addresses.py | 4 ++-- .../rpccalls/get_market_price.py | 4 ++-- .../rpccalls/get_method_help.py | 0 .../rpccalls/get_my_bsq_swap_offer.py | 4 ++-- .../rpccalls/get_my_bsq_swap_offers.py | 4 ++-- .../rpccalls/get_my_offer.py | 4 ++-- .../rpccalls/get_my_offers.py | 4 ++-- .../rpccalls/get_offer.py | 4 ++-- .../rpccalls/get_offer_category.py | 4 ++-- .../rpccalls/get_offers.py | 4 ++-- .../rpccalls/get_payment_account_form.py | 4 ++-- .../rpccalls/get_payment_accounts.py | 4 ++-- .../rpccalls/get_payment_methods.py | 4 ++-- .../rpccalls/get_trade.py | 4 ++-- .../rpccalls/get_trades.py | 4 ++-- .../rpccalls/get_transaction.py | 4 ++-- .../rpccalls/get_tx_fee_rate.py | 4 ++-- .../rpccalls/get_unused_bsq_address.py | 4 ++-- .../rpccalls/get_version.py | 4 ++-- .../rpccalls/lock_wallet.py | 4 ++-- .../rpccalls/remove_wallet_password.py | 4 ++-- .../rpccalls/send_bsq.py | 4 ++-- .../rpccalls/send_btc.py | 4 ++-- .../rpccalls/set_tx_fee_rate_preference.py | 4 ++-- .../rpccalls/set_wallet_password.py | 4 ++-- .../{ => python_examples}/rpccalls/stop.py | 4 ++-- .../rpccalls/take_offer.py | 4 ++-- .../rpccalls/unfail_trade.py | 4 ++-- .../rpccalls/unlock_wallet.py | 4 ++-- .../rpccalls/unset_tx_fee_rate_preference.py | 4 ++-- .../rpccalls/verify_bsq_sent_to_address.py | 4 ++-- .../rpccalls/withdraw_funds.py | 4 ++-- python-examples/requirements.txt | 3 +++ python-examples/run-setup.sh | 20 ++++++++++++++++++ python-examples/setup.py | 18 ++++++++++++++++ .../bisq/apidoc/markdown/CodeExamples.java | 2 +- 88 files changed, 161 insertions(+), 115 deletions(-) create mode 100644 python-examples/README.md rename python-examples/{bots => python_examples}/__init__.py (100%) rename python-examples/{bisq/api => python_examples/bisqapi}/README.md (53%) rename python-examples/{bots/events => python_examples/bots}/__init__.py (100%) rename python-examples/{ => python_examples}/bots/assets/bisq_logo.png (100%) rename python-examples/{ => python_examples}/bots/assets/btc_amount_entry.png (100%) rename python-examples/{ => python_examples}/bots/assets/payment_received_button.png (100%) rename python-examples/{ => python_examples}/bots/assets/payment_sent_button.png (100%) rename python-examples/{ => python_examples}/bots/assets/reference_price_margin_entry.png (100%) rename python-examples/{ => python_examples}/bots/assets/spread_entry.png (100%) rename python-examples/{ => python_examples}/bots/assets/start_button.png (100%) rename python-examples/{ => python_examples}/bots/assets/stop_button.png (100%) rename python-examples/{ => python_examples}/bots/assets/window_icon.png (100%) rename python-examples/{ => python_examples}/bots/best_priced_offer_bot.ini (89%) rename python-examples/{ => python_examples}/bots/best_priced_offer_bot.py (100%) rename python-examples/{ => python_examples}/bots/bisq_client.py (99%) rename python-examples/{rpccalls => python_examples/bots/bisq_events}/__init__.py (100%) rename python-examples/{bots/events => python_examples/bots/bisq_events}/event.py (100%) rename python-examples/{bots/events => python_examples/bots/bisq_events}/event_dispatcher.py (100%) rename python-examples/{bots/events => python_examples/bots/bisq_events}/test_trade_event.py (100%) rename python-examples/{bots/events => python_examples/bots/bisq_events}/trade_event.py (88%) rename python-examples/{bots/events => python_examples/bots/bisq_events}/trade_event_data.py (100%) rename python-examples/{bots/events => python_examples/bots/bisq_events}/trade_event_listener.py (95%) rename python-examples/{bots/events => python_examples/bots/bisq_events}/trade_event_sender.py (100%) rename python-examples/{ => python_examples}/bots/bisqswap_mm_bot.ini (100%) rename python-examples/{ => python_examples}/bots/bisqswap_mm_bot.py (100%) rename python-examples/{ => python_examples}/bots/logger.py (100%) rename python-examples/{ => python_examples}/bots/path_config.py (58%) rename python-examples/{ => python_examples}/bots/protocol_step.py (99%) rename python-examples/{ => python_examples}/bots/run-main.py (80%) rename python-examples/{ => python_examples}/bots/sepa_mm_bot.ini (100%) rename python-examples/{ => python_examples}/bots/sepa_mm_bot.py (98%) rename python-examples/{ => python_examples}/bots/sepa_mm_bot_ui.py (98%) rename python-examples/{ => python_examples}/rpccalls/README.md (100%) create mode 100644 python-examples/python_examples/rpccalls/__init__.py rename python-examples/{ => python_examples}/rpccalls/cancel_offer.py (84%) rename python-examples/{ => python_examples}/rpccalls/close_trade.py (84%) rename python-examples/{ => python_examples}/rpccalls/confirm_payment_received.py (85%) rename python-examples/{ => python_examples}/rpccalls/confirm_payment_started.py (85%) rename python-examples/{ => python_examples}/rpccalls/create_bsq_swap_offer.py (88%) rename python-examples/{ => python_examples}/rpccalls/create_crypto_currency_payment_account.py (88%) rename python-examples/{ => python_examples}/rpccalls/create_offer.py (96%) rename python-examples/{ => python_examples}/rpccalls/create_payment_account.py (87%) rename python-examples/{ => python_examples}/rpccalls/edit_offer.py (97%) rename python-examples/{ => python_examples}/rpccalls/fail_trade.py (84%) rename python-examples/{ => python_examples}/rpccalls/get_address_balance.py (89%) rename python-examples/{ => python_examples}/rpccalls/get_balances.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_bsq_swap_offer.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_bsq_swap_offers.py (84%) rename python-examples/{ => python_examples}/rpccalls/get_crypto_currency_payment_methods.py (87%) rename python-examples/{ => python_examples}/rpccalls/get_funding_addresses.py (90%) rename python-examples/{ => python_examples}/rpccalls/get_market_price.py (84%) rename python-examples/{ => python_examples}/rpccalls/get_method_help.py (100%) rename python-examples/{ => python_examples}/rpccalls/get_my_bsq_swap_offer.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_my_bsq_swap_offers.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_my_offer.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_my_offers.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_offer.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_offer_category.py (86%) rename python-examples/{ => python_examples}/rpccalls/get_offers.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_payment_account_form.py (88%) rename python-examples/{ => python_examples}/rpccalls/get_payment_accounts.py (90%) rename python-examples/{ => python_examples}/rpccalls/get_payment_methods.py (87%) rename python-examples/{ => python_examples}/rpccalls/get_trade.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_trades.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_transaction.py (85%) rename python-examples/{ => python_examples}/rpccalls/get_tx_fee_rate.py (84%) rename python-examples/{ => python_examples}/rpccalls/get_unused_bsq_address.py (84%) rename python-examples/{ => python_examples}/rpccalls/get_version.py (84%) rename python-examples/{ => python_examples}/rpccalls/lock_wallet.py (83%) rename python-examples/{ => python_examples}/rpccalls/remove_wallet_password.py (84%) rename python-examples/{ => python_examples}/rpccalls/send_bsq.py (86%) rename python-examples/{ => python_examples}/rpccalls/send_btc.py (87%) rename python-examples/{ => python_examples}/rpccalls/set_tx_fee_rate_preference.py (85%) rename python-examples/{ => python_examples}/rpccalls/set_wallet_password.py (84%) rename python-examples/{ => python_examples}/rpccalls/stop.py (84%) rename python-examples/{ => python_examples}/rpccalls/take_offer.py (93%) rename python-examples/{ => python_examples}/rpccalls/unfail_trade.py (85%) rename python-examples/{ => python_examples}/rpccalls/unlock_wallet.py (85%) rename python-examples/{ => python_examples}/rpccalls/unset_tx_fee_rate_preference.py (84%) rename python-examples/{ => python_examples}/rpccalls/verify_bsq_sent_to_address.py (86%) rename python-examples/{ => python_examples}/rpccalls/withdraw_funds.py (84%) create mode 100644 python-examples/requirements.txt create mode 100755 python-examples/run-setup.sh create mode 100644 python-examples/setup.py diff --git a/.gitignore b/.gitignore index 9a48b96..9f8a057 100644 --- a/.gitignore +++ b/.gitignore @@ -33,10 +33,12 @@ java-examples/src/main/proto/* proto-downloader/*.iml proto-downloader/*.proto python-examples/*.iml -python-examples/bisq/api/__pycache__/ -python-examples/bisq/api/*.py -python-examples/bots/__pycache__ -python-examples/bots/events/__pycache__ +python-examples/myvenv +python-examples/python_examples/__pycache__ +python-examples/python_examples/bisqapi/__pycache__ +python-examples/python_examples/bisqapi/*.py +python-examples/python_examples/bots/__pycache__ +python-examples/python_examples/bots/bisq_events/__pycache__ python-examples/proto/* reference-doc-builder/*.iml reference-doc-builder/build diff --git a/python-examples/README.md b/python-examples/README.md new file mode 100644 index 0000000..0c9be79 --- /dev/null +++ b/python-examples/README.md @@ -0,0 +1,4 @@ +# Bisq API Python Examples + +The `run-setup.sh` script in this directory can be used to install Python dependencies and build the examples packages. + diff --git a/python-examples/generate-python-protos.sh b/python-examples/generate-python-protos.sh index c069f2f..b0c1705 100755 --- a/python-examples/generate-python-protos.sh +++ b/python-examples/generate-python-protos.sh @@ -14,7 +14,7 @@ export PROTO_PATH="proto" # The destination directory for the generated Python code (he protoc compiler output). -export PYTHON_PROTO_OUT_PATH="bisq/api" +export PYTHON_PROTO_OUT_PATH="python_examples/bisqapi" python3 -m grpc_tools.protoc \ --proto_path=$PROTO_PATH \ @@ -24,5 +24,5 @@ protoc --proto_path=$PROTO_PATH --python_out=$PYTHON_PROTO_OUT_PATH $PROTO_PATH/ # Hack the internal import statements in the generated python to prepend the `bisq.api` package name. # See why Google will not fix this: https://github.com/protocolbuffers/protobuf/issues/1491 -sed -i 's/import pb_pb2 as pb__pb2/import bisq.api.pb_pb2 as pb__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2.py -sed -i 's/import grpc_pb2 as grpc__pb2/import bisq.api.grpc_pb2 as grpc__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2_grpc.py +sed -i 's/import pb_pb2 as pb__pb2/import python_examples.bisqapi.pb_pb2 as pb__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2.py +sed -i 's/import grpc_pb2 as grpc__pb2/import python_examples.bisqapi.grpc_pb2 as grpc__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2_grpc.py diff --git a/python-examples/bots/__init__.py b/python-examples/python_examples/__init__.py similarity index 100% rename from python-examples/bots/__init__.py rename to python-examples/python_examples/__init__.py diff --git a/python-examples/bisq/api/README.md b/python-examples/python_examples/bisqapi/README.md similarity index 53% rename from python-examples/bisq/api/README.md rename to python-examples/python_examples/bisqapi/README.md index f253576..591ef92 100644 --- a/python-examples/bisq/api/README.md +++ b/python-examples/python_examples/bisqapi/README.md @@ -1,2 +1,3 @@ The api directory contains the Bisq gRPC API's generated Python files used by the examples. +The protoc generated files in this directory are not versioned in this project. diff --git a/python-examples/bots/events/__init__.py b/python-examples/python_examples/bots/__init__.py similarity index 100% rename from python-examples/bots/events/__init__.py rename to python-examples/python_examples/bots/__init__.py diff --git a/python-examples/bots/assets/bisq_logo.png b/python-examples/python_examples/bots/assets/bisq_logo.png similarity index 100% rename from python-examples/bots/assets/bisq_logo.png rename to python-examples/python_examples/bots/assets/bisq_logo.png diff --git a/python-examples/bots/assets/btc_amount_entry.png b/python-examples/python_examples/bots/assets/btc_amount_entry.png similarity index 100% rename from python-examples/bots/assets/btc_amount_entry.png rename to python-examples/python_examples/bots/assets/btc_amount_entry.png diff --git a/python-examples/bots/assets/payment_received_button.png b/python-examples/python_examples/bots/assets/payment_received_button.png similarity index 100% rename from python-examples/bots/assets/payment_received_button.png rename to python-examples/python_examples/bots/assets/payment_received_button.png diff --git a/python-examples/bots/assets/payment_sent_button.png b/python-examples/python_examples/bots/assets/payment_sent_button.png similarity index 100% rename from python-examples/bots/assets/payment_sent_button.png rename to python-examples/python_examples/bots/assets/payment_sent_button.png diff --git a/python-examples/bots/assets/reference_price_margin_entry.png b/python-examples/python_examples/bots/assets/reference_price_margin_entry.png similarity index 100% rename from python-examples/bots/assets/reference_price_margin_entry.png rename to python-examples/python_examples/bots/assets/reference_price_margin_entry.png diff --git a/python-examples/bots/assets/spread_entry.png b/python-examples/python_examples/bots/assets/spread_entry.png similarity index 100% rename from python-examples/bots/assets/spread_entry.png rename to python-examples/python_examples/bots/assets/spread_entry.png diff --git a/python-examples/bots/assets/start_button.png b/python-examples/python_examples/bots/assets/start_button.png similarity index 100% rename from python-examples/bots/assets/start_button.png rename to python-examples/python_examples/bots/assets/start_button.png diff --git a/python-examples/bots/assets/stop_button.png b/python-examples/python_examples/bots/assets/stop_button.png similarity index 100% rename from python-examples/bots/assets/stop_button.png rename to python-examples/python_examples/bots/assets/stop_button.png diff --git a/python-examples/bots/assets/window_icon.png b/python-examples/python_examples/bots/assets/window_icon.png similarity index 100% rename from python-examples/bots/assets/window_icon.png rename to python-examples/python_examples/bots/assets/window_icon.png diff --git a/python-examples/bots/best_priced_offer_bot.ini b/python-examples/python_examples/bots/best_priced_offer_bot.ini similarity index 89% rename from python-examples/bots/best_priced_offer_bot.ini rename to python-examples/python_examples/bots/best_priced_offer_bot.ini index 8ff242f..d0faa8d 100644 --- a/python-examples/bots/best_priced_offer_bot.ini +++ b/python-examples/python_examples/bots/best_priced_offer_bot.ini @@ -7,7 +7,7 @@ direction = SELL [offers] # List of comma separated offer ids to be synced. -offer_ids = piape-ef84138d-8204-4b6e-995c-49d3dd1ef37a-184 +offer_ids = dlyunuk-d5e15df0-9a35-4409-bdce-c760b42162ae-184 [safeguards] # This should prevent the synchronization with offers that are out of bounds. diff --git a/python-examples/bots/best_priced_offer_bot.py b/python-examples/python_examples/bots/best_priced_offer_bot.py similarity index 100% rename from python-examples/bots/best_priced_offer_bot.py rename to python-examples/python_examples/bots/best_priced_offer_bot.py diff --git a/python-examples/bots/bisq_client.py b/python-examples/python_examples/bots/bisq_client.py similarity index 99% rename from python-examples/bots/bisq_client.py rename to python-examples/python_examples/bots/bisq_client.py index 91c1c64..efb8145 100644 --- a/python-examples/bots/bisq_client.py +++ b/python-examples/python_examples/bots/bisq_client.py @@ -5,8 +5,8 @@ from decimal import * import grpc -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service from logger import log # For more channel options, please see https://grpc.io/grpc/core/group__grpc__arg__keys.html diff --git a/python-examples/rpccalls/__init__.py b/python-examples/python_examples/bots/bisq_events/__init__.py similarity index 100% rename from python-examples/rpccalls/__init__.py rename to python-examples/python_examples/bots/bisq_events/__init__.py diff --git a/python-examples/bots/events/event.py b/python-examples/python_examples/bots/bisq_events/event.py similarity index 100% rename from python-examples/bots/events/event.py rename to python-examples/python_examples/bots/bisq_events/event.py diff --git a/python-examples/bots/events/event_dispatcher.py b/python-examples/python_examples/bots/bisq_events/event_dispatcher.py similarity index 100% rename from python-examples/bots/events/event_dispatcher.py rename to python-examples/python_examples/bots/bisq_events/event_dispatcher.py diff --git a/python-examples/bots/events/test_trade_event.py b/python-examples/python_examples/bots/bisq_events/test_trade_event.py similarity index 100% rename from python-examples/bots/events/test_trade_event.py rename to python-examples/python_examples/bots/bisq_events/test_trade_event.py diff --git a/python-examples/bots/events/trade_event.py b/python-examples/python_examples/bots/bisq_events/trade_event.py similarity index 88% rename from python-examples/bots/events/trade_event.py rename to python-examples/python_examples/bots/bisq_events/trade_event.py index 9d06f3e..31d2834 100644 --- a/python-examples/bots/events/trade_event.py +++ b/python-examples/python_examples/bots/bisq_events/trade_event.py @@ -1,5 +1,5 @@ # From https://expobrain.net/2010/07/31/simple-event-dispatcher-in-python -from event import Event +from python_examples.bots.bisq_events.event import Event class TradeEvent(Event): diff --git a/python-examples/bots/events/trade_event_data.py b/python-examples/python_examples/bots/bisq_events/trade_event_data.py similarity index 100% rename from python-examples/bots/events/trade_event_data.py rename to python-examples/python_examples/bots/bisq_events/trade_event_data.py diff --git a/python-examples/bots/events/trade_event_listener.py b/python-examples/python_examples/bots/bisq_events/trade_event_listener.py similarity index 95% rename from python-examples/bots/events/trade_event_listener.py rename to python-examples/python_examples/bots/bisq_events/trade_event_listener.py index bca569e..6f8422c 100644 --- a/python-examples/bots/events/trade_event_listener.py +++ b/python-examples/python_examples/bots/bisq_events/trade_event_listener.py @@ -1,5 +1,6 @@ # From https://expobrain.net/2010/07/31/simple-event-dispatcher-in-python -from bots.logger import log +from python_examples.bots.logger import log + from trade_event import TradeEvent diff --git a/python-examples/bots/events/trade_event_sender.py b/python-examples/python_examples/bots/bisq_events/trade_event_sender.py similarity index 100% rename from python-examples/bots/events/trade_event_sender.py rename to python-examples/python_examples/bots/bisq_events/trade_event_sender.py diff --git a/python-examples/bots/bisqswap_mm_bot.ini b/python-examples/python_examples/bots/bisqswap_mm_bot.ini similarity index 100% rename from python-examples/bots/bisqswap_mm_bot.ini rename to python-examples/python_examples/bots/bisqswap_mm_bot.ini diff --git a/python-examples/bots/bisqswap_mm_bot.py b/python-examples/python_examples/bots/bisqswap_mm_bot.py similarity index 100% rename from python-examples/bots/bisqswap_mm_bot.py rename to python-examples/python_examples/bots/bisqswap_mm_bot.py diff --git a/python-examples/bots/logger.py b/python-examples/python_examples/bots/logger.py similarity index 100% rename from python-examples/bots/logger.py rename to python-examples/python_examples/bots/logger.py diff --git a/python-examples/bots/path_config.py b/python-examples/python_examples/bots/path_config.py similarity index 58% rename from python-examples/bots/path_config.py rename to python-examples/python_examples/bots/path_config.py index a50fb4d..7869aef 100644 --- a/python-examples/bots/path_config.py +++ b/python-examples/python_examples/bots/path_config.py @@ -2,4 +2,4 @@ import os import sys DIR_PATH = os.path.dirname(os.path.abspath(__file__)) -sys.path.append(os.path.join(DIR_PATH, 'events')) +sys.path.append(os.path.join(DIR_PATH, 'bisq_events')) diff --git a/python-examples/bots/protocol_step.py b/python-examples/python_examples/bots/protocol_step.py similarity index 99% rename from python-examples/bots/protocol_step.py rename to python-examples/python_examples/bots/protocol_step.py index 1233079..b453075 100644 --- a/python-examples/bots/protocol_step.py +++ b/python-examples/python_examples/bots/protocol_step.py @@ -1,6 +1,6 @@ import grpc -import bisq.api.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2 as bisq_messages from logger import log WAIT_FOR_TRADE_DEPOSIT_CONFIRMATION = 'WAIT_FOR_TRADE_DEPOSIT_CONFIRMATION' diff --git a/python-examples/bots/run-main.py b/python-examples/python_examples/bots/run-main.py similarity index 80% rename from python-examples/bots/run-main.py rename to python-examples/python_examples/bots/run-main.py index fb38ac0..efa6be0 100644 --- a/python-examples/bots/run-main.py +++ b/python-examples/python_examples/bots/run-main.py @@ -1,6 +1,4 @@ -import best_priced_offer_bot import bisqswap_mm_bot # best_priced_offer_bot.main('localhost', 9998, 'xyz') - bisqswap_mm_bot.main('localhost', 9998, 'xyz') diff --git a/python-examples/bots/sepa_mm_bot.ini b/python-examples/python_examples/bots/sepa_mm_bot.ini similarity index 100% rename from python-examples/bots/sepa_mm_bot.ini rename to python-examples/python_examples/bots/sepa_mm_bot.ini diff --git a/python-examples/bots/sepa_mm_bot.py b/python-examples/python_examples/bots/sepa_mm_bot.py similarity index 98% rename from python-examples/bots/sepa_mm_bot.py rename to python-examples/python_examples/bots/sepa_mm_bot.py index 56ba53c..4b34f56 100644 --- a/python-examples/bots/sepa_mm_bot.py +++ b/python-examples/python_examples/bots/sepa_mm_bot.py @@ -3,9 +3,9 @@ import threading import time from bisq_client import BisqClient -from events.trade_event import TradeEvent -from events.trade_event_data import TradeEventData from protocol_step import * +from python_examples.bots.bisq_events.trade_event import TradeEvent +from python_examples.bots.bisq_events.trade_event_data import TradeEventData # noinspection PyInitNewSignature diff --git a/python-examples/bots/sepa_mm_bot_ui.py b/python-examples/python_examples/bots/sepa_mm_bot_ui.py similarity index 98% rename from python-examples/bots/sepa_mm_bot_ui.py rename to python-examples/python_examples/bots/sepa_mm_bot_ui.py index c2a3d89..aa84554 100644 --- a/python-examples/bots/sepa_mm_bot_ui.py +++ b/python-examples/python_examples/bots/sepa_mm_bot_ui.py @@ -4,17 +4,16 @@ from decimal import * from pathlib import Path from tkinter import * -import path_config import sepa_mm_bot -from events.event_dispatcher import EventDispatcher -from events.trade_event import TradeEvent from logger import log +from python_examples.bots.bisq_events.event_dispatcher import EventDispatcher +from python_examples.bots.bisq_events.trade_event import TradeEvent config = configparser.ConfigParser() config.read('sepa_mm_bot.ini') OUTPUT_PATH = Path(__file__).parent -ASSETS_PATH = OUTPUT_PATH / Path('./assets') +ASSETS_PATH = OUTPUT_PATH / Path('assets') WINDOW_WIDTH = 970 WINDOW_HEIGHT = 575 diff --git a/python-examples/rpccalls/README.md b/python-examples/python_examples/rpccalls/README.md similarity index 100% rename from python-examples/rpccalls/README.md rename to python-examples/python_examples/rpccalls/README.md diff --git a/python-examples/python_examples/rpccalls/__init__.py b/python-examples/python_examples/rpccalls/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python-examples/rpccalls/cancel_offer.py b/python-examples/python_examples/rpccalls/cancel_offer.py similarity index 84% rename from python-examples/rpccalls/cancel_offer.py rename to python-examples/python_examples/rpccalls/cancel_offer.py index 437d2ea..cab000b 100644 --- a/python-examples/rpccalls/cancel_offer.py +++ b/python-examples/python_examples/rpccalls/cancel_offer.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/close_trade.py b/python-examples/python_examples/rpccalls/close_trade.py similarity index 84% rename from python-examples/rpccalls/close_trade.py rename to python-examples/python_examples/rpccalls/close_trade.py index c8c4d24..f794061 100644 --- a/python-examples/rpccalls/close_trade.py +++ b/python-examples/python_examples/rpccalls/close_trade.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/confirm_payment_received.py b/python-examples/python_examples/rpccalls/confirm_payment_received.py similarity index 85% rename from python-examples/rpccalls/confirm_payment_received.py rename to python-examples/python_examples/rpccalls/confirm_payment_received.py index c6d1d59..e47229e 100644 --- a/python-examples/rpccalls/confirm_payment_received.py +++ b/python-examples/python_examples/rpccalls/confirm_payment_received.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/confirm_payment_started.py b/python-examples/python_examples/rpccalls/confirm_payment_started.py similarity index 85% rename from python-examples/rpccalls/confirm_payment_started.py rename to python-examples/python_examples/rpccalls/confirm_payment_started.py index ea92dee..650eb08 100644 --- a/python-examples/rpccalls/confirm_payment_started.py +++ b/python-examples/python_examples/rpccalls/confirm_payment_started.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/create_bsq_swap_offer.py b/python-examples/python_examples/rpccalls/create_bsq_swap_offer.py similarity index 88% rename from python-examples/rpccalls/create_bsq_swap_offer.py rename to python-examples/python_examples/rpccalls/create_bsq_swap_offer.py index d67057a..87c8f90 100644 --- a/python-examples/rpccalls/create_bsq_swap_offer.py +++ b/python-examples/python_examples/rpccalls/create_bsq_swap_offer.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/create_crypto_currency_payment_account.py b/python-examples/python_examples/rpccalls/create_crypto_currency_payment_account.py similarity index 88% rename from python-examples/rpccalls/create_crypto_currency_payment_account.py rename to python-examples/python_examples/rpccalls/create_crypto_currency_payment_account.py index 848ebff..c6366e1 100644 --- a/python-examples/rpccalls/create_crypto_currency_payment_account.py +++ b/python-examples/python_examples/rpccalls/create_crypto_currency_payment_account.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/create_offer.py b/python-examples/python_examples/rpccalls/create_offer.py similarity index 96% rename from python-examples/rpccalls/create_offer.py rename to python-examples/python_examples/rpccalls/create_offer.py index 35061a1..b8b2e71 100644 --- a/python-examples/rpccalls/create_offer.py +++ b/python-examples/python_examples/rpccalls/create_offer.py @@ -4,8 +4,8 @@ from builtins import print import grpc -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/create_payment_account.py b/python-examples/python_examples/rpccalls/create_payment_account.py similarity index 87% rename from python-examples/rpccalls/create_payment_account.py rename to python-examples/python_examples/rpccalls/create_payment_account.py index ca630b0..b50f688 100644 --- a/python-examples/rpccalls/create_payment_account.py +++ b/python-examples/python_examples/rpccalls/create_payment_account.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/edit_offer.py b/python-examples/python_examples/rpccalls/edit_offer.py similarity index 97% rename from python-examples/rpccalls/edit_offer.py rename to python-examples/python_examples/rpccalls/edit_offer.py index 8957d29..ff2a3c3 100644 --- a/python-examples/rpccalls/edit_offer.py +++ b/python-examples/python_examples/rpccalls/edit_offer.py @@ -4,8 +4,8 @@ from builtins import print import grpc -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service EDITED_USD_OFFER_ID = '44736-16df6819-d98b-4f13-87dd-50087c464fac-184' diff --git a/python-examples/rpccalls/fail_trade.py b/python-examples/python_examples/rpccalls/fail_trade.py similarity index 84% rename from python-examples/rpccalls/fail_trade.py rename to python-examples/python_examples/rpccalls/fail_trade.py index f7bea43..204c41e 100644 --- a/python-examples/rpccalls/fail_trade.py +++ b/python-examples/python_examples/rpccalls/fail_trade.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_address_balance.py b/python-examples/python_examples/rpccalls/get_address_balance.py similarity index 89% rename from python-examples/rpccalls/get_address_balance.py rename to python-examples/python_examples/rpccalls/get_address_balance.py index a4e5673..c89d24a 100644 --- a/python-examples/rpccalls/get_address_balance.py +++ b/python-examples/python_examples/rpccalls/get_address_balance.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_balances.py b/python-examples/python_examples/rpccalls/get_balances.py similarity index 85% rename from python-examples/rpccalls/get_balances.py rename to python-examples/python_examples/rpccalls/get_balances.py index fce181d..f228876 100644 --- a/python-examples/rpccalls/get_balances.py +++ b/python-examples/python_examples/rpccalls/get_balances.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_bsq_swap_offer.py b/python-examples/python_examples/rpccalls/get_bsq_swap_offer.py similarity index 85% rename from python-examples/rpccalls/get_bsq_swap_offer.py rename to python-examples/python_examples/rpccalls/get_bsq_swap_offer.py index 131ca5f..f395be2 100644 --- a/python-examples/rpccalls/get_bsq_swap_offer.py +++ b/python-examples/python_examples/rpccalls/get_bsq_swap_offer.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_bsq_swap_offers.py b/python-examples/python_examples/rpccalls/get_bsq_swap_offers.py similarity index 84% rename from python-examples/rpccalls/get_bsq_swap_offers.py rename to python-examples/python_examples/rpccalls/get_bsq_swap_offers.py index f3067ca..0e959fd 100644 --- a/python-examples/rpccalls/get_bsq_swap_offers.py +++ b/python-examples/python_examples/rpccalls/get_bsq_swap_offers.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_crypto_currency_payment_methods.py b/python-examples/python_examples/rpccalls/get_crypto_currency_payment_methods.py similarity index 87% rename from python-examples/rpccalls/get_crypto_currency_payment_methods.py rename to python-examples/python_examples/rpccalls/get_crypto_currency_payment_methods.py index dcc7b95..19f714a 100644 --- a/python-examples/rpccalls/get_crypto_currency_payment_methods.py +++ b/python-examples/python_examples/rpccalls/get_crypto_currency_payment_methods.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_funding_addresses.py b/python-examples/python_examples/rpccalls/get_funding_addresses.py similarity index 90% rename from python-examples/rpccalls/get_funding_addresses.py rename to python-examples/python_examples/rpccalls/get_funding_addresses.py index ebdc8e1..350ecc5 100644 --- a/python-examples/rpccalls/get_funding_addresses.py +++ b/python-examples/python_examples/rpccalls/get_funding_addresses.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_market_price.py b/python-examples/python_examples/rpccalls/get_market_price.py similarity index 84% rename from python-examples/rpccalls/get_market_price.py rename to python-examples/python_examples/rpccalls/get_market_price.py index 6cd87ba..00165be 100644 --- a/python-examples/rpccalls/get_market_price.py +++ b/python-examples/python_examples/rpccalls/get_market_price.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_method_help.py b/python-examples/python_examples/rpccalls/get_method_help.py similarity index 100% rename from python-examples/rpccalls/get_method_help.py rename to python-examples/python_examples/rpccalls/get_method_help.py diff --git a/python-examples/rpccalls/get_my_bsq_swap_offer.py b/python-examples/python_examples/rpccalls/get_my_bsq_swap_offer.py similarity index 85% rename from python-examples/rpccalls/get_my_bsq_swap_offer.py rename to python-examples/python_examples/rpccalls/get_my_bsq_swap_offer.py index 10a6160..a46952a 100644 --- a/python-examples/rpccalls/get_my_bsq_swap_offer.py +++ b/python-examples/python_examples/rpccalls/get_my_bsq_swap_offer.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_my_bsq_swap_offers.py b/python-examples/python_examples/rpccalls/get_my_bsq_swap_offers.py similarity index 85% rename from python-examples/rpccalls/get_my_bsq_swap_offers.py rename to python-examples/python_examples/rpccalls/get_my_bsq_swap_offers.py index 876f3a2..858c056 100644 --- a/python-examples/rpccalls/get_my_bsq_swap_offers.py +++ b/python-examples/python_examples/rpccalls/get_my_bsq_swap_offers.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_my_offer.py b/python-examples/python_examples/rpccalls/get_my_offer.py similarity index 85% rename from python-examples/rpccalls/get_my_offer.py rename to python-examples/python_examples/rpccalls/get_my_offer.py index 884bc2c..64ceb52 100644 --- a/python-examples/rpccalls/get_my_offer.py +++ b/python-examples/python_examples/rpccalls/get_my_offer.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_my_offers.py b/python-examples/python_examples/rpccalls/get_my_offers.py similarity index 85% rename from python-examples/rpccalls/get_my_offers.py rename to python-examples/python_examples/rpccalls/get_my_offers.py index f5f00f2..6f76096 100644 --- a/python-examples/rpccalls/get_my_offers.py +++ b/python-examples/python_examples/rpccalls/get_my_offers.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_offer.py b/python-examples/python_examples/rpccalls/get_offer.py similarity index 85% rename from python-examples/rpccalls/get_offer.py rename to python-examples/python_examples/rpccalls/get_offer.py index df0a243..65b7de5 100644 --- a/python-examples/rpccalls/get_offer.py +++ b/python-examples/python_examples/rpccalls/get_offer.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_offer_category.py b/python-examples/python_examples/rpccalls/get_offer_category.py similarity index 86% rename from python-examples/rpccalls/get_offer_category.py rename to python-examples/python_examples/rpccalls/get_offer_category.py index cf4fd5e..5044e22 100644 --- a/python-examples/rpccalls/get_offer_category.py +++ b/python-examples/python_examples/rpccalls/get_offer_category.py @@ -3,8 +3,8 @@ from builtins import print import grpc -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_offers.py b/python-examples/python_examples/rpccalls/get_offers.py similarity index 85% rename from python-examples/rpccalls/get_offers.py rename to python-examples/python_examples/rpccalls/get_offers.py index 5853f35..40bc3bd 100644 --- a/python-examples/rpccalls/get_offers.py +++ b/python-examples/python_examples/rpccalls/get_offers.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_payment_account_form.py b/python-examples/python_examples/rpccalls/get_payment_account_form.py similarity index 88% rename from python-examples/rpccalls/get_payment_account_form.py rename to python-examples/python_examples/rpccalls/get_payment_account_form.py index 23d848c..791a126 100644 --- a/python-examples/rpccalls/get_payment_account_form.py +++ b/python-examples/python_examples/rpccalls/get_payment_account_form.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_payment_accounts.py b/python-examples/python_examples/rpccalls/get_payment_accounts.py similarity index 90% rename from python-examples/rpccalls/get_payment_accounts.py rename to python-examples/python_examples/rpccalls/get_payment_accounts.py index 21fd75b..881f4be 100644 --- a/python-examples/rpccalls/get_payment_accounts.py +++ b/python-examples/python_examples/rpccalls/get_payment_accounts.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_payment_methods.py b/python-examples/python_examples/rpccalls/get_payment_methods.py similarity index 87% rename from python-examples/rpccalls/get_payment_methods.py rename to python-examples/python_examples/rpccalls/get_payment_methods.py index 8a6dc36..90b92de 100644 --- a/python-examples/rpccalls/get_payment_methods.py +++ b/python-examples/python_examples/rpccalls/get_payment_methods.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_trade.py b/python-examples/python_examples/rpccalls/get_trade.py similarity index 85% rename from python-examples/rpccalls/get_trade.py rename to python-examples/python_examples/rpccalls/get_trade.py index e594013..af70ddf 100644 --- a/python-examples/rpccalls/get_trade.py +++ b/python-examples/python_examples/rpccalls/get_trade.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_trades.py b/python-examples/python_examples/rpccalls/get_trades.py similarity index 85% rename from python-examples/rpccalls/get_trades.py rename to python-examples/python_examples/rpccalls/get_trades.py index b63ca87..07d9965 100644 --- a/python-examples/rpccalls/get_trades.py +++ b/python-examples/python_examples/rpccalls/get_trades.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_transaction.py b/python-examples/python_examples/rpccalls/get_transaction.py similarity index 85% rename from python-examples/rpccalls/get_transaction.py rename to python-examples/python_examples/rpccalls/get_transaction.py index 2f790ce..8e57ee0 100644 --- a/python-examples/rpccalls/get_transaction.py +++ b/python-examples/python_examples/rpccalls/get_transaction.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_tx_fee_rate.py b/python-examples/python_examples/rpccalls/get_tx_fee_rate.py similarity index 84% rename from python-examples/rpccalls/get_tx_fee_rate.py rename to python-examples/python_examples/rpccalls/get_tx_fee_rate.py index 101e5b3..c1c8ec9 100644 --- a/python-examples/rpccalls/get_tx_fee_rate.py +++ b/python-examples/python_examples/rpccalls/get_tx_fee_rate.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_unused_bsq_address.py b/python-examples/python_examples/rpccalls/get_unused_bsq_address.py similarity index 84% rename from python-examples/rpccalls/get_unused_bsq_address.py rename to python-examples/python_examples/rpccalls/get_unused_bsq_address.py index c36a49e..ffa41f8 100644 --- a/python-examples/rpccalls/get_unused_bsq_address.py +++ b/python-examples/python_examples/rpccalls/get_unused_bsq_address.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/get_version.py b/python-examples/python_examples/rpccalls/get_version.py similarity index 84% rename from python-examples/rpccalls/get_version.py rename to python-examples/python_examples/rpccalls/get_version.py index 314d985..5e11df5 100644 --- a/python-examples/rpccalls/get_version.py +++ b/python-examples/python_examples/rpccalls/get_version.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/lock_wallet.py b/python-examples/python_examples/rpccalls/lock_wallet.py similarity index 83% rename from python-examples/rpccalls/lock_wallet.py rename to python-examples/python_examples/rpccalls/lock_wallet.py index 8580b7c..1bcfa35 100644 --- a/python-examples/rpccalls/lock_wallet.py +++ b/python-examples/python_examples/rpccalls/lock_wallet.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/remove_wallet_password.py b/python-examples/python_examples/rpccalls/remove_wallet_password.py similarity index 84% rename from python-examples/rpccalls/remove_wallet_password.py rename to python-examples/python_examples/rpccalls/remove_wallet_password.py index db7428e..914e7d7 100644 --- a/python-examples/rpccalls/remove_wallet_password.py +++ b/python-examples/python_examples/rpccalls/remove_wallet_password.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/send_bsq.py b/python-examples/python_examples/rpccalls/send_bsq.py similarity index 86% rename from python-examples/rpccalls/send_bsq.py rename to python-examples/python_examples/rpccalls/send_bsq.py index cd07cd3..aa474f2 100644 --- a/python-examples/rpccalls/send_bsq.py +++ b/python-examples/python_examples/rpccalls/send_bsq.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/send_btc.py b/python-examples/python_examples/rpccalls/send_btc.py similarity index 87% rename from python-examples/rpccalls/send_btc.py rename to python-examples/python_examples/rpccalls/send_btc.py index 419eb92..413b14a 100644 --- a/python-examples/rpccalls/send_btc.py +++ b/python-examples/python_examples/rpccalls/send_btc.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/set_tx_fee_rate_preference.py b/python-examples/python_examples/rpccalls/set_tx_fee_rate_preference.py similarity index 85% rename from python-examples/rpccalls/set_tx_fee_rate_preference.py rename to python-examples/python_examples/rpccalls/set_tx_fee_rate_preference.py index 1055f2a..7dede78 100644 --- a/python-examples/rpccalls/set_tx_fee_rate_preference.py +++ b/python-examples/python_examples/rpccalls/set_tx_fee_rate_preference.py @@ -3,8 +3,8 @@ from builtins import print import grpc -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/set_wallet_password.py b/python-examples/python_examples/rpccalls/set_wallet_password.py similarity index 84% rename from python-examples/rpccalls/set_wallet_password.py rename to python-examples/python_examples/rpccalls/set_wallet_password.py index 3abfeae..0ec8d29 100644 --- a/python-examples/rpccalls/set_wallet_password.py +++ b/python-examples/python_examples/rpccalls/set_wallet_password.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/stop.py b/python-examples/python_examples/rpccalls/stop.py similarity index 84% rename from python-examples/rpccalls/stop.py rename to python-examples/python_examples/rpccalls/stop.py index f9b9c0a..ea04301 100644 --- a/python-examples/rpccalls/stop.py +++ b/python-examples/python_examples/rpccalls/stop.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/take_offer.py b/python-examples/python_examples/rpccalls/take_offer.py similarity index 93% rename from python-examples/rpccalls/take_offer.py rename to python-examples/python_examples/rpccalls/take_offer.py index f262b39..d907c3d 100644 --- a/python-examples/rpccalls/take_offer.py +++ b/python-examples/python_examples/rpccalls/take_offer.py @@ -3,8 +3,8 @@ from builtins import print import grpc -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/unfail_trade.py b/python-examples/python_examples/rpccalls/unfail_trade.py similarity index 85% rename from python-examples/rpccalls/unfail_trade.py rename to python-examples/python_examples/rpccalls/unfail_trade.py index d38fa0d..30ee5be 100644 --- a/python-examples/rpccalls/unfail_trade.py +++ b/python-examples/python_examples/rpccalls/unfail_trade.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/unlock_wallet.py b/python-examples/python_examples/rpccalls/unlock_wallet.py similarity index 85% rename from python-examples/rpccalls/unlock_wallet.py rename to python-examples/python_examples/rpccalls/unlock_wallet.py index 55d8da3..78d1e16 100644 --- a/python-examples/rpccalls/unlock_wallet.py +++ b/python-examples/python_examples/rpccalls/unlock_wallet.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/unset_tx_fee_rate_preference.py b/python-examples/python_examples/rpccalls/unset_tx_fee_rate_preference.py similarity index 84% rename from python-examples/rpccalls/unset_tx_fee_rate_preference.py rename to python-examples/python_examples/rpccalls/unset_tx_fee_rate_preference.py index 10c8693..01c1a93 100644 --- a/python-examples/rpccalls/unset_tx_fee_rate_preference.py +++ b/python-examples/python_examples/rpccalls/unset_tx_fee_rate_preference.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/verify_bsq_sent_to_address.py b/python-examples/python_examples/rpccalls/verify_bsq_sent_to_address.py similarity index 86% rename from python-examples/rpccalls/verify_bsq_sent_to_address.py rename to python-examples/python_examples/rpccalls/verify_bsq_sent_to_address.py index 4afe6a2..e8014dd 100644 --- a/python-examples/rpccalls/verify_bsq_sent_to_address.py +++ b/python-examples/python_examples/rpccalls/verify_bsq_sent_to_address.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/rpccalls/withdraw_funds.py b/python-examples/python_examples/rpccalls/withdraw_funds.py similarity index 84% rename from python-examples/rpccalls/withdraw_funds.py rename to python-examples/python_examples/rpccalls/withdraw_funds.py index e98c7ac..b782b34 100644 --- a/python-examples/rpccalls/withdraw_funds.py +++ b/python-examples/python_examples/rpccalls/withdraw_funds.py @@ -3,8 +3,8 @@ from builtins import print import grpc # from getpass import getpass -import bisq.api.grpc_pb2 as bisq_messages -import bisq.api.grpc_pb2_grpc as bisq_service +import python_examples.bisqapi.grpc_pb2 as bisq_messages +import python_examples.bisqapi.grpc_pb2_grpc as bisq_service def main(): diff --git a/python-examples/requirements.txt b/python-examples/requirements.txt new file mode 100644 index 0000000..f731f0c --- /dev/null +++ b/python-examples/requirements.txt @@ -0,0 +1,3 @@ +grpcio==1.44.0 +grpcio-tools==1.44.0 +mypy-protobuf==3.2.0 diff --git a/python-examples/run-setup.sh b/python-examples/run-setup.sh new file mode 100755 index 0000000..0c7be6d --- /dev/null +++ b/python-examples/run-setup.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +# This script must be run from this directory. + +# Install python3-venv if necessary. +# sudo apt install python3-venv + +# Install Python setuptools if necessary. +# pip install setuptools + +# Set up Python environment in python-examples directory. +rm -rf myvenv +python -m venv myvenv +source ./myvenv/bin/activate + +# Install Python example dependencies. +pip install -r requirements.txt + +# Install API example packages in myvenv. +pip install . diff --git a/python-examples/setup.py b/python-examples/setup.py new file mode 100644 index 0000000..23b8202 --- /dev/null +++ b/python-examples/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup, find_packages + +setup( + name='python-examples', + version='0.0.1', + description='Bisq Python Examples', + url='https://bisq-network.github.io/slate/#python-examples', + license='GNU AFFERO GENERAL PUBLIC LICENSE Version 3', + setup_requires=['wheel'], + # packages=find_packages(include=['rpccalls', 'bots', 'bots.*']), + packages=find_packages(), + # package_data={'bots': ['bots/assets/*.png']}, + install_requires=['grpcio', 'grpcio-tools', 'mypy-protobuf', 'python-examples'], + classifiers=[ + 'Operating System :: POSIX :: Linux :: MacOS', + 'Programming Language :: Python :: 3.8.10', + ], +) diff --git a/reference-doc-builder/src/main/java/bisq/apidoc/markdown/CodeExamples.java b/reference-doc-builder/src/main/java/bisq/apidoc/markdown/CodeExamples.java index 889a41b..ac55d16 100644 --- a/reference-doc-builder/src/main/java/bisq/apidoc/markdown/CodeExamples.java +++ b/reference-doc-builder/src/main/java/bisq/apidoc/markdown/CodeExamples.java @@ -39,7 +39,7 @@ public class CodeExamples { // TODO Is hard-coding paths to example source files OK? private static final String CLI_EXAMPLES_DIR = "cli-examples"; private static final String JAVA_EXAMPLES_DIR = "java-examples/src/main/java/rpccalls"; - private static final String PYTHON_EXAMPLES_DIR = "python-examples/rpccalls"; + private static final String PYTHON_EXAMPLES_DIR = "python-examples/python_examples/rpccalls"; private static final String START_SHELL_MD = "```shell"; private static final String START_JAVA_MD = "```java";