Skip to main content

A Python library which wraps Windows functions using CFFI

Project description

Python Windows Wrapper Using CFFI

build status build status (pylint and pep8) code coverage documentation badge

pywincffi is a wrapper around some Windows API functions using Python and the cffi library. This project was originally created to assist the Twisted project in moving away from its dependency on pywin32. Contributions to expand on the APIs which pywincffi offers are always welcome however.

The core objectives and design principles behind this project are:

  • It should be easier to to use Windows API functions both in terms of implementation and distribution.

  • Python 2.6, 2.7 and 3.x should be supported from a single code base and not require a consumer of pywincffi to worry about how they use the library.

  • Type conversion, error checking and other ‘C like’ code should be the responsibility of the library where possible.

  • APIs provided by pywincffi should mirror their Windows counterparts as closely as possible so the MSDN documentation can be more easily used as reference.

  • Documentation and error messages should be descriptive, consistent, complete and accessible. Examples should be provided for more complex use cases.

  • For contributors, it should be possible to develop and test regardless of what platform the contributor is coming from.

Development

This section gives a basic overview of the development process including the major goals. This is not comprehensive but should be a good introduction before submitting a pull request.

Support and Documentation

Besides this readme there are two other locations you can go to receive some help:

Python Version Support

This project supports Python 2.6 and up including Python 3.x. PRs, patches, tests etc that don’t include support for both 2.x and 3.x will not be merged. The aim is also the support both major versions of Python within the same code base rather than rely on tools such as 2to3, six or other libraries for the most part.

Documentation

The documentation for this this library is hosted on Read The Docs. It’s generated directly from this library using sphinx:

virtualenv env
env/bin/activate
pip install -r dev_requirements.txt
pip install -e .
cd docs
make html

The build process also builds the documentation to ensure there are not any obvious problems (including broken links).

Note, if you’re running Python 2.6 use dev_requirements-2.6.txt instead.

Function Documentation

Windows API Functions are typically documented in the following format:

def DuplicateHandle(arg1, kwarg1=None):
    """
    A brief message about this function.

    .. seealso::

        <url to the MSDN API documentation for this function>

    :param type arg1:
        Brief information about this argument

    :keyword type kwarg1:
        Brief information about this keyword include it's default
        and how it's handled within the function.

    :raises SomeException:
        Some information on when this exception will be raised

    :rtype: type
    :return:
        Information about the data that's returned
    """

It’s important to note that the docs contain a seealso stanza. This is typically used to reference the MSDN documentation but may also be used to reference examples, white papers or other reference which may be useful in describing the function.

Adding new functions is covered in greater detail here

Testing

Nosetests

Tests are located in the tests/ directory. The tests themselves are run using nosetests either manually or using the setup.py file:

virtualenv env
env/bin/activate
pip install -r dev_requirements.txt
pip install -e .
nosetests tests

Note, if you’re running Python 2.6 use dev_requirements-2.6.txt instead.

Continuous Integration

To consistently ensure the highest quality code, the following services are utilized to test or analyze every commit and pull request:

  • AppVeyor - Runs the unittests, builds wheel files, MSIs and other output artifacts which can be published in a release.

  • Travis - Runs the pep8 and pylint command line tools on the code base and tests. This also builds the docs so documentation problems are easily spotted.

  • Codecov - Analyses and displays code coverage results after tests have run on AppVeyor. Results are posted back to pull requests.

  • ReadTheDocs. - The official location where documentation is built and posted. This is generally for merges into the master branch however.

Additional Testing

As seen above, there are numerous tests besides the unittests. To run all the tests on Windows, much like the continuous integration systems do, you can run test.bat:

> test.bat
========================================================================================
pep8 pywincffi
========================================================================================
========================================================================================
pep8 tests
========================================================================================
========================================================================================
pylint pywincffi
========================================================================================
========================================================================================
pylint tests
========================================================================================
========================================================================================
sphinx-build -q -b html -W -E -a -d docs/build/doctrees docs/source docs/build/html
========================================================================================
========================================================================================
sphinx-build -q -b linkcheck -W -E -a -d docs/build/doctrees docs/source docs/build/html
========================================================================================
========================================================================================
setup.py bdist_wheel
========================================================================================
RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
  warn=(impl == 'cp')):
RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
  warn=(impl == 'cp')):
========================================================================================
nosetests -sv tests
========================================================================================
[ omitted ]
========================================================================================

Keep in mind that this will not setup the virtualenv or build environment for you. So if you can’t build the library or are missing a dependency then the above may fail.

Vagrant

The continuous integration services above negate most of the need to setup your local workstation to handle development for pywincffi, even if you’re not running Windows. In some cases however it can be faster or easiear to work on your local machine.

If you’re not running Windows or you don’t have the tools necessary to develop pywincffi on your machine you can use Vagrant to build a Windows machine and start developing. There’s a more in depth explanation of this process located here:

https://pywincffi.readthedocs.org/en/latest/dev/vagrant.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywincffi-0.4.0.zip (65.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pywincffi-0.4.0.win-amd64-py3.5.msi (159.7 kB view details)

Uploaded Source

pywincffi-0.4.0.win-amd64-py3.4.msi (159.7 kB view details)

Uploaded Source

pywincffi-0.4.0.win-amd64-py3.3.msi (229.4 kB view details)

Uploaded Source

pywincffi-0.4.0.win-amd64-py2.7.msi (229.4 kB view details)

Uploaded Source

pywincffi-0.4.0.win-amd64-py2.6.msi (213.0 kB view details)

Uploaded Source

pywincffi-0.4.0.win32-py3.5.msi (155.6 kB view details)

Uploaded Source

pywincffi-0.4.0.win32-py3.4.msi (155.6 kB view details)

Uploaded Source

pywincffi-0.4.0.win32-py3.3.msi (229.4 kB view details)

Uploaded Source

pywincffi-0.4.0.win32-py2.7.msi (229.4 kB view details)

Uploaded Source

pywincffi-0.4.0.win32-py2.6.msi (213.0 kB view details)

Uploaded Source

pywincffi-0.4.0-cp35-cp35m-win_amd64.whl (80.3 kB view details)

Uploaded CPython 3.5mWindows x86-64

pywincffi-0.4.0-cp35-cp35m-win32.whl (77.6 kB view details)

Uploaded CPython 3.5mWindows x86

pywincffi-0.4.0-cp34-cp34m-win_amd64.whl (77.9 kB view details)

Uploaded CPython 3.4mWindows x86-64

pywincffi-0.4.0-cp34-cp34m-win32.whl (76.2 kB view details)

Uploaded CPython 3.4mWindows x86

pywincffi-0.4.0-cp33-cp33m-win_amd64.whl (77.9 kB view details)

Uploaded CPython 3.3mWindows x86-64

pywincffi-0.4.0-cp33-cp33m-win32.whl (76.2 kB view details)

Uploaded CPython 3.3mWindows x86

pywincffi-0.4.0-cp27-cp27m-win_amd64.whl (78.0 kB view details)

Uploaded CPython 2.7mWindows x86-64

pywincffi-0.4.0-cp27-cp27m-win32.whl (76.3 kB view details)

Uploaded CPython 2.7mWindows x86

pywincffi-0.4.0-cp26-cp26m-win_amd64.whl (78.3 kB view details)

Uploaded CPython 2.6mWindows x86-64

pywincffi-0.4.0-cp26-cp26m-win32.whl (76.6 kB view details)

Uploaded CPython 2.6mWindows x86

File details

Details for the file pywincffi-0.4.0.zip.

File metadata

  • Download URL: pywincffi-0.4.0.zip
  • Upload date:
  • Size: 65.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pywincffi-0.4.0.zip
