-
Notifications
You must be signed in to change notification settings - Fork 3
Add new DeviceReader constructors #26
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bruno-f-cruz thanks, looks good overall. I have a few questions / comments:
- Would be nice if bf816e2 would be in its own PR so that it gets listed in the release notes. Is it too hard to extract? Doesn't look like the rest of the PR is depending on it.
- What linter are you using? Can you run black on the current repo state? When I run it on my end I'm getting a different result. Maybe we could agree on what tools we use and then add them to
pyproject.toml
in a separate PR. - I'm having second thoughts about the use of
base_path
. I don't like that it is used in different ways depending on which function gets called, so maybe it would be best to get rid of it entirely?
harp/reader.py
Outdated
@staticmethod | ||
def from_url( | ||
url: str, | ||
base_path: Optional[PathLike] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base_path
is indeed getting clunky, I'm slightly uncomfortable of having different behaviors depending on which function gets called here, so maybe just getting rid of it would be best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow. The use of base_path
is consistent across methods. If provided it will try use it as a root directory where all files are expected to be found. If not provided it will assume either the current working directory (e.g. from_url
) or the root of the provided yml
(e.g. from_file
). Are these two defaults what are raising flags for you? Happy to go with a different one if you want. We can also just throw an error at the level of the DeviceReader
class if no path was provided and the user try to use the no-input overload of the register load function.
return DeviceReader(device, reg_readers) | ||
|
||
@staticmethod | ||
def from_str( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looking for a better name:
from_yaml
: may be misleading since the others also ultimately use YAMLfrom_schema
: maybe a little bit better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from_schema
makes me nervous as people might think you should pass the actuall schema file (i.e. .yml
). Would from_string
be better (ToString
is also a thing after all haha)?
a5c22e4
to
ea118f4
Compare
ea118f4
to
24b8977
Compare
@glopesdev lets review #28 and #27 first and then we will handle this one. |
…harp-tech/harp-python into feat-device-reader-constructors
57414b4
to
132cb73
Compare
@glopesdev I am taking a second look at this and I think we need to mainly decide on a few points:
|
This allows `g` aka `_create_register_reader` to take care of the path inference logic
Make `data` input to `_compose_parser` optional
Replace license classifier with SPDX expression
…harp-tech/harp-python into feat-device-reader-constructors
Closes #25