Skip to main content

cls-clear: clear your terminal the lazy way

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 at those who have the cls command hardwired into their muscle memory, and want to use it in a python interactive session as well. Below is a simple comparison; 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
>>> clear ↵ # 6 keypresses => 25% shorter

Life-changing stuff, I know.

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.

Metadata

Release files for cls-clear 1.0.3

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

Source distribution (sdist)

Source distribution for cls-clear 1.0.3
File Size Uploaded
cls_clear-1.0.3.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cls-clear 1.0.3
File Interpreter ABI Platform
cls_clear-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / cls_clear-1.0.3.tar.gz

Download URL cls_clear-1.0.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
570b43fe2c7847f394edbbc00f38f264871ca928d101085ecaccae4af977a3ee
BLAKE2b-256 checksum
How to use checksums
1adf98f8a51211d677be83fcf5975dc34aae3a7f964a7215fa14eddccd495d11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / cls_clear-1.0.3-py3-none-any.whl

Download URL cls_clear-1.0.3-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ba4ad48413178fce057ad2d09ab5c7643acd24fb6bae3aa5259a19520c5d7e3
BLAKE2b-256 checksum
How to use checksums
b32ecd88030b35c5a9464d63f305cf68a1571b8d0f5ecc32490f3ee4ac5c4ea4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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