Skip to content

os.system not marked as deprecated #157882

Description

@Saber0324

Documentation

the documentation for the os module does not report on the deprecation of os.system, it is documented at the subprocess module and reported by type checkers.

The docs describe os.system as soft-deprecated in prose, but it is not formally marked as soft deprecated.

Activity

  1. gvanrossum commented on Sep 21, 2026

    @gvanrossum
    Member

    I would regret for os.system() to be deprecated. I would be happy for it to be implemented on top of subprocess. Ditto for os.popen().

  2. picnixz commented on Sep 21, 2026

    @picnixz
    Member

    Those functions are not meant to be deprecated but carefully used.

  3. hugovk commented on Sep 21, 2026

    @hugovk
    Member

    #120743 proposed to soft deprecate os.spawn*(), os.popen() and os.system(), but the PR dropped os.system and only did the other two: #120744 (comment).

    the documentation for the os module does not report on the deprecation of os.system, it is documented at the subprocess module and reported by type checkers.

    I don't see any mention of soft deprecation at the subprocess module?

    Which type checkers are reporting it as soft deprecated? Sounds like a bug report for them.

  4. nedbat commented on Sep 21, 2026

    @nedbat
    Member

    Which type checkers are reporting it as soft deprecated? Sounds like a bug report for them.

    I wouldn't blame the type checkers. Typeshed has:

    @deprecated("Soft deprecated. Use the subprocess module instead.")
    def system(command: StrOrBytesPath) -> int: ...
    
  5. hugovk commented on Sep 21, 2026

    @hugovk
    Member

    Added in python/typeshed#15179, which referenced the PR I mentioned above: #120744.

    Confusion possibly triggered by the PR that mentioned os.system in the description, and in its issue title.

    I've opened python/typeshed#16421 to fix Typeshed.

  6. Akuli commented on Sep 21, 2026

    @Akuli
    Contributor

    I think it would be a shame to deprecate (and hence, likely eventually remove) os.system. Python is a great language for quick and dirty scripting, and for those use cases, a simple "just run the command" thing is great.

  7. hugovk commented on Sep 21, 2026

    @hugovk
    Member

    Don't worry! There was no suggestion to do a normal deprecation or remove os.system, that would be far too disruptive.

    The proposal was to "soft deprecate", which means we would have recommended something else in the docs, but not plan to remove, and not issue any deprecation warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions