Skip to content

Conversation

@godlygeek
Copy link
Contributor

Closes: #25

Rendered documentation can be previewed here.

@pablogsal Let me know whether there's anything else that you'd like to see documented here.

Now is probably our last chance to rename some of this before the API actually gets users. I'm wondering whether we should have gone with force=True or overwrite=True for the parameter to tell a FileDestination to overwrite an existing file, instead of exist_ok=True. I'm also thinking that the name SocketDestination is a bit odd for something that configures how to start a server, rather than a client...

@godlygeek godlygeek added the documentation Improvements or additions to documentation label Apr 21, 2022
@godlygeek godlygeek self-assigned this Apr 21, 2022
@godlygeek godlygeek force-pushed the api_docs branch 3 times, most recently from 9f60277 to f867159 Compare April 22, 2022 00:29
@pablogsal
Copy link
Member

pablogsal commented Apr 22, 2022

@pablogsal Let me know whether there's anything else that you'd like to see documented here.

I wonder if we want to document the FileReader and related classes, as they are part of the API and those are the ones that allow extension. I think is important to document these because part of the power of custom inspection comes from here and this is what can unlock a much better community of plugins and whatnot.

@pablogsal
Copy link
Member

I'm wondering whether we should have gone with force=True or overwrite=True for the parameter to tell a FileDestination to overwrite an existing file, instead of exist_ok=True. I'm also thinking that the name SocketDestination is a bit odd for something that configures how to start a server, rather than a client...

I agree with both, those are good points. What about if we rename exists_ok to overwrite?

Regarding SocketDestination is a bit trickier because we are indeed sending this to a socket destination, but the whole enterprise then makes the whole program act as a server. I think that is ok-ish unless some other native speakers think otherwise.

@godlygeek
Copy link
Contributor Author

godlygeek commented Apr 22, 2022

I wonder if we want to document the FileReader and related classes, as they are part of the API and those are the ones that allow extension.

I've gone with "no" for now, in part because we haven't yet gotten any requests for this, but also because I'm not as familiar with those classes and I can't speak as well to whether we're willing to commit to interface stability on them, or whether there's things that still need to be revisited.

Regarding SocketDestination is a bit trickier because we are indeed sending this to a socket destination,

Yes, but the destination that we send to isn't identified by the host and port that you give. You do Tracker(SocketDestination(port=1234)), and we don't send any data to port 1234. Instead, we listen on port 1234 for an incoming connection, which gets assigned an ephemeral port, and we send data to that ephemeral port instead.

I dunno - I find the name a bit misleading, but I also can't really think of a way to fix it. I guess we could call it SocketServer instead...

I agree with both, those are good points. What about if we rename exists_ok to overwrite?

Ack, I'll make that change.

@pablogsal
Copy link
Member

I guess we could call it SocketServer instead...

SocketServer works for me

@godlygeek
Copy link
Contributor Author

godlygeek commented Apr 22, 2022

After some offline discussion, we've settled on leaving SocketDestination for the name of that class, but changing its constructor parameters to make it clearer that it's spawning a server, renaming

class memray.SocketDestination(port: int, host: str = '127.0.0.1')

to

class memray.SocketDestination(server_port: int, address: str = '127.0.0.1')

@godlygeek godlygeek changed the title Add documentation for the Memray API Finalize and document Tracker API Apr 22, 2022
These annotations were missing from the extension module's type stubs.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
When backticks are used without any explicit role, default to assuming
that the referenced text is the name of a Python object. This doesn't
affect the behavior of qualified lookups at all.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
This will let Sphinx link our type hints to types provided by the Python
interpreter and standard library.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Document how to use the Memray API to programmatically control tracking
of allocations in a Python process.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
This is meant as a short blurb to inform the user that the feature
exists, without going into any depth.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
To make it clearer what the effect of using a `SocketDestination` is,
use `server_port` rather than `port` and `address` rather than `host` as
the names of its attributes. Also, correct the type hint for `address`:
it mistakenly indicated that it could be `None`, but it can't (though it
can be omitted, because it has a default value).

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
The name `exist_ok` did a poor job of conveying what would happen if it
already existed: it could have not failed but also not written anything,
or it could have overwritten the existing file. The new name makes the
outcome clearer.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@pablogsal pablogsal enabled auto-merge (rebase) April 22, 2022 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation on how to use memray as an API

2 participants