Skip to content

Commit

Permalink
updated packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
COUR4G3 committed May 25, 2024
1 parent 6889907 commit d1ca91b
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 109 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ ENV/

# Rope project settings
.ropeproject

# setuptools-scm versioning
_version.py
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Michael de Villiers
Copyright (c) 2024 Michael de Villiers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# python-pppd

Simple library for controlling PPP connections with pppd.

Under the hood it uses the `subprocess` module to interact with `pppd` to create and disconnect PPP
connections.


## Installation

Make sure `pppd` is installed on your system, typically on Ubuntu/Debian:

$ apt-get install pppd


And on Fedora/CentOS/RedHat:

$ dnf install pppd


Then you can install the latest release from PyPi:

$ pip install python-pppd


Alternatively, clone and install the latest development version from GitHub:

$ git clone https://github.com/cour4g3/python-pppd
$ cd python-pppd
$ pip install -e .


## Getting Started

You can connect to an existing configured PPP connection:

.. code:: python

>>> from pppd import PPPConnection
>>> ppp = PPPConnection(call='work') # blocks until connected
>>> ppp.connected() # check if connected, raises error if connection error
True
>>> ppp.laddr # address of local host
'10.0.0.1'
>>> ppp.raddr # address of remote client
'10.0.0.2'


You can specify any positional or keyword arguments:

.. code:: python

PPPConnection('/dev/ttyS0', connect='/usr/bin/chat -v -f /etc/chatscripts/A1')


Which is equivalent to the following:

$ sudo pppd /dev/ttyS0 connect "/usr/bin/chat -v -f /etc/chatscripts/A1"


Normally you require `sudo` to use `pppd`, if you don't have it and have setup
the `pppd` binary with setuid-root or are running as root you can use:

.. code:: python

PPPConnection(sudo=False)


You can also specify an alternate paths to `pppd` or `sudo` if the libary cannot
find them:

.. code:: python

PPPConnection(sudo_path='/usr/local/bin/sudo', pppd_path='/usr/local/sbin/pppd')


License
=======

Licensed under the MIT license.
72 changes: 0 additions & 72 deletions README.rst

This file was deleted.

11 changes: 10 additions & 1 deletion pppd.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@

from subprocess import Popen, PIPE, STDOUT

__version__ = '1.0.5'
try:
from importlib.metadata import version
except ImportError:
from importlib_metadata import version

try:
__version__ = version("python-pppd")
except:
__version__ = "0.1-dev0"


PPPD_RETURNCODES = {
1: 'Fatal error occured',
Expand Down
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[project]
name = "python-pppd"
description = "Simple library for controlling PPP connections with pppd."
readme = "README.md"
license = { text = "MIT" }
authors = [{name = "Michael de Villiers", email = "michael@devilears.co.za"},]
maintainers = [{name = "Michael de Villiers", email = "michael@devilears.co.za"},]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Topic :: System :: Networking",
]
dynamic = ["version"]
requires-python = ">= 3.6"

[project.urls]
Homepage = "https://github.com/COUR4G3/python-pppd/"
"Source Code" = "https://github.com/COUR4G3/python-pppd/"
"Issue Tracker" = "https://github.com/COUR4G3/python-pppd/issues/"

[build-system]
requires = [
"setuptools>=64.0",
"setuptools_scm[toml]>=6.2",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.bandit]
exclude_dirs = [".github"]
skips = ["B101"]

[tool.setuptools]
py-modules = ["pppd"]

[tool.setuptools_scm]
write_to = "_version.py"
35 changes: 0 additions & 35 deletions setup.py

This file was deleted.

0 comments on commit d1ca91b

Please sign in to comment.