Skip to main content

do automate things on Linux

Project description

auto_everything

Linux(mainly ubuntu) automation

Installation

wget https://github.com/yingshaoxo/auto_everything/raw/master/env_setup.sh
sudo bash env_setup.sh

Magic

wget https://github.com/yingshaoxo/auto_everything/raw/master/demo/install_YouCompleteMe.py
sudo python3 install_YouCompleteMe.py

Get involved

You know, one man's work is kind of boring, so if you have any better way to implement some function, feel free to pull a request.

Basic API

Import

from auto_everything.base import Terminal
t = Terminal()

Run a command & get reply

reply = t.run_command('uname -a')
print(reply)

Run commands & wait until it was finished

commands = """
sudo apt update
uname -a
"""
t.run(commands, wait=True)

Run a program

t.run_program('firefox')

Run a python script

t.run_py('your_python_file_path')

Run a bash script

t.run_sh('your_.sh_file_path')

Detect if a program or script is running

status = t.is_running('terminal')
print(status)

Kill it

t.kill('terminal')

For simplify Python development

Turn Python Class into a Command Line Program

py.fire(your_class_name)

Advanced API

Create(start) or Cancel(stop) a systemd serviece

from auto_everything.base import Super
s = Super(username="root")

s.service("service_name", "your_python_file_path")

System management

Get package list

from auto_everything.base import OS
_os = OS()

python_packages = _os.list_python_packages()
lubuntu_packages = _os.list_packages()

print(python_packages)
print(lubuntu_packages)

Install or Uninstall a Python package

from auto_everything.base import OS
_os = OS()

_os.install_python_package("any_package_name")
_os.uninstall_python_package("any_package_name")

Install or Uninstall a Lubuntu package

from auto_everything.base import OS
_os = OS()

_os.install_package("any_package_name")
_os.uninstall_package("any_package_name")

Anothers

Web automation

from auto_everything.web import Selenium
from time import sleep

my_selenium = Selenium("https://www.google.com", headless=False)
d = my_selenium.driver

# get input box
xpath = '//*[@id="lst-ib"]'
element = my_selenium.wait_until_exists(xpath)[0]

# text inputing
element.send_keys('\b' * 20, "yingshaoxo")

# click search button
element = my_selenium.wait_until_exists('//input[@value="Google Search"]')[0]
element.click() # d.execute_script("arguments[0].click();", element)

# exit
sleep(30)
d.quit()

Simpler IO

from auto_everything.base import IO
io = IO()

io.write("hi.txt", "Hello, world!")
print(io.read("hi.txt"))

io.append("hi.txt", "\n\nI'm yingshaoxo.")
print(io.read("hi.txt"))

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

auto_everything-3.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auto_everything-3.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file auto_everything-3.0.tar.gz.

File metadata

  • Download URL: auto_everything-3.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for auto_everything-3.0.tar.gz
Algorithm Hash digest
SHA256 28c5e5af5832461b456baec668bc261e5e8b9672cdbdd5187bf1b01b2d664753
MD5 72d4889cc961b8d0dc3c62482a35742e
BLAKE2b-256 4a5dbf6c60dc7d4ed6f7457d77cf9d1b4f5577fc98b2ad723223fb747cc8d447

See more details on using hashes here.

File details

Details for the file auto_everything-3.0-py3-none-any.whl.

File metadata

  • Download URL: auto_everything-3.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for auto_everything-3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f80820df93a980717b69bc880500c96e41e00ee88b67990fb49582ee53ecd5dd
MD5 3a996a5bdf6d90820696f1752ae08545
BLAKE2b-256 c6e527bed426a3ae433bec0d4a201e788c18d549804a61108e873cd30af9e34a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page