{ "info": { "author": "Chris (Someguy123) @ Privex", "author_email": "chris@privex.io", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ], "description": "# Privex's JsonRPC Emulators\n\n[![Documentation Status](https://readthedocs.org/projects/rpcemulator/badge/?version=latest)](https://rpcemulator.readthedocs.io/en/latest/?badge=latest) \n[![Build Status](https://travis-ci.com/Privex/rpcemulator.svg?branch=master)](https://travis-ci.com/Privex/rpcemulator) \n[![Codecov](https://img.shields.io/codecov/c/github/Privex/rpcemulator)](https://codecov.io/gh/Privex/rpcemulator)\n[![PyPi Version](https://img.shields.io/pypi/v/rpcemulator.svg)](https://pypi.org/project/rpcemulator/)\n![License Button](https://img.shields.io/pypi/l/rpcemulator) \n![PyPI - Downloads](https://img.shields.io/pypi/dm/rpcemulator)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rpcemulator) \n![GitHub last commit](https://img.shields.io/github/last-commit/Privex/rpcemulator)\n\nPrivex's RPC Emulators are various python modules using [jsonrpcserver](https://github.com/bcb/jsonrpcserver) to\nemulate a certain type of JsonRPC node for use in unit testing. \n\n\n```\n +===================================================+\n | \u00a9 2019 Privex Inc. |\n | https://www.privex.io |\n +===================================================+\n | |\n | Originally Developed by Privex Inc. |\n | |\n | Core Developer(s): |\n | |\n | (+) Chris (@someguy123) [Privex] |\n | (+) Kale (@kryogenic) [Privex] |\n | |\n +===================================================+\n```\n\n# Tl;Dr; Install and use Privex RPC Emulators\n\nInstall from PyPi (detailed install info at [Install](#Install))\n\n```sh\npipenv install rpcemulator # If you use pipenv (and you should!)\npip3 install rpcemulator # Otherwise, standard pip installation\n```\n\nQuick example usage:\n\n```python\nfrom privex.rpcemulator.bitcoin import BitcoinEmulator\nfrom privex.jsonrpc import BitcoinRPC\n\nrpc = BitcoinRPC()\n\"\"\"\nYou can interact with the emulated Bitcoin daemon with any JsonRPC library you prefer.\nHowever, privex-jsonrpc comes as a dependency of rpcemulator for convenience :)\n\"\"\"\n\nwith BitcoinEmulator():\n print('Balance is:', rpc.getbalance())\n print('Network info is:', rpc.getnetworkinfo())\n\n```\n\n# Table of Contents (Github README)\n\n**NOTE:** The below Table of Contents is designed to work on Github. The links do NOT work on PyPi's description,\nand may not work if you're reading this README.md elsewhere.\n\n\n1. [General Information](#general-info)\n\n2. [Install](#Install)\n\n 2.1 [Via PyPi (pip)](#download-and-install-from-pypi)\n\n 2.2 [Manually via Git](#alternative-manual-install-from-git)\n\n3. [Documentation](#documentation)\n\n4. [License](#License)\n\n5. [Example Uses](#example-uses)\n\n6. [Unit Tests](#unit-tests)\n\n7. [Contributing](#contributing)\n\n\n# General Info\n\nPrivex's RPC Emulators are various python modules using [jsonrpcserver](https://github.com/bcb/jsonrpcserver) to\nemulate a certain type of JsonRPC node for use in unit testing. \n\nCurrently there's only one emulator included: `bitcoin.BitcoinEmulator` which emulates a `bitcoind` RPC server,\nallowing code which interacts with a `bitcoind` (or other bitcoind-based) node to be tested, without needing\nto run the coin daemon.\n\nThis means you can test `bitcoind` interfacing code with continuous integration systems like \n[Travis CI](https://travis-ci.com), where you would normally be unable to run a full coin daemon.\n\n\n# Install\n\n### Download and install from PyPi \n\n**Using [Pipenv](https://pipenv.kennethreitz.org/en/latest/) (recommended)**\n\n```sh\npipenv install rpcemulator\n```\n\n**Using standard Python pip** \n\n```sh\npip3 install rpcemulator\n```\n\n### (Alternative) Manual install from Git\n\n**Option 1 - Use pip to install straight from Github**\n\n```sh\npip3 install git+https://github.com/Privex/rpcemulator\n```\n\n**Option 2 - Clone and install manually**\n\n```bash\n# Clone the repository from Github\ngit clone https://github.com/Privex/rpcemulator\ncd rpcemulator\n\n# RECOMMENDED MANUAL INSTALL METHOD\n# Use pip to install the source code\npip3 install .\n\n# ALTERNATIVE MANUAL INSTALL METHOD\n# If you don't have pip, or have issues with installing using it, then you can use setuptools instead.\npython3 setup.py install\n```\n\n# Documentation\n\n[![Read the Documentation](https://read-the-docs-guidelines.readthedocs-hosted.com/_images/logo-wordmark-dark.png)](\nhttps://rpcemulator.readthedocs.io/en/latest/)\n\nFull documentation for this project is available above (click the Read The Docs image), including:\n\n - How to install the application and it's dependencies \n - How to use the various functions and classes\n - General documentation of the modules and classes for contributors\n\n**To build the documentation:**\n\n```bash\ngit clone https://github.com/Privex/rpcemulator\ncd rpcemulator/docs\npip3 install -r requirements.txt\n\n# It's recommended to run make clean to ensure old HTML files are removed\n# `make html` generates the .html and static files in docs/build for production\nmake clean && make html\n\n# After the files are built, you can live develop the docs using `make live`\n# then browse to http://127.0.0.1:8100/\n# If you have issues with content not showing up correctly, try make clean && make html\n# then run make live again.\nmake live\n```\n\n# License\n\nThis Python module was created by [Privex Inc. of Belize City](https://www.privex.io), and licensed under the \nX11/MIT License.\nSee the file [LICENSE](https://github.com/Privex/rpcemulator/blob/master/LICENSE) for the license text.\n\n**TL;DR; license:**\n\nWe offer no warranty. You can copy it, modify it, use it in projects with a different license, and even in commercial \n(paid for) software.\n\nThe most important rule is - you **MUST** keep the original license text visible (see `LICENSE`) in any copies.\n\n# Example uses\n\n**Using a JsonRPC emulator in a unit test**\n\n```python\nimport unittest\nfrom privex.rpcemulator.bitcoin import BitcoinEmulator\nfrom privex.jsonrpc import BitcoinRPC\n\nclass TestMyThing(unittest.TestCase):\n emulator: BitcoinEmulator\n \"\"\"Stores the :class:`.BitcoinEmulator` instance\"\"\"\n rpc = BitcoinRPC()\n \"\"\"For this example, we're using our BitcoinRPC class and communicating with the RPC directly\"\"\"\n\n @classmethod\n def setUpClass(cls) -> None:\n \"\"\"Launch the Bitcoin RPC emulator in the background on default port 8332\"\"\"\n cls.emulator = BitcoinEmulator()\n\n @classmethod\n def tearDownClass(cls) -> None:\n \"\"\"Shutdown the Bitcoin RPC emulator process\"\"\"\n cls.emulator.terminate()\n\n def test_something(self):\n \"\"\"Run whatever code depends on a Bitcoin RPC\"\"\"\n self.assertGreater(self.rpc.getbalance(), 0)\n\n```\n\n**Using a JsonRPC emulator in your code, with a Context Manager**\n\nUse the appropriate emulator class with a `with` statement so the server is automatically stopped once you're\ndone querying it.\n\nThis prevents any risk of the web server process being leftover.\n\n```python\nfrom privex.rpcemulator.bitcoin import BitcoinEmulator\nfrom privex.jsonrpc import BitcoinRPC\n\nrpc = BitcoinRPC()\nprint('Starting BitcoinEmulator')\n\nwith BitcoinEmulator():\n print('Balance is:', rpc.getbalance())\n print('Network info is:', rpc.getnetworkinfo())\n\nprint('Stopped BitcoinEmulator')\n\n```\n\n\n# Unit Tests\n\nUnit tests are stored in the `tests/` folder, which are split into several `test_xxxx` files.\n\nWe use [Travis CI](https://travis-ci.com/Privex/rpcemulator) for continuous integration, which runs the test\nsuite every time a new commit, tag, or branch is pushed to this Github repo.\n\nWe also use [CodeCov](https://codecov.io/gh/Privex/rpcemulator) which integrates with our Travis CI setup, and\nprovides test coverage statistics, so ourselves and contributors can visually see how much of the code is covered\nby our unit tests \n\nTL;Dr; Run the tests:\n\n```\npip3 install -r requirements.txt\npytest -v\n```\n\nFor more information about using the unit tests, see the \n[How to use the unit tests](https://rpcemulator.readthedocs.io/en/latest/code/tests.html) section of \nthe documentation. \n\n# Contributing\n\nWe're happy to accept pull requests, no matter how small.\n\nPlease make sure any changes you make meet these basic requirements:\n\n - Any code taken from other projects should be compatible with the MIT License\n - This is a new project, and as such, supporting Python versions prior to 3.4 is very low priority.\n - However, we're happy to accept PRs to improve compatibility with older versions of Python, as long as it doesn't:\n - drastically increase the complexity of the code\n - OR cause problems for those on newer versions of Python.\n\n**Legal Disclaimer for Contributions**\n\nNobody wants to read a long document filled with legal text, so we've summed up the important parts here.\n\nIf you contribute content that you've created/own to projects that are created/owned by Privex, such as code or \ndocumentation, then you might automatically grant us unrestricted usage of your content, regardless of the open source \nlicense that applies to our project.\n\nIf you don't want to grant us unlimited usage of your content, you should make sure to place your content\nin a separate file, making sure that the license of your content is clearly displayed at the start of the file \n(e.g. code comments), or inside of it's containing folder (e.g. a file named LICENSE). \n\nYou should let us know in your pull request or issue that you've included files which are licensed\nseparately, so that we can make sure there's no license conflicts that might stop us being able\nto accept your contribution.\n\nIf you'd rather read the whole legal text, it should be included as `privex_contribution_agreement.txt`.\n\n\n# Thanks for reading!\n\n**If this project has helped you, consider [grabbing a VPS or Dedicated Server from Privex](https://www.privex.io).**\n\n**Prices start at as little as US$8/mo (we take cryptocurrency!)**\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Privex/rpcemulator", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "rpcemulator", "package_url": "https://pypi.org/project/rpcemulator/", "platform": "", "project_url": "https://pypi.org/project/rpcemulator/", "project_urls": { "Homepage": "https://github.com/Privex/rpcemulator" }, "release_url": "https://pypi.org/project/rpcemulator/0.8.1/", "requires_dist": [ "privex-helpers (>=2.0.0)", "privex-jsonrpc (>=1.1.2)", "Faker (>=2.0.0)", "jsonrpcserver (>=4.0.0)" ], "requires_python": "", "summary": "A collection of JsonRPC API emulators, designed for unit testing", "version": "0.8.1", "yanked": false, "yanked_reason": null }, "last_serial": 6045806, "releases": { "0.8.0": [ { "comment_text": "", "digests": { "md5": "8bc0294d14d3438c33aeb5bfd23d1db7", "sha256": "7cc9ed64545e4fac7a63ca887b98fe4a1b4003aaf275da29ce93e64566c46df1" }, "downloads": -1, "filename": "rpcemulator-0.8.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8bc0294d14d3438c33aeb5bfd23d1db7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17046, "upload_time": "2019-10-29T07:13:29", "upload_time_iso_8601": "2019-10-29T07:13:29.535054Z", "url": "https://files.pythonhosted.org/packages/ac/d0/4e437bebb9d5862d4854f0650ab1bc294560d8a0f10daae35ad4ae7bc6f8/rpcemulator-0.8.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "0c325ec4d9090af8a4d3b7aae66fa6d1", "sha256": "858003d82eb377793c77a34ffe2d67517ff346c599e8b071a1ea59d883530e94" }, "downloads": -1, "filename": "rpcemulator-0.8.0.tar.gz", "has_sig": false, "md5_digest": "0c325ec4d9090af8a4d3b7aae66fa6d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18462, "upload_time": "2019-10-29T07:13:32", "upload_time_iso_8601": "2019-10-29T07:13:32.028409Z", "url": "https://files.pythonhosted.org/packages/b1/12/fdf1e17b90ea9c6d95724d54c677e6034c67e1463411affae2d0e7877c12/rpcemulator-0.8.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "f53b928833500ba0de994e26133f7c96", "sha256": "f6915c40f0673775c65c625ddae2d39ce245fb23f2e4f41c2a63e8b0480923d9" }, "downloads": -1, "filename": "rpcemulator-0.8.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f53b928833500ba0de994e26133f7c96", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17118, "upload_time": "2019-10-29T08:05:56", "upload_time_iso_8601": "2019-10-29T08:05:56.437452Z", "url": "https://files.pythonhosted.org/packages/51/30/7342aeb029cf6a31563e338f66842a3b6c4641058a6067e28daa74653f7c/rpcemulator-0.8.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "d0a088725e0671b42ce7e3cbd218d86d", "sha256": "903a07e12c2843e91f480f203f18ebedaabd00490111e395aa69d69dd3089ed4" }, "downloads": -1, "filename": "rpcemulator-0.8.1.tar.gz", "has_sig": false, "md5_digest": "d0a088725e0671b42ce7e3cbd218d86d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18541, "upload_time": "2019-10-29T08:05:58", "upload_time_iso_8601": "2019-10-29T08:05:58.854898Z", "url": "https://files.pythonhosted.org/packages/52/11/9b19c4fd350927464add28ef6d26890b614d30fd65b60c310852c2e6cbed/rpcemulator-0.8.1.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f53b928833500ba0de994e26133f7c96", "sha256": "f6915c40f0673775c65c625ddae2d39ce245fb23f2e4f41c2a63e8b0480923d9" }, "downloads": -1, "filename": "rpcemulator-0.8.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f53b928833500ba0de994e26133f7c96", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17118, "upload_time": "2019-10-29T08:05:56", "upload_time_iso_8601": "2019-10-29T08:05:56.437452Z", "url": "https://files.pythonhosted.org/packages/51/30/7342aeb029cf6a31563e338f66842a3b6c4641058a6067e28daa74653f7c/rpcemulator-0.8.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "d0a088725e0671b42ce7e3cbd218d86d", "sha256": "903a07e12c2843e91f480f203f18ebedaabd00490111e395aa69d69dd3089ed4" }, "downloads": -1, "filename": "rpcemulator-0.8.1.tar.gz", "has_sig": false, "md5_digest": "d0a088725e0671b42ce7e3cbd218d86d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18541, "upload_time": "2019-10-29T08:05:58", "upload_time_iso_8601": "2019-10-29T08:05:58.854898Z", "url": "https://files.pythonhosted.org/packages/52/11/9b19c4fd350927464add28ef6d26890b614d30fd65b60c310852c2e6cbed/rpcemulator-0.8.1.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }