GithubHelp home page GithubHelp logo

mohammadjarabah681 / unix-shell-with-python Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 3.74 MB

A simple version of UNIX Shell developed using Python and Pytest with awesome open-source technologies.

License: MIT License

Python 100.00%
docstrings figlet linux linux-app linux-shell pytest python python-app python-application python-script python3 type-hint type-hinting type-hints unit-testing unix unix-command unix-shell

unix-shell-with-python's Introduction

UNIX Shell

A simple version of UNIX Shell developed using Python and Pytest with awesome open-source technologies
OverviewPreviewDemoShell CommandsTechnologiesFile StructureSetupTestsLicense

Overview

A simple version of UNIX Shell developed using Python language and Pytest testing framework under the Linux environment with several awesome open-source technologies. The shell can handle both built-in commands and executable files. It is not sophisticated as Bash or Zsh, but it performs similar functions.

The codebase is pretty organized, easier to maintain, and scalable as the project grows (if that happened) due to the clean file structure, clean code, and great documentation. This has been be done with modularity, best practices, documentation, documentation strings, type hinting, and unit testing, which made the codebase easier to debug and maintain, as well as, ensured code correctness.

Preview

UNIX Shell Project Preview

Demo

UNIX Shell Project Demo

Shell Commands

Command Description
ls Lists files and directories in the current location.
cd Changes the current working directory.
pwd Displays full pathname of the current working directory
mkdir Creates a new directory.
touch Creates an empty file or updates the timestamp of an existing file.
clear Clears the terminal screen.
date Displays the current date.
time Displays the current time.
ps Displays information about currently running processes.
echo Prints text or variables to the terminal
pid Displays the shell Process ID (PID).
ppid Displays the shell Parent Process ID (PPID).
info Provides the project documentation.
help Provides information and help about shell commands.
exit Terminates the current shell session.
Executable Files Executes executable files located in the current directory (./) or the parent directory (../).

Technologies

File Structure

This project is structured to facilitate the development and testing of various utilities. The architecture is organized into several directories and files, each serving a specific purpose. Below is a detailed breakdown of the project structure.

File Structure Contents

.
├── app.py
├── requirements.txt
├── requirements-dev.txt
├── LICENSE
├── README.md
├── .gitignore
├── src/
├── tests/
└── .github/

Files Detailed Breakdown

  • app.py file: Contains the main function which serves as the entry point of the application
  • requirements.txt file: Lists the dependencies needed for the application to run in production
  • requirements-dev.txt file: Lists the dependencies needed for development, such as testing frameworks and linters
  • LICENSE file: Specifies the terms and conditions for using and distributing the software
  • README.md file: Provides the project documentation
  • .gitignore file: Specifies intentionally untracked files that Git should ignore

Directories Detailed Breakdown

  • src/ directory: Contains the implementation of various utilities
  • tests/ directory: Contains unit tests for the modules in the src directory
  • .github/ directory: Contains files and directories that customize and enhance the GitHub repository's functionality and appearance

Setup

After cloning this repository, you should following this step-by-step instructions to setup the production environment and run the application locally on your machine.

I. Prerequisites

  1. You need an UNIX-like environment to run this project (e.g. Linux, macOS, or Windows Subsystem for Linux (WSL)).

  2. Update and upgrade packages (for Debian/Ubuntu users).

    sudo apt update && sudo apt upgrade -y
  3. Install Python 3.10 interpreter.

    sudo apt install python3.10
  4. If you are Debian/Ubuntu user, you need to install python3.10-venv package.

    sudo apt install python3.10-venv

II. Creating Virtual Environment

  1. Navigate to the project's root directory.

  2. Create a virtual environment.

    python3.10 -m venv .venv
  3. Activate the virtual environment.

    source .venv/bin/activate
  4. Install production dependencies.

    pip install -r requirements.txt

III. Running Shell Application

  1. Make the app.py file executable.

    chmod +x app.py
  2. Run the shell application (.venv must be activated).

    ./app.py

IV. Exiting Shell Application

  1. Simply close the terminal window or use the exit command to exit the terminal session.

    exit
  2. Deactivate the virtual environment.

    deactivate

Tests

This project uses Pytest for unit testing. Follow the steps below to run the tests.

  1. Navigate to the project's root directory, and activate the virtual environment.

    source .venv/bin/activate
  2. Install development dependencies.

    pip install -r requirements-dev.txt
  3. Run Pytest with basic verbosity on details.

    pytest -v
  4. After the tests finished, deactivate the virtual environment.

    deactivate

License

This project is licensed under the MIT License.

unix-shell-with-python's People

Contributors

mohammadjarabah681 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.