Skip to content

Conversation

@Daraan
Copy link
Contributor

@Daraan Daraan commented Nov 29, 2025

Ignoring attributes is a feature that has been wished for multiple times, with some proposed solutions.

For example, see

While the idea is still in the making I want to propose an addition to the docs that list a limited workaround how attributes can be typed and still ignored by tap if one used private attributes with type comments.

from typing import ClassVar
from tap import Tap

class MyTap(Tap):
    # Regular arguments (will be parsed)
    package: str
    stars: int = 5
    
    _not_ignored: str = "visible"

    # Ignored attributes (will not be parsed - must be private)
    _internal_counter = 0  # type: int
    _class_variable = "DEFAULT"  # type: ClassVar[str]

args = MyTap().parse_args(["--help"])
usage: ipython --package PACKAGE [--stars STARS] [--_not_ignored _NOT_IGNORED] [-h]

options:
  --package PACKAGE     (str, required)
  --stars STARS         (int, default=5)
  --_not_ignored _NOT_IGNORED
                        (str, default=visible)
  -h, --help            show this help message and exit

Further some slight corrections in the markdown

@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.45%. Comparing base (2e18dc8) to head (2b7cb09).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #170   +/-   ##
=======================================
  Coverage   94.45%   94.45%           
=======================================
  Files           4        4           
  Lines         721      721           
=======================================
  Hits          681      681           
  Misses         40       40           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Daraan Daraan mentioned this pull request Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants