Skip to main content

Crispy is a simple command line argument parser, ready to be integrated to any project of any size!

Project description

crispy Test crispy Upload Python Package

crispy is my take on parsing command-line arguments. It is a dead simple tool that allows you to define your own keys for systematically gathering variables.

In just 5 simple steps, you can start parsing any complicated user input into a dictionary—simple and predictable. It can't get more versatile than that, can it?

Capabilities

Feature Support Version
String, integer, float, and boolean type arguments v1.0.0
Custom exceptions for tracking user errors in input v1.0.0
Custom subcommands v2.0.0
Positional arguments v2.1.0
Treating quoted strings as single input in parse_string() TO DO ...

Usage

  1. To start using crispy-parser in your projects, install it from PyPI:
$ pip install crispy-parser
  1. Import the parser into your source code:
from crispy.crispy import Crispy
  1. Add your arguments:
c = Crispy()
c.add_variable("name", str)
c.add_variable("age", int)
c.add_variable("salary", float)
  1. Throw any user-inputted string or argument list at it!
result = c.parse_string("--name John -a=21 --salary=30000.45")
print(result)

{'name': 'John', 'age': 21, 'salary': 30000.45}

Or parse sys.argv:

arguments = c.parse_arguments(sys.argv[1:])
print(arguments)

{'message': 'message.txt', 'targets': 'targets.txt', 'url_format': 'api.txt'}

Contributing

I welcome contributions to enhance and improve this library! Whether you want to fix a bug, add a new feature, or suggest an improvement, your contributions are highly appreciated.

Just so you know, by contributing to this project, you agree to license your contributions under the same license governing this library. If you're unsure or have questions about the contribution process, please get in touch with me by opening an issue.

Credits

Feel free to contact me for collaboration on anything!

Ferit Yiğit BALABAN, <fyb@fybx.dev>

My WebsiteMy BentoXLinkedIn

2023

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

crispy-parser-2.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

crispy_parser-2.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file crispy-parser-2.1.0.tar.gz.

File metadata

  • Download URL: crispy-parser-2.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for crispy-parser-2.1.0.tar.gz
Algorithm Hash digest
SHA256 0660dfac2596a07a2973081d367c64a3e0c5662942b7fa9cc312864cb40b3a98
MD5 c12c9f03c2dba4ec518b3aa63745bc88
BLAKE2b-256 6937540270bcbeef29aed0c7fe8a5bc4a7719c6214074855a30474cb08d04e61

See more details on using hashes here.

File details

Details for the file crispy_parser-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: crispy_parser-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for crispy_parser-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2202c6902e9d52be5dbcc2b5046633e60f3db94193363dd9564a31df076d517
MD5 d01d1c7f435eb2a1a65fcebfaed2121e
BLAKE2b-256 b7e96ac7d51bdc4ef5508de5b07b1675c8cbb980245c05dadd2ad1398345e7de

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