Skip to main content

netifaces (2)

1. What is this?

The original netifaces was abandonned by it's maintainer, leaving us without the option to get network addresses of any kind in Python. Unfortunately, the original sources are more akin to arcane magic, so picking where it's been left off is a difficult task.

I decided to rewrite netifaces, keeping the almost exact same API and adding the following:

  • Support for future python versions
  • Type annotations
  • Maybe a more "queriable" API in the future

This project aims to be a drop-in replacement for those project who use netifaces, but I do not guarantee anything.

1.1 What is not working right-now

  • The gateways API is only working if your system has a /proc/net/route file or the ip tool
  • The windows gateways API is non-functional

2. Usage

For now the API is the same as the original netifaces, so please refer to it.

Install:

pip install netifaces2

Import:

>>> import netifaces
>>> netifaces.interfaces()  
    ...
>>> netifaces.ifaddresses('en0')
    ...
>>> netifacs.gateways()
    ...

3. API differences between this and al45tair/netifaces

gateways

The gateways function does not support indexing through the default special key. This is because it makes a sane typing definition difficult to write and be understandable. Instead, if you want the same functionality, the following is exposed:

>>> netifaces.default_gateway()
    ...

The result will be the default gateway for each interface type. The result may be an empty dict if no default route is set.

The level of completness differs a little bit with the original version; some address families might not yet be available and PEER addresses are not reported for now. If you need a feature, open an issue and I will do my best to add it.

Gateways also returned the interfaces indexed by integer values. This is a bit odd (IMO) since the integers values for the interface types are system-dependent. Enum values with a more semantic meaning are now used (they are still tied to linux numbers), but you can use old_api=True in their call to get the al45air-style keys back.

AF_ Constants

In the previous version of netifaces the AF_ constants' value were assigned to be platform independent. This has the nice effect of abstracting the OS when accessing the information of a network layer. However after consideration, it does not feel like the right place to provide abstraction. If you update your project's dependencies to this version of netifaces, be wary of this change. For instance, on linux you may need to replace AF_LINK with AF_PACKET to get mac addresses.

In the future, an extra API will allow accessing a specific layer's information by querying for it, without using the platform's constant.

4. Platform support

Wheels

Building Linux, Windows and macOS cp37-abi3 wheels (requires Python 3.7 and newer)
Install using pip:
python -m pip install netifaces2

Linux

Linux cp37-abi3 wheels are built on manylinux2_17 aka manylinux2014 and require pip>=19.3
cp36m-manylinux2_17 wheels are unsupported and are being built only as a fallback for systems with only Python 3.6 available.

5. License

This software is distributed under a MIT license.

6. Developing Locally

To set up for local development, you will first need to install Rust from rustup.

It's then recommended to create a virtual environment and install the package plus its dependencies into it:

$ python3 -m venv venv
$ source venv/bin/activate (or .\venv\Scripts\activate.ps1 with Windows Powershell)
$ python3 -m pip install -e '.[dev]' # This internally runs the Rust compiler
$ python3 -m pip install pre-commit
$ source venv/bin/activate # Re-source the venv to pick up new scripts
$ pre-commit install

To recompile the rust code after making changes, run:

$ python3 -m pip install -e .

again.

Metadata

Release files for netifaces2 0.0.22

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

Source distribution (sdist)

Source distribution for netifaces2 0.0.22
File Size Uploaded
netifaces2-0.0.22.tar.gz 21.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for netifaces2 0.0.22
File
netifaces2-0.0.22-cp37-abi3-win_amd64.whl CPython 3.7 abi3 Windows x86-64 Details
netifaces2-0.0.22-cp37-abi3-musllinux_1_1_x86_64.whl CPython 3.7 abi3 Linux musl 1.1+ x86-64 Details
netifaces2-0.0.22-cp37-abi3-musllinux_1_1_i686.whl CPython 3.7 abi3 Linux musl 1.1+ x86-32 Details
netifaces2-0.0.22-cp37-abi3-musllinux_1_1_armv7l.whl CPython 3.7 abi3 Linux musl 1.1+ ARMv7l Details
netifaces2-0.0.22-cp37-abi3-musllinux_1_1_aarch64.whl CPython 3.7 abi3 Linux musl 1.1+ ARM64 Details
netifaces2-0.0.22-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 abi3 Linux glibc 2.17+ x86-64 Details
netifaces2-0.0.22-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.7 abi3 Linux glibc 2.17+ IBM System/390x Details
netifaces2-0.0.22-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.7 abi3 Linux glibc 2.17+ PowerPC 64-le Details
netifaces2-0.0.22-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl CPython 3.7 abi3 Linux glibc 2.17+ PowerPC 64-be Details
netifaces2-0.0.22-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.7 abi3 Linux glibc 2.17+ x86-32 Details
netifaces2-0.0.22-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.7 abi3 Linux glibc 2.17+ ARMv7l Details
netifaces2-0.0.22-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.7 abi3 Linux glibc 2.17+ ARM64 Details
netifaces2-0.0.22-cp37-abi3-macosx_10_12_x86_64.whl CPython 3.7 abi3 macOS 10.12+ x86-64 Details
netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ IBM System/390x Details
netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ PowerPC 64-le Details
netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ ARM64 Details

Total release size: 17.1 MB

Release files / netifaces2-0.0.22.tar.gz

Download URL netifaces2-0.0.22.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c872a54e1a0e2bf078593b4460013996de804e40cab1b0ebc377b0e74b52a244
BLAKE2b-256 checksum
How to use checksums
19408818b20a921c39fc6d6a508f180b9ae97e35b90a8d8b91d64db54f625225
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-win_amd64.whl

Download URL netifaces2-0.0.22-cp37-abi3-win_amd64.whl
Size 138.1 kB
Tags CPython 3.7 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c31ef56334aa73d0cb81d49e7a9bc3cdd8822e566594038b76c27eaf0334ea6d
BLAKE2b-256 checksum
How to use checksums
dfc05b5c33aae4d07a4292bc6c4159222d04a1dbc4907d20863a8800e6f20ffd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-musllinux_1_1_x86_64.whl

Download URL netifaces2-0.0.22-cp37-abi3-musllinux_1_1_x86_64.whl
Size 1.2 MB
Tags CPython 3.7 Linux musl 1.1+ x86-64 abi3
SHA-256 checksum
How to use checksums
a203a34be5976a747777add600d3d9942bd87b8252bbb7d250273ec4f23744f4
BLAKE2b-256 checksum
How to use checksums
6e55290a663e7334cce09d87e70d7c162e9141fe9ea7eb0861594ec3774babe4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-musllinux_1_1_i686.whl

Download URL netifaces2-0.0.22-cp37-abi3-musllinux_1_1_i686.whl
Size 1.2 MB
Tags CPython 3.7 Linux musl 1.1+ x86-32 abi3
SHA-256 checksum
How to use checksums
db607a05fa9e7b4791649b83bdc260dcc2f1082e502e6c9e22eb3853a5ff1485
BLAKE2b-256 checksum
How to use checksums
155154ecfb98ccacad6ff9353c3267bdea60e2cd27179440f00dc25e76b51486
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-musllinux_1_1_armv7l.whl

Download URL netifaces2-0.0.22-cp37-abi3-musllinux_1_1_armv7l.whl
Size 1.3 MB
Tags CPython 3.7 Linux musl 1.1+ ARMv7l abi3
SHA-256 checksum
How to use checksums
03151c24171e6da9079e5abcd303f3e0d8ac275a8fe4e178f82fdf1590f989e4
BLAKE2b-256 checksum
How to use checksums
527a63c6607f5b12c2367d8bc37025bde067ec8eecad9b97c8d8c39eadd1411b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-musllinux_1_1_aarch64.whl

