Skip to main content

A tool for keeping track of Python's interactions with the shell.

Project description

Lines of code codecov CodeFactor CodeQL Continuous Integration Contributor Covenant GitHub contributors Documentation Status License Merged PRs OpenSSF Best Practices OpenSSF Scorecard Platforms pre-commit pre-commit.ci Status PyPI - Version PyPI - Downloads Python Version Ruff

NOTICE: After using this package for a few years, we realized we'd attempted to do too many things at once with it. It still provides tremendous functionality for a wide variety of use cases, but for particular corner cases, it became apparent that design decisions made early on were hampering forward progress, and we wouldn't recommend doing things the same way today. Certain aspects of its functionality have inspired more focused packages (reverse-argparse, staged-script), and we hope to do the same with more functionality in the future. For the time being, though, don't expect much development and maintenance here. That said, if you use shell-logger and are eager to contribute to its longevity, let us know.

shell-logger

The shell-logger Python package allows you to interact with the shell, while logging various metadata, statistics, and trace information. Any time you're tempted to write your own wrapper around things like subprocess.Popen() or subprocess.run(), consider using shell_logger.ShellLogger.log() instead. If you're familiar with the Unix script command, this is similar in principle, but with substantially more functionality. If you're familiar with Python's logging module, the motivation is similar, but this intends to capture what's happening in the shell rather than in Python itself.

Installation

To get up and running with shell-logger, simply:

python3 -m pip install shell-logger-sandialabs

Usage

Once the package is installed, you can simply

from shell_logger import ShellLogger
sl = ShellLogger("Title of Log File")
sl.log("Execute my first command in the shell.", "echo 'Hello World'")
sl.finalize()

For more detailed usage and API information, please see our documentation.

Where to Get Help

If you're having trouble with shell-logger, or just want to ask a question, head on over to our issue board. If a quick search doesn't yield what you're looking for, feel free to file an issue.

Contributing

If you're interested in contributing to the development of shell-logger, we'd love to have your help :grinning: Check out our contributing guidelines for how to get started. Past contributors include:

License & Copyright

See LICENSE.md and COPYRIGHT.md.

Credits

Special thanks to the EMPIRE project for investing in the initial development of this tool, and the GMS project for serving as a second user and contributing to its clean-up.

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

shell_logger_sandialabs-3.0.0.tar.gz (173.8 kB view details)

Uploaded Source

Built Distribution

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

shell_logger_sandialabs-3.0.0-py3-none-any.whl (183.5 kB view details)

Uploaded Python 3

File details

Details for the file shell_logger_sandialabs-3.0.0.tar.gz.

File metadata

  • Download URL: shell_logger_sandialabs-3.0.0.tar.gz
  • Upload date:
  • Size: 173.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for shell_logger_sandialabs-3.0.0.tar.gz
Algorithm Hash digest
SHA256 b3ed58fcd0598861e6704c46dfea49255f7cffeaf1f2c3cbbe5b0129b541b71d
MD5 e686454de59caede4d7d45e7d0d281bf
BLAKE2b-256 0f78e417b419e922a033d0f3b8eadeb023483b83a2776e3db26c2db25a48596f

See more details on using hashes here.

Provenance

The following attestation bundles were made for shell_logger_sandialabs-3.0.0.tar.gz:

Publisher: semantic-release.yml on sandialabs/shell-logger

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shell_logger_sandialabs-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for shell_logger_sandialabs-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42879849f1cdc9cb06c6aba599fe0009283043707354a75c21e9eda98ff83543
MD5 9770136bb777c0255e3b927fa4a7c4a3
BLAKE2b-256 8f254de1ff458ffe78e41099e58afe05671c509b3d7f9a188d279baa8029b673

See more details on using hashes here.

Provenance

The following attestation bundles were made for shell_logger_sandialabs-3.0.0-py3-none-any.whl:

Publisher: semantic-release.yml on sandialabs/shell-logger

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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