Skip to content

Add .gitignore for Python build and tooling artifacts - #53

Open
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:chore/gitignore-python-artifacts
Open

Add .gitignore for Python build and tooling artifacts#53
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:chore/gitignore-python-artifacts

Conversation

@elhoim

@elhoim elhoim commented Aug 31, 2026

Copy link
Copy Markdown
Member

Problem

The repository has no .gitignore. Routine local activity — running the CLI, running pytest, building a distribution, or invoking a linter — leaves __pycache__/, *.pyc, .pytest_cache/, dist/, *.egg-info/ and similar artifacts in the working tree as untracked files.

That has two costs: git status is noisy to read before a commit, and a git add -A or git commit -a will happily sweep build artifacts into a commit. Committed bytecode is version- and platform-specific (cli.cpython-314.pyc), so it is never useful to anyone else and pollutes history permanently.

Change

Adds a standard Python .gitignore covering:

  • bytecode — __pycache__/, *.py[cod]
  • packaging output — build/, dist/, *.egg-info/, .eggs/
  • test and coverage output — .pytest_cache/, .tox/, .coverage*, htmlcov/
  • type-checker and linter caches — .mypy_cache/, .ruff_cache/, .pytype/
  • virtualenvs — .venv/, venv/, ENV/
  • editor/OS cruft and merge leftovers — .idea/, .vscode/, .DS_Store, *.swp, *.orig, *.rej

No source file is touched and nothing is removed — the repository's tracked tree and its history are both already free of build artifacts, so this is purely preventative.

Verification

  • Nothing already tracked becomes ignored: git ls-files -i -c --exclude-standard returns empty, so no existing file is silently dropped from version control by these patterns.
  • The patterns actually work: created bin/__pycache__/cli.cpython-314.pyc, .pytest_cache/, dist/pkg.whl, .coverage, .DS_Store and foo.orig, then confirmed git status --porcelain --untracked-files=all reports a clean tree.
  • Source is unaffected: all 8 previously tracked files remain tracked, and python bin/cli.py --help still exits 0.

Note on overlap

PR #18 (pytest suite + CI) includes a minimal 3-line .gitignore as a side effect of needing one. This PR supersedes it with the full set. Whichever merges first, the other needs only a trivial conflict resolution on that one file — no code is involved either way.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DYX4TKA5inzByJ4qGWKjqh

The repository has no .gitignore, so routine local activity (running the
CLI, pytest, a build, or a linter) leaves __pycache__/, *.pyc, .pytest_cache/,
dist/ and similar artifacts showing as untracked files. That makes it easy to
commit them by accident and noisy to review 'git status'.

Adds a standard Python .gitignore covering bytecode, packaging output, test and
coverage output, type-checker and linter caches, virtualenvs, editor/OS cruft,
and merge leftovers.

Verified that no currently tracked file matches any of the new patterns
(git ls-files -i -c --exclude-standard is empty), so nothing already in the
repository becomes ignored.
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.

1 participant