The Wayback Machine - https://web.archive.org/web/20220309074017/https://github.com/RustPython/RustPython/issues/1175
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 · 24 comments
Open

Extend the os module #1175

windelbouwman opened this issue Jul 24, 2019 · 24 comments

Comments

@windelbouwman
Copy link
Contributor

@windelbouwman 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.

@mpajkowski
Copy link
Contributor

@mpajkowski mpajkowski commented Jul 25, 2019

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

@immersinn
Copy link

@immersinn 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 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

@immersinn immersinn commented Sep 23, 2019

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

@coolreader18
Copy link
Member

@coolreader18 coolreader18 commented Sep 23, 2019

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

@immersinn
Copy link

@immersinn immersinn commented Sep 23, 2019

cool cool, thanks!

@dan-fritchman
Copy link
Contributor

@dan-fritchman dan-fritchman commented Oct 13, 2019

PR #1524 has an implementation of os.system.

@Wasdee

This comment has been hidden.

@nicholasraphael
Copy link

@nicholasraphael nicholasraphael commented Jun 8, 2020

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

@coolreader18 coolreader18 commented Jun 23, 2020

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

@BolunThompson BolunThompson commented Jul 22, 2020

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

@coolreader18 coolreader18 commented Jul 23, 2020

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 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

@AthulMuralidhar AthulMuralidhar commented Jan 10, 2021

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 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

@AthulMuralidhar AthulMuralidhar commented Jan 10, 2021

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

@dbrgn
Copy link
Contributor

@dbrgn dbrgn commented Feb 6, 2021

getlogin: #2441

@kenkoooo
Copy link
Contributor

@kenkoooo kenkoooo commented Feb 11, 2021

Hi, let me work on getgrouplist: #2449

@kenkoooo
Copy link
Contributor

@kenkoooo kenkoooo commented Feb 13, 2021

Let me work on getpriority and setpriority next: #2453

@Wasdee
Copy link

@Wasdee 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

@duysqubix duysqubix commented Apr 6, 2021

Implementing os.listxattr

@hk1997
Copy link

@hk1997 hk1997 commented Sep 9, 2021

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

@DimitrisJim
Copy link
Member

@DimitrisJim DimitrisJim commented Sep 9, 2021

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

@youknowone youknowone commented Sep 22, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet