Skip to main content
https://github.com/johnthagen/pytap2/workflows/python/badge.svg https://codeclimate.com/github/johnthagen/pytap2/badges/gpa.svg https://codeclimate.com/github/johnthagen/pytap2/badges/issue_count.svg https://codecov.io/github/johnthagen/pytap2/coverage.svg https://img.shields.io/pypi/v/pytap2.svg https://img.shields.io/pypi/status/pytap2.svg https://img.shields.io/pypi/pyversions/pytap2.svg

Fork of PyTap that supports Python 3.

Requirements

The ifconfig command line utility must be installed for pytap2 to operate.

To install ifconfig on Debian/Ubuntu:

$ sudo apt install net-tools

To install ifconfig on RHEL/Rocky Linux/Fedora:

$ sudo yum install net-tools

Installation

You can install, upgrade, and uninstall pytap2 with these commands:

$ pip install pytap2
$ pip install --upgrade pytap2
$ pip uninstall pytap2

Usage

Using as a context manager automatically brings up the device and closes it at the end of the with block.

from pytap2 import TapDevice

with TapDevice() as device:
    device.ifconfig(mtu=1300)
    device.write(b'0000')

Or manually call up() and close().

from pytap2 import TapDevice

device = TapDevice()
device.up()
device.ifconfig(mtu=1300)
device.write(b'0000')
device.close()

The fileno() method is defined, so that the device object can be passed directly to select().

Releases

2.3.0 - 2023-04-28

  • Drop Python 3.7 and support Python 3.11

  • Support Mypy type checking for users

2.2.0 - 2021-11-06

  • Drop Python 3.6 and support Python 3.10.

  • Document dependency on ifconfig

2.1.0 - 2020-12-30

  • Drop Python 3.5 and support Python 3.9.

  • Switch to GitHub Actions for CI.

2.0.0 - 2020-03-29

  • Drop Python 2.7.

1.6.0 - 2019-12-15

  • Drop Python 3.4 and support Python 3.8.

  • Include license file.

1.5.0 - 2018-07-09

Support Python 3.7.

1.4.0 - 2017-10-24

Allow disabling packet information header (IFF_NO_PI) and default read() to read entire MTU worth of data plus the packet information header if present.

1.3.0 - 2017-07-31

Add fileno() method to support select() calls.

1.2.0 - 2017-06-19

Context manager support added.

1.1.0 - 2017-06-17

Allow read() to be called with a specific number of bytes to read.

1.0.0 - 2017-06-16

Initial release that supports Python 2 and 3.

Metadata

Release files for pytap2 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytap2 2.3.0
File Size Uploaded Provenance Actions
pytap2-2.3.0.tar.gz 6.3 kB Without provenance Details for pytap2-2.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytap2 2.3.0
File Interpreter ABI Platform Actions
pytap2-2.3.0-py3-none-any.whl Python 3 none any Details for pytap2-2.3.0-py3-none-any.whl

Total release size: 12.2 kB

Release files / pytap2-2.3.0.tar.gz

Download URL pytap2-2.3.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5a90d7b7c7107a438e53c7b27c1baadffe72889ada6024c02d19801fece2c383
BLAKE2b-256 checksum
How to use checksums
7d4ab554c4bd7c38a3a407ecb50627088e1147ff11ca02f66af36b8c3fbc6c91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release files / pytap2-2.3.0-py3-none-any.whl

Download URL pytap2-2.3.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1edc287cf25c61f8fa8415fb6b61e50ac119ef5cd758ce15f2105d2c69f24ef
BLAKE2b-256 checksum
How to use checksums
d21214dc51cc7191ec3e80cedb4bdc92509145b4fe1f4d4ec1892cb12c268ade
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Security for pytap2 2.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page