Giter Site home page Giter Site logo

cwrap's Introduction

cwrap

cwrap is a Python wrapper around C code, building upon ctypes.

Examples

See examples/

Installing

pip install cwrap

Running tests

Clone this repo and cd into it, then:

pip install -r requirements.txt
python -m pytest -v -s tests

cwrap's People

Contributors

akva2 avatar eivindjahren avatar galfodo avatar jensgm avatar jepebe avatar joakim-hove avatar jokva avatar larsevj avatar mortalisk avatar pinkwah avatar sondreso avatar valentin-krasontovitsch avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cwrap's Issues

Use Github Actions

Travis is deprecated.

Should support:

  • Python 3.6 - 3.9
  • Windows, Linux, Maco

windows python3.6 import error

import cwrap

ImportError Traceback (most recent call last)
in ()
----> 1 import cwrap

D:\WPy-x64-3662\python-3.6.6.amd64\lib\site-packages\cwrap_init_.py in ()
44 from .basecvalue import BaseCValue
45
---> 46 from .cfile import CFILE, copen as open
47 from .clib import load, lib_name
48

D:\WPy-x64-3662\python-3.6.6.amd64\lib\site-packages\cwrap\cfile.py in ()
89 from .clib import load as cwrapload
90
---> 91 class LibcPrototype(Prototype):
92 lib = cwrapload(None)
93

D:\WPy-x64-3662\python-3.6.6.amd64\lib\site-packages\cwrap\cfile.py in LibcPrototype()
90
91 class LibcPrototype(Prototype):
---> 92 lib = cwrapload(None)
93
94 def init(self, prototype, bind=False, allow_attribute_error=False):

D:\WPy-x64-3662\python-3.6.6.amd64\lib\site-packages\cwrap\clib.py in load(lib, so_version, path, so_ext)
107 # """ % LD_LIBRARY_PATH
108 # raise ImportError(error_msg)

ImportError:
Failed to load shared library:None

dlopen() error: LoadLibrary() argument 1 must be str, not None

CWrapFile should have write member function

This used to be possible before:

with open("grid.grdecl" , "w") as f2:
f2.write("SPECGRID\n")
f2.write(" 10 10 10 'F' /\n")
coord_kw = f["COORD"][0]
coord_kw.write_grdecl( f2 )

Now it isn't.
open cannot be exhanged with copen, because CWrapFIle does not have a "write" member function.

Instances of baseCenum is not treated as int by ctypes in python3.11

Describe the bug
When prototype.call is used on a function expecting an int and you give it an instance of basecenum it will give you a ValueError in python3.11, due to stricter type enforcements.

To Reproduce
Run resdata tests onprem, or run this script:

from cwrap import BaseCEnum
from resdata.resfile import ResdataFile
from resdata import FileMode
  
f1 = ResdataFile("some_file.some", index_filename="index")

will faile with TypeError on python3.11 while it fails on file not found for python3.8.

Add osx travis build

At the moment, travis is not run on osx as python is not natively supported on osx.

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.