Coder Social home page Coder Social logo

pyota-ccurl's Introduction

C Curl Extension for PyOTA

This is an extension for the crypto functionality in PyOTA, the Python API for IOTA. When installed, it will significantly boost the performance of PyOTA's crypto functionality.

This extension is installed as an add-on to the pyota package:

pip install pyota[ccurl]

After running the above command, you can verify that the C extension is installed correctly by running the check_ccurl command in your shell:

> check_ccurl
๐Ÿ˜ธ  CCurl is installed correctly!
For support, visit the #iota-libs-pyota channel on the IOTA Slack.
https://slack.iota.org/

Compatibility

This extension is compatible with Python 3.6, 3.5 and 2.7.

Testing

The easiest way to test the extension is to install it and then run the PyOTA unit tests.

Here's a modified tox.ini file that for PyOTA that will install the C extension before running unit tests:

[tox]
envlist = py27, py35, py36

[testenv]
commands =
  pip install --pre pyota-ccurl
  nosetests
deps =
  mock
  nose

Note that this file needs to be installed in the PyOTA codebase!

pyota-ccurl's People

Contributors

etiennekruger avatar todofixthis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyota-ccurl's Issues

Does not compile in Python 2.7

The extension won't compile in Python 2.7:

    src/ccurlmodule.c:205:8: error: unknown type name 'PyModuleDef'
    static PyModuleDef ccurlmodule = {
           ^
    src/ccurlmodule.c:206:3: error: use of undeclared identifier 'PyModuleDef_HEAD_INIT'
      PyModuleDef_HEAD_INIT,
      ^
    src/ccurlmodule.c:220:5: error: void function 'PyInit_ccurl' should not return a value [-Wreturn-type]
        return NULL;
        ^      ~~~~
    src/ccurlmodule.c:222:7: warning: implicit declaration of function 'PyModule_Create' is invalid in C99 [-Wimplicit-function-declaration]
      m = PyModule_Create(&ccurlmodule);
          ^
    src/ccurlmodule.c:224:5: error: void function 'PyInit_ccurl' should not return a value [-Wreturn-type]
        return NULL;
        ^      ~~~~
    src/ccurlmodule.c:228:5: error: void function 'PyInit_ccurl' should not return a value [-Wreturn-type]
        return NULL;
        ^      ~~~~
    src/ccurlmodule.c:238:3: error: void function 'PyInit_ccurl' should not return a value [-Wreturn-type]
      return m;
      ^      ~
    1 warning and 6 errors generated.
    error: command '/usr/bin/clang' failed with exit status 1

This appears to be due to changes introduced in the Python C API during the transition to version 3:
https://docs.python.org/3/howto/cporting.html

UnicodeDecodeError when installing on Windows 10, Python 3.6.4

C:\Python36\Scripts> .\pip.exe install pyota[ccurl]
...
Installing collected packages: pyota-ccurl
  Running setup.py install for pyota-ccurl ... error
Exception:
Traceback (most recent call last):
  File "c:\python36\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x94 in position 90: invalid start byte
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "c:\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\python36\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "c:\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "c:\python36\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x94 in position 90: invalid start byte

See https://pastebin.com/kTAsr3MH for full output.

Note: Works OK on same system with Python 2.7

Convert to wrapper for ccurl library

Convert the extension into a wrapper for the official CCurl library.

This gets us a ton of goodies for free:

  • Crypto code is already/regularly vetted.
  • Any enhancements or fixes made to the CCurl library would automatically apply to us.
  • We'd be able to seamlessly incorporate PoW.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.