Skip to main content

NoPrint

Python package PyPI Code style: black pylint NoPrint

About

Do not allow prints in your python code anymore. Official repository of NoPrint package. Packages are scanned recursively.

Output readout

Visible always:

  • Critical info - if import of one of your modules results with an exception (or is missing - maybe you mistyped your package?).
  • Final result (success, prints detected or critical error)

Verbosity options for -v:

  • Outputs which modules contain print statements at which lines
  • Warning when any of your submodules are missing __init__.py files (reported always as warnings)
  • Receive a warning if one of packages that's being analysed is out of system's scope - it will still be scanned, but that "package" is not reachable outside of that directory, these are e.g. tests directories
  • Receive a warning if one of your packages is overshadowing a package available on system/environment level, e.g. if you have requested to analyse your test directory, but Python already has an internal package called test

Verbosity options for -vv (or -v -v on older Python versions):

  • All the options from -v
  • NoPrint will tell you specifically which of your submodules are clear of print statements

Requirements

There's NONE! You can use this package to your heart's content. Unless you'd like to develop for it, for this you'll need Black, Pylint and Pytest along with Pytest-cov.

Installation

Pull straight from this repo to install manually or just use pip: pip install noprint will do the trick.

Usage

Use as command:

usage: NoPrint [-h] [-e] [-f] [-v] [--version] packages [packages ...] [-m [MULTI]]

Do not allow prints in your code.

positional arguments:
  packages              which packages/modules to check, syntax: <package>[.<module> ...], e.g. noprint or noprint.cli

options:
  -h, --help            show this help message and exit
  -e, --error-out       exit with error when print is found (by default only warnings are shown)
  -f, --first-only      finish on first print found
  -v, --verbose         provide more analysis information (use multiple v's to increase logging level)
  -m [MULTI], --multi [MULTI]
                        set how many threads to use
  --version             show program's version number and exit

Thank you for using NoPrint

Multithreading

Provide number of threads after -m parameter. Default's to 1 if not provided or provided without specific number. If 0 or less is given then it will use number of available vCPUs reported by multiprocessing library.

Example in Makefile:

(venv) root@/DummyProject# make test
{ \
        . venv/bin/activate && \
        noprint -evvm 0 tp && \
        echo "Finished!" ; \
}
[CLEAR]:[tp.exceptions]
[CLEAR]:[tp.logger]
[CLEAR]:[tp.cli]
[ERROR]:[tp] Line: 4
[ERROR]:[tp.submodule] Line: 20
[ERROR]:Print statements detected
make: *** [Makefile:4: test] Error 1

This package performs recursive tests on itself before being merged - you can check suggested usage in Makefile.

Development

If you'd like to develop for this package (for some reason) then it's rather straightforward. On Windows start init.bat command (WSL2 required). This will install a local WSL2 image with small Ubuntu environment and set up virtual environment for you. If you're already using Unix-based system, you can just use init.sh as that will create Python virtual environment.

Before creating Pull Request, make sure that your tests are passing. This is a small package, so I want to maintain 100% coverage - # pragma: no cover is only allowed in very specific scenarios (like single line method wrapper).

Want to show off?

Feel free to drop this badge into your repo. Glad to have you onboard.

<a href="https://github.com/rgryta/NoPrint"><img alt="NoPrint" src="https://img.shields.io/badge/NoPrint-enabled-blueviolet"></a>

Metadata

Release files for noprint 3.1.1

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

Source distribution (sdist)

Source distribution for noprint 3.1.1
File Size Uploaded
noprint-3.1.1.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for noprint 3.1.1
File Interpreter ABI Platform
noprint-3.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / noprint-3.1.1.tar.gz

Download URL noprint-3.1.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7273fd18162b54fa9894dc97f949837e47ed22dc17dfe17b609585e1acfa6598
BLAKE2b-256 checksum
How to use checksums
9e071683c71bdd974aceae6dd0cd5e61e5b48387ada234455b5d7717140be665
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / noprint-3.1.1-py3-none-any.whl

Download URL noprint-3.1.1-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca3dda07257e546314e5dbdf545c31fe78f275c09d27ed67a5f83b0b325db3b7
BLAKE2b-256 checksum
How to use checksums
0cf8b1aa71677bd7c6945fa6ae58e1262f073d83ca846c1b8c2fd6a8853e9bb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

3.1.1 This release

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.1.1

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