Algorithm Hash digest
SHA256 5e7698fd774cab6baf3d90189fbaec93d7b8c6e2d50c03004555c9295198f0cf
MD5 6e5327e23aba4dddedb22a3ed12f3895
BLAKE2b-256 7e474f2d29fbd7365a590e3af8e0aaa17be4107617f794993fdb813950c18dd7

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win-amd64-py3.5.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win-amd64-py3.5.msi
Algorithm Hash digest
SHA256 cc800c9d2cfb4ec822d4ed58a749245a683e730baa4010043d5bb3623d039f16
MD5 5613598bfc94bff21ab55da1a7e927e1
BLAKE2b-256 3680a70f051f48742f2a31cd03f0071e7826186fe80b29f0bff1ffe64cefa008

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win-amd64-py3.4.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win-amd64-py3.4.msi
Algorithm Hash digest
SHA256 4d5857af690797919d0fc6dd68a06ad2d7012c9d69c1f64b01fb50efb80ba9f5
MD5 7896b4bc06fa5c2f422850875a49668a
BLAKE2b-256 b1e668439831739258ea1ecf3e25efb9bac8714b40f362ec671386a5f6e0641f

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win-amd64-py3.3.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win-amd64-py3.3.msi
Algorithm Hash digest
SHA256 013f865cf8b95982cacbf224692b64051c0d2b3b13bdf8085d61d30b773e3c91
MD5 959b9f0043acd98d5196eed9b7ce26eb
BLAKE2b-256 9ae3e36dd7e5264bc9f7ad24182bb42447aeb447c4220f65dc762a4e71cba129

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win-amd64-py2.7.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win-amd64-py2.7.msi
Algorithm Hash digest
SHA256 0a4617ee270b4bc0d295ea023ffc582c67e00ab87e33b49d9f80a7593d5dd83e
MD5 63b183589aafed1ae7fbc22a9ed24d55
BLAKE2b-256 c0539ae33ce3012873a88f067520ea3c45dd0ec8082df50aee1c55df20637785

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win-amd64-py2.6.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win-amd64-py2.6.msi
Algorithm Hash digest
SHA256 daaf81007733a2e0943a9c65126d35e403dff49b2bb93add267a46ef949f21e6
MD5 09722461745de728790db4b7164ca921
BLAKE2b-256 00d6b8462a104a7ab1fb3ac5439ffaacc202ad53c7a5a46abdbc3d857f7ee214

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win32-py3.5.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win32-py3.5.msi
Algorithm Hash digest
SHA256 dbe264cdced1dd60c54109a01edcac5de14f83309c6c9f906d580086d3a1a983
MD5 8911f744dc345449bb7aeec4d3160918
BLAKE2b-256 ed945ed51588c7d61e3effd872f29071b5ed42faf3c3c342dbfb52e6d5712c9d

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win32-py3.4.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win32-py3.4.msi
Algorithm Hash digest
SHA256 a84a7a56d9fbfdd650b9132d7a9a1a590a35207e6fbb66e753d66322cacc0522
MD5 0a395b5dc1aa70514638f0d98b0c8968
BLAKE2b-256 4eb570987cf62e24747a7f31e7eace4642700599e7c9f073522f9ae1c820923f

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win32-py3.3.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win32-py3.3.msi
Algorithm Hash digest
SHA256 278c55021de589ad15aed81e490e8960f204675661cd0e64bfe374653d7e7742
MD5 0b867bb53a2eb8853fcab2a8e9104caa
BLAKE2b-256 6d7b809f7cadbbf23d35d68eae8b2a07bb9908622e3f9909ae1fe532c73ab338

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win32-py2.7.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win32-py2.7.msi
Algorithm Hash digest
SHA256 2f5b1fcd4a098024cb64aa26851b45714bef2803426706436a2b1d42ed0be580
MD5 01ad3aeeab81b7e45b164463fec49999
BLAKE2b-256 38ddcfa9a8acd95b33dcab034d50b202146affae1763137513de9b4a89ace657

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0.win32-py2.6.msi.

File metadata

File hashes

