modal-client
modal-client copied to clipboard
Re-implements network check with vendored `psutil`
Adds the same logic from this PR but with vendored psutil
so we don't have to install an additional package.
Can you include the copyright notice?
https://github.com/giampaolo/psutil?tab=BSD-3-Clause-1-ov-file
Also can we prefix the location with an underscore (e.g. _vendor
so that it doesn't get confused for public API?
What is our approach to tests going to be with vendored code? Are we just going to assume that our existing unit tests cover all the behaviors that we need?
It also feels like we want some way of tracking what version the vendored code is sourced from. How will we know when we need to update it, e.g. if there is an important bug in the source repository?
While these are reasonable comments, I don't think they are relevant to this PR, as the use of psutil
here is just a particular function that just reads and parses /proc
for diagnostic reasons. We can revisit it if we need more functionality.
Other dependencies will need version tracking and so on, but this one is very easy to strip out.
Now is probably the only time we will know what version this corresponds to though :)
It shouldn't matter what version it corresponds to — barring any changes to the POSIX API, it should not need updates.
Are we just going to assume that our existing unit tests cover all the behaviors that we need?
This should be the case, yes. The tests I added test our interface and assumes the vendored code works as it should. That's is acceptable imo.
It also feels like we want some way of tracking what version the vendored code is sourced from.
I'll add a note to comments if only to point to the right license / code version. I agree with Eric that anything more is overkill.