Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend the os module #1175

Open
windelbouwman opened this issue Jul 24, 2019 · 28 comments
Open

Extend the os module #1175

windelbouwman opened this issue Jul 24, 2019 · 28 comments
Labels
A-stdlib E-help-wanted Extra attention is needed

Comments

@windelbouwman
Copy link
Contributor

windelbouwman commented Jul 24, 2019

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.

@windelbouwman windelbouwman added E-help-wanted Extra attention is needed good first issue Good for newcomers labels Jul 24, 2019
@mpajkowski
Copy link
Contributor

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

@immersinn
Copy link

immersinn commented Sep 23, 2019

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?

@coolreader18
Copy link
Member

coolreader18 commented Sep 23, 2019

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.

@immersinn
Copy link

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

@coolreader18
Copy link
Member

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

@immersinn
Copy link

cool cool, thanks!

@dan-fritchman
Copy link
Contributor

PR #1524 has an implementation of os.system.

@wasdee

This comment has been minimized.

@nicholasraphael
Copy link

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!

@coolreader18
Copy link
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.

@BolunThompson
Copy link
Contributor

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

@coolreader18
Copy link
Member

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

@leopsidom
Copy link

leopsidom commented Nov 29, 2020

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.

@AthulMuralidhar
Copy link

hi @coolreader18 is the list here #1175 (comment) updated? i'd like to start working on one of the API's thanks!

@coolreader18
Copy link
Member

coolreader18 commented Jan 10, 2021

@AthulMuralidhar I think of that list,

  • ctermid
  • fchdir
  • getgrouplist
  • getlogin
  • getpriority

still need to be implemented in os.rs

@AthulMuralidhar
Copy link

thanks for the quick reply @coolreader18 i'll try to work on ctermid and fchdir

@dbrgn
Copy link
Contributor

dbrgn commented Feb 6, 2021

getlogin: #2441

@kenkoooo
Copy link
Contributor

kenkoooo commented Feb 11, 2021

Hi, let me work on getgrouplist: #2449

@kenkoooo
Copy link
Contributor

kenkoooo commented Feb 13, 2021

Let me work on getpriority and setpriority next: #2453

@wasdee
Copy link

wasdee commented Feb 14, 2021

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

@duysqubix
Copy link

Implementing os.listxattr

@hk1997
Copy link

hk1997 commented Sep 9, 2021

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

@DimitrisJim
Copy link
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!

@youknowone
Copy link
Member

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

@ecpost
Copy link
Contributor

ecpost commented Aug 20, 2022

Added a few macos constants: #4110

@marvinmednick
Copy link

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

@hydrogen602
Copy link
Contributor

hydrogen602 commented Apr 17, 2024

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.

@fanninpm
Copy link
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).

@youknowone youknowone removed the good first issue Good for newcomers label Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stdlib E-help-wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests