Skip to main content

A dataclass generate library for Namespace object generated by argparse

Project description

Fucking Argparse

A dataclass generate library for Namespace object generated by argparse

install

# install via TestPyPI
pip install -i https://test.pypi.org/simple/ fucking-argparse

# install via source
git clone https://github.com/Shadowsight9/fucking-argparse.git
cd fucking-argparse
pip install --editable .

Usage

Step1: insert code

import argparse
# import
from fucking_argparse import gen_codes
parser = argparse.ArgumentParser()
parser.add_argument("--inductor", type=str, default="rule")
parser.add_argument("--group_beam", type=bool, default=False)
parser.add_argument("--mlm_training", type=bool, default=False)
parser.add_argument("--bart_training", type=bool, default=False)
parser.add_argument("--if_then", type=bool, default=False)
parser.add_argument("--task", type=str, default="openrule155")
args = parser.parse_args()

# insert gen_codes function after read and preprocess arguments
gen_codes(args=args, file_path="./arguments.py")
# exit process for modify code to run again
exit()

Step2: add type hint

# import generated arguments file
from arguments import Arguments
# init `dataclass` to replace typeless `Namespace`
args = Arguments()
# enjoy a safe replay process with type hints !
...

Test

cd tests
python -m unittest

Build and publish

cd tests
python -m build
twine upload --repository testpypi dist/*

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

fucking_argparse-0.0.3.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

fucking_argparse-0.0.3-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file fucking_argparse-0.0.3.tar.gz.

File metadata

  • Download URL: fucking_argparse-0.0.3.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for fucking_argparse-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8f8381f747e46b3ef089aa0b8e765fde636e53c1fb32ab13559c814a8dc9b818
MD5 4be8dd58d0e52980a4271d7f6944d6e9
BLAKE2b-256 f6abad7b6877a3977bdf4c8b077c164bff376b466c0275501e77ac592245dbd9

See more details on using hashes here.

File details

Details for the file fucking_argparse-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for fucking_argparse-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 554ecab010cc5a89360e8f3bac0ce094d9d7b5c188f58c5cfb69eee87a024b16
MD5 9fa68f62f02499d2d33426c89ecb7f7b
BLAKE2b-256 c2f65446f4ddef92f892f8affa39e72431bb3da697da2f064062acc4a92a25fa

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