Scope cleaner
An IPython cell magic to remove temporary variables. I wrote this package because I didn't like by global scope to be cluttered with variables I used in 1 cell only during EDA (Exploratory Data Analysis).
Installation
Via pip: pip install scope-cleaner
Usage
Firstly, one needs to import the package: import scope_cleaner.
Then a new magic becomes available: %%cleanup_temporary_vars <optional_prefix>.
Optional prefix is a parameter which helps to filter out the temporary variables introduced in current cell.
If it's not set, the prefix defaults to _.
Example: Consider the following IPython cells:
Cell 2
%%cleanup_temporary_vars tmp
a = 10
b = 15
tmp_1 = 123
tmp_2 = 234
print("tmp", tmp_1, tmp_2) # Out: tmp 123 234
tmp_1 + tmp_2 # Out: 357
So all the variables from current cell work correctly.
Cell 3
a + b # Out: 25
tmp_1 # Error: no such variable
As we can see, the temporary variable was automatically deleted by %%cleanup_temporary_vars in the end of previous cell (because its name starts with tmp).
Metadata
Release files for scope-cleaner 0.1.0.post4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scope_cleaner-0.1.0.post4.tar.gz | 4.4 kB | Without provenance | Details for scope_cleaner-0.1.0.post4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scope_cleaner-0.1.0.post4-py3-none-any.whl | Python 3 | none | any | Details for scope_cleaner-0.1.0.post4-py3-none-any.whl |
Total release size: 9.3 kB
Release files / scope_cleaner-0.1.0.post4.tar.gz
| Download URL | scope_cleaner-0.1.0.post4.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e57f06024e092ec1046283e1397f4b1f0f71bbf5245704a6a812a0d6ae764fc
|
|
BLAKE2b-256 checksum How to use checksums |
40a281a7a5f2829bbebf9aa81ab562ab676aec2711f49d26665003e22b31c3db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.8 Linux/5.19.13-arch1-1
|
Release files / scope_cleaner-0.1.0.post4-py3-none-any.whl
| Download URL | scope_cleaner-0.1.0.post4-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba8c14d7cb465dab78dcab83e266968d404c0b27aac9fd471ef8c0058e6bd7c5
|
|
BLAKE2b-256 checksum How to use checksums |
dfaa56c0b688bdcbcb29e8253ea84f945f7ae705697dce706584bba4900de1eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.8 Linux/5.19.13-arch1-1
|
Security for scope-cleaner 0.1.0.post4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.