Skip to content

Extend the os module #1175

Closed
Closed

Description

@windelbouwman

Currently, the python os module is missing many methods. Try adding a method to this module by editing the file vm/src/stdlib/os.rs.

This is an issue for new contributors, so please do not implement everything at once, so other people have a chance to go for it (or, actually, please implement all! >:)! ).

Note: Before working on platform-specific functions, check if they are members of posix or nt. Their members are reexported to os.

Activity

  1. mpajkowski commented on Jul 25, 2019

    @mpajkowski

    Ok, I'm working on get/set uid, guid etc. stuff

  2. immersinn commented on Sep 23, 2019

    @immersinn

    I'm going to take a stab at chown and chroot.

    Also, as a general question, is the current goal to match CPython functionality here?

    Currently it doesn't seem that the os module is implemented in C for CPython. Is the goal here to implement the Python os module in Rust as, for example, the sys module in CPython is implemented in C and not in Python?

    Or am I completely missing something here?

  3. coolreader18 commented on Sep 23, 2019

    @coolreader18
    Member

    Because Rust's cross-platform support is so much better than C's, we decided to implement a single _os module that has all the built-in functions rather than the separate posix and nt modules that CPython has.

  4. immersinn commented on Sep 23, 2019

    @immersinn

    Ah, gotcha..so for chown and chroot methods, i'd reference the functionality and behavior in posixmodule.c

  5. coolreader18 commented on Sep 23, 2019

    @coolreader18
    Member

    Yep, and you can use the #[cfg(unix)] attribute to make sure they're only available on unix.

  6. immersinn commented on Sep 23, 2019

    @immersinn

    cool cool, thanks!

  7. dan-fritchman commented on Oct 13, 2019

    @dan-fritchman
    Contributor

    PR #1524 has an implementation of os.system.

  8. ninyawee commented on Jan 27, 2020

    @ninyawee
  9. nicholasraphael commented on Jun 8, 2020

    @nicholasraphael

    Hi, new here. I was just wondering how to start working on one of these outstanding implementations without having any overlap with others? Should we open a new issue for what we want to tackle and then have it assigned to us?

    Thanks!

  10. coolreader18 commented on Jun 23, 2020

    @coolreader18
    Member

    I'm so sorry for not responding earlier @nicholasraphael, if you're still interested you can feel free to just open a PR for it; there are a lot of functions and hopefully what you choose won't conflict if anyone else is working on something. You could also just comment what you're working on in this thread.

  11. BolunThompson commented on Jul 22, 2020

    @BolunThompson
    Contributor

    The libc rust module doesn't have an API for the ctermid function, so that's an issue for implementing os.ctermid.

  12. coolreader18 commented on Jul 23, 2020

    @coolreader18
    Member

    It's always possible to just do extern "C" { fn ctermid(...) -> ...; }; the libc crate isn't required for calling in to native functions.

  13. leopsidom commented on Nov 29, 2020

    @leopsidom

    Hey, I wanted to work on some of these issue. But how can I create tests for this ? Basically after I implement a method, how can I test if it's working as expected? Sorry quite new here.

  14. 4 remaining items

  15. kenkoooo commented on Feb 11, 2021

    @kenkoooo
    Contributor

    Hi, let me work on getgrouplist: #2449

  16. kenkoooo commented on Feb 13, 2021

    @kenkoooo
    Contributor

    Let me work on getpriority and setpriority next: #2453

  17. ninyawee commented on Feb 14, 2021

    @ninyawee

    I made a analysis to detemine the next important os module based on the real usage in GitHub public code. This is based on the master branch of this repo at the time of writing.

    Feel free to use and modify it.

    image

    link to notebook

  18. duysqubix commented on Apr 6, 2021

    @duysqubix

    Implementing os.listxattr

  19. hk1997 commented on Sep 9, 2021

    @hk1997

    Hi, is there something left to work on this?
    Would like to pick it up.

  20. DimitrisJim commented on Sep 9, 2021

    @DimitrisJim
    Member

    Run whats_left.sh and take a look at the output for os. Pick one of the functions, add a comment here that you've picked up the function so conflicts are minimized and start working on it!

  21. youknowone commented on Sep 22, 2021

    @youknowone
    Member

    I added a note to the issue body to check posix or nt for re-export.

  22. ecpost commented on Aug 20, 2022

    @ecpost
    Contributor

    Added a few macos constants: #4110

  23. marvinmednick commented on Feb 12, 2023

    @marvinmednick

    I'd like to take on os.pathconf_names - and have crated #4494 to track

  24. hydrogen602 commented on Apr 17, 2024

    @hydrogen602
    Contributor

    I'd like to look at getting os.fwalk implemented

    Edit: Looks like its already implemented in os.py, even though whats_left.py still shows it as missing.

  25. fanninpm commented on Apr 17, 2024

    @fanninpm
    Contributor

    whats_left.py still shows it as missing.

    If you're referring to what's on the website, the website gets updated every Friday (at least, in my timezone).

  26. youknowone commented on Dec 25, 2025

    @youknowone
    Member

    Thank you everyone to participate in this marathon for os module.

    os module function are almost done. A few of them are left, but having an issue for that is not worth as before.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions