Skip to main content

A simple program to clear the console screen.

Project description

cls: for t

PyPI - Implementation PyPI - Version PyPI Downloads PyPI - Python Version


Description

This is a simple library that provides a command to clear the terminal screen. I am aware of the existance of the clear module; however, this library is aimed atthose who have hardwired the cls command into their muscle memory, and want to use it in a python interactive session. Keypress count includes the Enter key, visualized as .

>>> from clear import clear  # 24 keypresses
>>> clear()  # 8 keypresses

Versus:

>>> from cls import *  # 18 keypresses => 25% shorter
>>> cls  # 4 keypresses => 50% shorter

Installation and usage

The installation and usage is as easy as pie; just install it via pip:

pip install cls-clear

..and then, in an interactive python session, you can just do as such:

PS C:\Users\belliricc\Data\SomeProject> python
Python 3.12.10 (tags/v3.12.10:0cc8128, Apr  8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from cls import *
>>> cls # This will clear the terminal
>>> clear # This will also clear the terminal

If you try to import the library from a non-interactive session (e.g. a script), it will raise an ImportError, for obvious reasons.

Compatibility

This library is very simple; it was developed and tested on Windows 10 and python 3.12, but it should be good to go with python up till 3.0 (checked with vermin) and non-Windows OSs.

Anyways, any feedback is appreciated and welcome; just open an issue or a pull request and I'll gladly take a look at it.

License is the Unlicense

cls-clear is distributed under the Unlicense, which is a public domain dedication. This means that you can do whatever you want with it, including using it in commercial projects, modifying it, and distributing it.

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

cls_clear-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

cls_clear-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file cls_clear-1.0.0.tar.gz.

File metadata

  • Download URL: cls_clear-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for cls_clear-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f11419abb1389536d420987a1063aed7d22dc9c165e0446fc0155286b2ed79ed
MD5 201af30a1cce2b212484dc200ab598cb
BLAKE2b-256 3c657fa591c1c28a9baa5d64a386b7b711de9fb79e287a54c3bcd85638522d1a

See more details on using hashes here.

File details

Details for the file cls_clear-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cls_clear-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for cls_clear-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8991ad45625a8a5bf50b01c97211d915733869004ac7ca86d8ee5d18f87efad
MD5 15e422e16f8c45f4bb258473e415318e
BLAKE2b-256 c0a74c028082c944e43fa15072ef854506fff08b279585998b312bcfd2bb6237

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