copy.copy(os.environ) makes an object that still changes the real environment
What it finds
os.environ is a mapping whose writes go to the process environment, and copy.copy of it keeps that behaviour: setting a key in the copy changes the environment of the process and of every child it starts. os.environ.copy() or dict(os.environ) returns a plain dict that can be changed freely.
From the rule's source, environ_copy_still_live.rs.
import copyimport os env = copy.copy(os.environ)tx0 reports: the copy still writes to the real environmentsafe = os.environ.copy()other = copy.copy(settings.environ) Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/python:environ-copy-still-live" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:environ-copy-still-live] reason="..."tx0 explain tx0/python:environ-copy-still-live shows the same in the terminal. Found a false positive? Report it.