Hashes for pywincffi-0.4.0.win32-py2.6.msi
Algorithm Hash digest
SHA256 ca05ceb9b423c60f868537fb828f710d80c87fc09a5bb5a3d136b8b6d0099451
MD5 c07b775dbb2cd4d38b3bd076528d0560
BLAKE2b-256 cf024bac23db52882899d7561e417b0a31c09c641031b500b9920790f5469686

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 36ec47503175d6dff028864d4814b2690b84741144b7cca01d3e8cbbd0dde2df
MD5 0258d0ee1c8230ba00f9842be5cc8b9c
BLAKE2b-256 81390aac22a2e31fd398e3be3a9b5204af7309ec058eb911f2162598933b54af

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 0a358b6965e869911e69014f0a049b6aef9a7342b595320ebc5591f6b8fca850
MD5 158ff2b17039b9e071af96ee26c92fd7
BLAKE2b-256 c7a4e3da9046219cce39c99e0dff5c2643426c4d173bc09f575fe3bc9abd757b

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 a72df1190eb9d133e12a691becb17c4fde80ea22109f28698585dbd542835e0a
MD5 0c5bcb2c78a1e007545a419ebf01c577
BLAKE2b-256 3d17101e910f88785332556870d009e2ddb00e9aa0273692d1f53827042f701f

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp34-cp34m-win32.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 d8e9f6843cd829a474fc6741da10ad849e025a66f31c84ea32a27bf2964904b9
MD5 9a92c22c3c7821e6f663988f0c934307
BLAKE2b-256 ed88e358a97e0c95988c51b39f923fd61bc048a6e9e1d1d4dd5eb4b94af332a6

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp33-cp33m-win_amd64.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp33-cp33m-win_amd64.whl
Algorithm Hash digest
SHA256 28e8f86295d5157949f89869ead239b32c461e937a65edea45ae41708baf429e
MD5 ea2f5dd70f22e7d5dca1c94ffe5a22c0
BLAKE2b-256 cbf846794aec7ebd144526c522883af0edd25d6ff537b71284b846777a4535b0

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp33-cp33m-win32.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp33-cp33m-win32.whl
Algorithm Hash digest
SHA256 5b6aee46b3ecf7e808d9759ed4864c43b9fbba5d0764e306fe1d3fa24efe4ba0
MD5 ce9dac2e58594446b19c395ec4eaebde
BLAKE2b-256 317e36e39a12379418cb3c86e2e45f964fa526e99e1ef6b882caf0851f362ed1

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 3313997edd1269dcedd68d15950fa93f0d1c9b064b6573cab1063a07e6986e5b
MD5 d92853cff91c7b047238eac54a8b3e57
BLAKE2b-256 40725bd98a3c29de049c6e3f386020b64fda5dc5e2ccdc3cb889fb32e4e53d17

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 21d6cf1837b78b216933983b342430322f248e4fb9a8e3103040fcd083f771bd
MD5 ed042669fbbe8ce44c237ae3197bcc8d
BLAKE2b-256 06dd81c4fd38406c402dd3d5abab5e81a91efd8daf11c8c455a7728c65bc7376

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp26-cp26m-win_amd64.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp26-cp26m-win_amd64.whl
Algorithm Hash digest
SHA256 ba46849fa4123be46a60c22b9bc1743a5f0e3eec2e85972dfa3104f1326b407f
MD5 01da91c91987cc176a3fdd35016df8c4
BLAKE2b-256 278fb9941ca5c537242ddd04bd3788a7307db628a7bd41356a86821715744036

See more details on using hashes here.

File details

Details for the file pywincffi-0.4.0-cp26-cp26m-win32.whl.

File metadata

File hashes

Hashes for pywincffi-0.4.0-cp26-cp26m-win32.whl
Algorithm Hash digest
SHA256 4986e69de053e05149e1c086ac014b1a4f9f074db8dcc2180f53d44adae42b60
MD5 8d8c1c9c89af86f0e53f1f3cfde9dfdc
BLAKE2b-256 ecc682fe9379c1c7bb5b516f5e1a0cacc3314cf67a01cd13c17285255a27c975

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page