💻 System Module

The System module provides a collection of utilities for interacting with the operating system. It includes commands, directories, files, environment variables, paths, processes and operating system information.

Supported Features
  • Run Shell Commands
  • Create & Remove Directories
  • Create & Remove Files
  • Environment Variables
  • Operating System Information
  • Path Utilities
  • Process Information

🚀 Quick Example

Execute a shell command.

💻 Code

import allkitpy

result = allkitpy.system.command.run(
    "python --version"
)

print(result["stdout"])

📤 Output

Python 3.13.5

📚 Functions


⚙️ command.run()

Execute a shell command and return its output.

💻 Code

import allkitpy

result = allkitpy.system.command.run(
    "dir"
)

print(result["stdout"])

📤 Output

Directory listing...

📁 directory.create()

Create a new directory. Parent folders are created automatically if needed.

💻 Code

import allkitpy

allkitpy.system.directory.create(
    "Projects"
)

📤 Output

Projects/

🗑️ directory.remove()

Delete a directory and all of its contents.

💻 Code

import allkitpy

allkitpy.system.directory.remove(
    "Projects"
)

📤 Output

Projects removed

📂 directory.list()

Return the names of files and folders inside a directory.

💻 Code

import allkitpy

items = allkitpy.system.directory.list(
    "Documents"
)

print(items)

📤 Output

[
    "notes.txt",
    "report.pdf",
    "images",
    "backup"
]

🌱 env.get()

Retrieve the value of an environment variable.

💻 Code

import allkitpy

username = allkitpy.system.env.get(
    "USERNAME"
)

print(username)

📤 Output

John

⚙️ env.set()

Create or update an environment variable for the current Python process.

💻 Code

import allkitpy

allkitpy.system.env.set(
    "APP_MODE",
    "Development"
)

📤 Output

Environment variable updated

📋 env.all()

Return all available environment variables as a dictionary.

💻 Code

import allkitpy

variables = allkitpy.system.env.all()

print(variables)

📤 Output

{
    "PATH": "...",
    "USERNAME": "John",
    "TEMP": "C:\\Temp",
    ...
}

📄 file.create()

Create an empty file.

💻 Code

import allkitpy

allkitpy.system.file.create(
    "notes.txt"
)

📤 Output

notes.txt created

🗑️ file.remove()

Delete a file if it exists.

💻 Code

import allkitpy

allkitpy.system.file.remove(
    "notes.txt"
)

📤 Output

notes.txt removed

💻 os.system()

Return the name of the current operating system.

💻 Code

import allkitpy

print(
    allkitpy.system.os.system()
)

📤 Output

Windows

🖥️ os.release()

Return the operating system release.

💻 Code

import allkitpy

print(
    allkitpy.system.os.release()
)

📤 Output

11

🧩 os.version()

Return the detailed version of the current operating system.

💻 Code

import allkitpy

version = allkitpy.system.os.version()

print(version)

📤 Output

10.0.26100

🖥️ os.machine()

Return the machine architecture of the current computer.

💻 Code

import allkitpy

machine = allkitpy.system.os.machine()

print(machine)

📤 Output

AMD64

⚡ os.processor()

Return information about the processor being used.

💻 Code

import allkitpy

cpu = allkitpy.system.os.processor()

print(cpu)

📤 Output

Intel64 Family 6 Model 165

🐍 os.python_version()

Return the version of Python currently running your program.

💻 Code

import allkitpy

print(
    allkitpy.system.os.python_version()
)

📤 Output

3.13.5

📂 path.exists()

Check whether a file or directory exists.

💻 Code

import allkitpy

exists = allkitpy.system.path.exists(
    "report.pdf"
)

print(exists)

📤 Output

True

📍 path.absolute()

Return the absolute path of a file or directory.

💻 Code

import allkitpy

path = allkitpy.system.path.absolute(
    "report.pdf"
)

print(path)

📤 Output

C:\Users\User\Documents\report.pdf

📁 path.parent()

Return the parent directory of a file or folder.

💻 Code

import allkitpy

parent = allkitpy.system.path.parent(
    "Documents/report.pdf"
)

print(parent)

📤 Output

Documents

📄 path.filename()

Return the filename from a file path.

💻 Code

import allkitpy

name = allkitpy.system.path.filename(
    "Documents/report.pdf"
)

print(name)

📤 Output

report.pdf

🏷️ path.extension()

Return the extension of a file.

💻 Code

import allkitpy

ext = allkitpy.system.path.extension(
    "report.pdf"
)

print(ext)

📤 Output

.pdf

🆔 process.pid()

Return the Process ID (PID) of the current Python process.

💻 Code

import allkitpy

pid = allkitpy.system.process.pid()

print(pid)

📤 Output

15428

📂 process.cwd()

Return the current working directory of the running Python process.

💻 Code

import allkitpy

cwd = allkitpy.system.process.cwd()

print(cwd)

📤 Output

C:\Users\User\Projects\AllkitPy

📘 Module Summary

The System module provides convenient access to common operating system features through a clean, consistent API. It helps you work with files, directories, paths, environment variables, processes, shell commands, and operating system information without needing to remember multiple standard library modules.

Categories Included
  • ⚙️ Command Execution
  • 📁 Directory Operations
  • 🌱 Environment Variables
  • 📄 File Operations
  • 💻 Operating System Information
  • 📂 Path Utilities
  • 🆔 Process Information