Download URL netifaces2-0.0.22-cp37-abi3-musllinux_1_1_aarch64.whl
Size 1.2 MB
Tags CPython 3.7 Linux musl 1.1+ ARM64 abi3
SHA-256 checksum
How to use checksums
e24c4089c743ad61c59e988d2c2de9ba2c91f1dccaecd57cf1d03c4414946a8f
BLAKE2b-256 checksum
How to use checksums
77883e250f667ae24f8e30a651a938a27d8281e6e3c818b70e1151ba6a25654d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL netifaces2-0.0.22-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.0 MB
Tags CPython 3.7 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
043ddcd4b09f9b8e86c2bd54214a90904c2fec8869d0cfd295c671c2f4cb27b3
BLAKE2b-256 checksum
How to use checksums
d4e9fcbf4c0e84037e072364696927e6e12d78ce69c93eaaf9b382b8655bbdc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL netifaces2-0.0.22-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 1.1 MB
Tags CPython 3.7 Linux glibc 2.17+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
69689cf211d17968e020582ddf3b023b0b956c003571e088a86ad21e27b678d9
BLAKE2b-256 checksum
How to use checksums
0e56f9ef7fcfa04ed4dcf0a5b631f82d131ddc9fe3df7c457a52f20fb21e0682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL netifaces2-0.0.22-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 1.1 MB
Tags CPython 3.7 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
c0f59974328a3481eb0b3264a1cb479f2058cc8f09a3a0097a24d306fd59ec5e
BLAKE2b-256 checksum
How to use checksums
83a2a534c8362e8ac9c23497496eef39f193de37c1e10b3781bc5b3d54f9893e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl

Download URL netifaces2-0.0.22-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Size 1.1 MB
Tags CPython 3.7 Linux glibc 2.17+ PowerPC 64-be abi3
SHA-256 checksum
How to use checksums
47d15b7235804e4b506298d757856c97e9d969be9cf91642581bf314f98cdefa
BLAKE2b-256 checksum
How to use checksums
e5e3c6b0840e163d2b97e49029d90674eeb1cd41308bc47acae7f27906e28ec5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL netifaces2-0.0.22-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 1.0 MB
Tags CPython 3.7 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
150804d34f1a97d07ec7032573561267e1753c30670df5e32021a2cf4e3f76b5
BLAKE2b-256 checksum
How to use checksums
b2f1acf33b20232e4bceb838712ab42294d1a4a658f4ed1d4176596ea8d2d5db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL netifaces2-0.0.22-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 1.0 MB
Tags CPython 3.7 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
e1393ddecc35fcbb5ca89c90783ef44c1cae3f93b60bbdcb2e2ebd20783b9e06
BLAKE2b-256 checksum
How to use checksums
361d4dfb25228d9047ae9bc2f72f14260ffdc6a72b436dc1af6c954e50d45cce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL netifaces2-0.0.22-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.0 MB
Tags CPython 3.7 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
2f6fa1ca50ede5d148a9c378ab08e093418666b58353a2fe31b02d772f568231
BLAKE2b-256 checksum
How to use checksums
bacb78613bbabe140763fa5ffb9e9098c35c74440b091a21025ad4acc8e6c2a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp37-abi3-macosx_10_12_x86_64.whl

Download URL netifaces2-0.0.22-cp37-abi3-macosx_10_12_x86_64.whl
Size 251.0 kB
Tags CPython 3.7 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4b7073aabee570466373e312b7f92a81e669f2462051eaefafb8a3d9ba078a35
BLAKE2b-256 checksum
How to use checksums
9f8adce8b32aad8d2d338c75590656c270214a89d7a41df9b8b936d0c5d31438
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.0 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
eb4ac86acfe2f23522c2b5d1bed097e810dbbe4a5bd829528e5db52a83290e52
BLAKE2b-256 checksum
How to use checksums
9bd01488316a79bf66c3c614b9790265393f41bce72d1cc4bd9e2d759bca4de1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 1.1 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ IBM System/390x
SHA-256 checksum
How to use checksums
e9a880fd3fe76bc5fb040ccafee40f752300ef6349fd7c4c6e66151763b224f8
BLAKE2b-256 checksum
How to use checksums
6cdfe211e1286f9c81bfbd6df04ef576b9e78d627499df64ec3c18ba1ebbebb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 1.1 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ PowerPC 64-le
SHA-256 checksum
How to use checksums
81bf88e39ced999d66fff6db5c0dd70c532af18558b3e37da7cda70b6a52f842
BLAKE2b-256 checksum
How to use checksums
7d95a7b6d8c13bf8db3ec8dac46b1250fa36b9e7fce8ebfcde7d1ae255e7ae31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL netifaces2-0.0.22-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.0 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
b7bd4e11cb72d3c182b0b532a5c39d3945a35258cdade2ebaac55ab8ff3ba0e6
BLAKE2b-256 checksum
How to use checksums
f04f15c985e5260e5efc13e4642d5641c45dfbdacf4536d8d5c1201ce647e19f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8
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