feat: rename process_name to name in ProcessInfo and related utilities#55
Merged
Merged
Conversation
- Rename ProcessInfo.process_name property to ProcessInfo.name - Rename ProcessInfo.set_process_name() to ProcessInfo.set_name() - Rename get_process_ids_by_process_name() to get_process_ids_by_name() - Rename get_process_id_by_process_name() to get_process_id_by_name() - Update all call-sites across linux, macos, win32 and app layers - Update docs and tests accordingly
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies the public API by removing the redundant process_ prefix from process-name-related identifiers, primarily switching to name across ProcessInfo, lookup utilities, and OpenProcess construction. It also updates cross-platform backends, the GUI dialog, tests, and documentation to use the new naming.
Changes:
- Renames
ProcessInfo.process_name/set_process_name()toname/set_name(), and updatesAbstractProcess+ OS-specific process constructors accordingly. - Renames lookup helpers to
get_process_id(s)_by_name()and updates call sites/tests. - Updates user-facing docs and README examples to use
OpenProcess(name=...).
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_process_lookup.py | Updates lookup helper calls to *_by_name; docstring text updated (needs minor grammar fix). |
| tests/test_process_enumeration.py | Updates native enumeration tests to use get_process_ids_by_name. |
| tests/test_partial_name_match.py | Updates partial/exact matching tests to use *_by_name and OpenProcess(name=...). |
| README.md | Updates primary usage example to OpenProcess(name=...). |
| PyMemoryEditor/win32/process.py | Renames constructor kwarg to name and updates docstring + super().__init__ call. |
| PyMemoryEditor/process/util.py | Renames lookup functions to get_process_id(s)_by_name (contains readability issues due to variable shadowing). |
| PyMemoryEditor/process/info.py | Renames ProcessInfo field/property/methods to name and updates lookup call. |
| PyMemoryEditor/process/abstract.py | Renames constructor kwarg to name and updates error message + plumbing to ProcessInfo.set_name. |
| PyMemoryEditor/macos/process.py | Renames constructor kwarg to name and updates docstring + super().__init__ call. |
| PyMemoryEditor/linux/process.py | Renames constructor kwarg to name and updates docstring + super().__init__ call. |
| PyMemoryEditor/app/open_process_dialog.py | Updates UI tooltip text and passes name=... when opening by typed entry. |
| docs/why.md | Updates example to OpenProcess(name=...). |
| docs/troubleshooting.md | Updates examples and guidance to OpenProcess(name=...). |
| docs/quickstart.md | Updates quickstart snippets to OpenProcess(name=...). |
| docs/platform-notes.md | Updates permission examples to OpenProcess(name=...). |
| docs/index.md | Updates landing-page example to OpenProcess(name=...). |
| docs/guide/searching.md | Updates searching guide examples to OpenProcess(name=...). |
| docs/guide/read-write.md | Updates read/write guide examples to OpenProcess(name=...). |
| docs/guide/opening-process.md | Updates opening-process guide to name terminology and examples. |
| docs/guide/modules-threads.md | Updates modules/threads guide examples to OpenProcess(name=...). |
| docs/guide/memory-regions.md | Updates memory-regions guide examples to OpenProcess(name=...). |
| docs/guide/allocate-free.md | Updates allocate/free guide examples to OpenProcess(name=...). |
| docs/api/thread-info.md | Updates API docs example to OpenProcess(name=...). |
| docs/api/openprocess.md | Updates OpenProcess signature and examples to name=.... |
| docs/api/module-info.md | Updates API docs example to OpenProcess(name=...). |
| docs/api/memory-region.md | Updates API docs example to OpenProcess(name=...). |
| docs/api/errors.md | Updates error docs for OpenProcess(name=...) but currently mis-documents exception attribute names vs implementation. |
| docs/api/enums.md | Updates enums doc example to OpenProcess(name=...). |
Comments suppressed due to low confidence (1)
PyMemoryEditor/process/util.py:59
- The loop variable
nameshadows the function parametername, andprocess_name_cmpstill uses the old identifier. This makes the function harder to read and reason about (especially with case-folding and substring matching). Rename the variables to avoid shadowing and keep the terminology consistent with the new API.
if not case_sensitive:
process_name_cmp = name.casefold()
else:
process_name_cmp = name
matches: List[int] = []
for pid, name in _iter_processes():
name = name or ""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
3
to
5
| """ | ||
| Cross-platform tests for process_name lookup logic, exercising | ||
| Cross-platform tests for process's name lookup logic, exercising | ||
| AmbiguousProcessNameError and the case_sensitive flag without depending on |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
PyMemoryEditor/process/util.py:60
- In
get_process_ids_by_name, the loop variablenameshadows the function argumentname, which makes the logic harder to follow and is easy to misuse in future edits. Rename the per-row variable to avoid shadowing (e.g.,proc_name).
matches: List[int] = []
for pid, name in _iter_processes():
name = name or ""
name_cmp = name if case_sensitive else name.casefold()
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Simplify the public API by removing the redundant
process_prefix from several identifiers.Changes
ProcessInfo.process_name→ProcessInfo.nameProcessInfo.set_process_name()→ProcessInfo.set_name()get_process_ids_by_process_name()→get_process_ids_by_name()get_process_id_by_process_name()→get_process_id_by_name()All call-sites across the linux, macOS, win32 and app layers have been updated, along with the documentation and test suite.