Skip to main content
sultan logo

Command and Rule over your Shell

PyPI Version Travis Build Status MIT License Documentation Status

Sultan now supports Python 2.7+ and 3.0+

Note

Your input is welcome! Please provide your feedback by creating issues on Github

Install

pip install --upgrade sultan

Documentation

Documentation Status

Documentation is available on ReadTheDocs: http://sultan.readthedocs.io/en/latest/

What is Sultan?

Sultan is a Python package for interfacing with command-line utilities, like yum, apt-get, or ls, in a Pythonic manner. It lets you run command-line utilities using simple function calls.

The simplest way to use Sultan is to just call it:

from sultan.api import Sultan
s = Sultan()
s.sudo("yum install -y tree").run()

Runs:

sudo yum install -y tree;

The recommended way of using Sultan is to use it in Context Management mode. Here is how to use Sultan with Context Management:

from sultan.api import Sultan

with Sultan.load(sudo=True) as s:
  s.yum("install -y tree").run()

Runs:

sudo su - root -c 'yum install -y tree;'

What if we want to install this command on a remote machine? You can easily achieve this using context management:

from sultan.api import Sultan

with Sultan.load(sudo=True, hostname="myserver.com") as sultan:
  sultan.yum("install -y tree").run()

Runs:

ssh root@myserver.com 'sudo su - root -c 'yum install -y tree;''

If you enter a wrong command, Sultan will print out details you need to debug and find the problem quickly.

Here, the same command was run on a Mac:

from sultan.api import Sultan

with Sultan.load(sudo=True, hostname="myserver.com") as sultan:
  sultan.yum("install -y tree").run()

Yields:

[sultan]: sudo su - root -c 'yum install -y tree;'
Password:
[sultan]: --{ STDERR }-------------------------------------------------------------------------------------------------------
[sultan]: | -sh: yum: command not found
[sultan]: -------------------------------------------------------------------------------------------------------------------

Want to get started? Simply install Sultan, and start writing your clean code:

pip install --upgrade sultan

If you have more questions, check the docs! http://sultan.readthedocs.io/en/latest/

Metadata

Release files for sultan 0.9.1

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

Built distributions (wheels)

Table of built distributions (wheels) for sultan 0.9.1
File Interpreter ABI Platform
sultan-0.9.1-py3-none-any.whl Python 3 none any Details
sultan-0.9.1-py2-none-any.whl Python 2 none any Details

Total release size: 32.4 kB

Release files / sultan-0.9.1-py3-none-any.whl

Download URL sultan-0.9.1-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05875c5760903cf8b6db35d726cd2d211348b878fc17c89601913a42785b9e00
BLAKE2b-256 checksum
How to use checksums
c9050914520331bbf724fbe6b85fcf25130121170ef07fd75309089f036e99c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release files / sultan-0.9.1-py2-none-any.whl

Download URL sultan-0.9.1-py2-none-any.whl
Size 16.2 kB
Tags Python 2
SHA-256 checksum
How to use checksums
0e4b17cbb3e2d8603916f3993fc9f2c33659933727e01ad54f674691b6ca1731
BLAKE2b-256 checksum
How to use checksums
b8c28a8d792b6bc3e2616be3cb83d50ae906942072622076e8cd71cf6bce61ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.14

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4

2 release files

0.3.1

3 release files

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.1.13

1 release file

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