A Python library which wraps Windows functions using CFFI
Project description
Python Windows Wrapper Using CFFI
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.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:
https://pywincffi.readthedocs.org/en/latest/dev/ - Goes beyond what’s in this readme.
https://groups.google.com/forum/#!forum/pywincffi - Google group for discussions, questions, etc.
Python Version Support
This project supports Python 2.7 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).
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
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:
> check.bat
This will:
Check code style for both the library and tests.
Run all unittests.
Build the wheel file.
Build the documentation and treat warnings as errors.
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
Built Distributions
Hashes for pywincffi-0.5.0.win-amd64-py3.6.msi
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f3488c8557408d687d8b63acf5d7f60b3e58ed9b3f2263e6b7a013b5c287793 |
|
MD5 | fbec446380cab8e75aa49900077f30a9 |
|
BLAKE2b-256 | ea562ef7f95ea473d54610e0a4f853ac822c41178762b91e74a511e4b5ea45fd |
Hashes for pywincffi-0.5.0.win-amd64-py3.5.msi
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d445f3b51aea51ee9df6f5b34e9075cb46c6270bb9ecaa18caad93209d9e808 |
|
MD5 | 96a08c4ebd40d4e3f85b5ba565ca863f |
|
BLAKE2b-256 | 3c16b483b3c53caef7b3a2af9310303aa09824d9f188a9207ebae15d9bde229e |
Hashes for pywincffi-0.5.0.win-amd64-py3.4.msi
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08bc28290475fe4515c76caea5b4dcaf8a453edc9e0a1d2e1975414eda3365b1 |
|
MD5 | 8e42a33480727d36f9be7e1395acc8c8 |
|
BLAKE2b-256 | 0e057d8aeac520483bf4842e3b8243c33c9159a9c9136aca54e0a0ce4acce9ce |
Hashes for pywincffi-0.5.0.win-amd64-py3.3.msi
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8f1194d94b7ff49b76472b8e15d14adb9005238183a6012bf531b3019bf706a |
|
MD5 | ba99824dc070d0eac42be5e4c6652b63 |
|
BLAKE2b-256 | fc3c87089bcec0d2f6f5a2aa0bcd9f096198c996e78c5a9eb58db1b74c91d961 |
Hashes for pywincffi-0.5.0.win-amd64-py2.7.msi
Algorithm | Hash digest | |
---|---|---|
SHA256 | 859710f3085eb65ac2b8ff7984d46df5abc207a80319e028b9ecbd53174c3625 |
|
MD5 | 48d95dcd2723ebfd693b37821f39b474 |
|
BLAKE2b-256 | 32a3ccb0b6cccd9fc3b35cb261663fec4e90748fb75abd16a0c890c3493f400d |
Hashes for pywincffi-0.5.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae8595b8d6fcca5fd03f56f94d780e1cb79dc63310020334487e6b1a34afd903 |
|
MD5 | f0bd3f06ea783ad833a980f126ef56e8 |
|
BLAKE2b-256 | 7d63d736993a087ce2bc47fb2f4e549290620e016e47bb430225dcc9c5d9f164 |
Hashes for pywincffi-0.5.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868ec9c8ef01a2916fbe200adf4ba380f6beded0c87a6c7a218dc904f9d2ecbb |
|
MD5 | f2f2b208f8905368ee5977448b06aa55 |
|
BLAKE2b-256 | e0cbcf33f4b7c3c2edbb13a8376e03ae62d70acd48fcad8448497b71386e95e8 |
Hashes for pywincffi-0.5.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 471dba8c751ec3c981ebb162dbb37a439b6798917cf71eadcfa1da57d622e89e |
|
MD5 | d15ea543dc95a9776a3e1f191614c555 |
|
BLAKE2b-256 | f5a5a9d27caa4e41b6bcdba8db54e9fef373d204c87482eece589359fe31cb84 |
Hashes for pywincffi-0.5.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2b948d5e2859f32b95cf3a394efa4bca3673e0cd7fdd2d5792d1d7292ea347e |
|
MD5 | ed9fe13470388e24fb8224cefbd55f6f |
|
BLAKE2b-256 | f9fe53fa8d1516a76b67b73a291391d39b9764b34b9516961aaf8900555c2bdf |
Hashes for pywincffi-0.5.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b62ea8027d95c4aa7d4bd4dcadc579827974463253eb7f07bed1f3a39f3fb8b |
|
MD5 | 7639385b64e648f0dc56941c80210d4a |
|
BLAKE2b-256 | 4592b670a15f908eb0b4563900d201c23dd202f3813970dba45cb094d2fa26cd |
Hashes for pywincffi-0.5.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f19167130f07d090bee3d11746ee0a2ba42453579b1d35bf4e343b4d286ac74 |
|
MD5 | f48f64912dd4c16a27da86f0916f6c5e |
|
BLAKE2b-256 | 54e6ca5be63163e48e867dc47cf03d3e190a7a8bc30e7a85422fa6efbb5f2a63 |
Hashes for pywincffi-0.5.0-cp33-cp33m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aa728632369269bd3fa0c98a08fe216ecc172b6550b241173836de42c91bfdf |
|
MD5 | 7483c39be452d917e018a00ad9bf718d |
|
BLAKE2b-256 | 2c89f71486776deb5566ad4702f0fb2a3b3a7624ee92b14c11e25765452aea66 |
Hashes for pywincffi-0.5.0-cp33-cp33m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad94756ac650aa7741f03763da3fa25fe034c370ce9c1169554dfa1a158cc5af |
|
MD5 | 15bc99c5aa82de277a159bf2763093ea |
|
BLAKE2b-256 | da231a418fa1612cb40373292d80e7f6547760f861b6088597e14f329553b538 |
Hashes for pywincffi-0.5.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ef0f3ccaf69b202df81c21915807b1154b4cffa25057576653fe8ec765be035 |
|
MD5 | e701707a67df984cff61cada11a594b4 |
|
BLAKE2b-256 | 136daa44a2f87ab86f77c6a9b2f19c1a23be0f44db749b2fe57154fa4bdf5572 |
Hashes for pywincffi-0.5.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58e31cca17f8f60893c700eb516135ec4ec83e725fe0f7701b3f2dbcbfd0bc32 |
|
MD5 | 06ebe7a8f35d3a8cd5945f85c3431012 |
|
BLAKE2b-256 | 7d2d59b593a064f662fb76ab5b65f2831587dd68ff1ac81e37e05880a9d13a51 |