-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add backend interface #167
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
|
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.
Before I start reviewing in detail a few remarks/questions:
- The interface layer seems elegant, but as a user I'm totally lost at the moment in the API documentation as I have no clue were to look what I can do with a backend. In general, it might even better with the interfaces as the I don't have to care about the specific backend, but can just look at the documentation for the
Versioned
interafce. But I guess we need to point this out to a user. One solution might be to hide all methods in theaudbackend.Backend
,audbackend.FileSystem
, ... classes and add a link to the interafce documentation instead. - As a developer I also feel slightly lost, as the interface classes seem to implement again all the methods from backend. This feels especially strange for
Unversioned
as I guess this is the default behavior ofaudbackend.Backend
anyway? - Regarding the tests it should be sufficient to test the interfaces only on a single backend, e.g.
FileSystem
as they should be independent of the backend (otherwise we would have to add more interafce tests when adding a new backend, which feels strange to me).
Yes, I was thinking the same. But maybe we do it in a separate PR?
Not necessarily, e.g.
Yes, that is true, in principle we could directly return the |
done |
One more thought: to make it easier for a developer to distinguish between backend and interface, I suggest we create a follow-up PR where we move |
I think it would be easier to grasp if you rename the following tests functions:
|
Good idea. Done. |
I created #168 to track the |
I created #169 to track this. |
I created #170 to track this. |
* first rough implementation * introduce interface classes * Interface: add backend property * Versioned.latest_version(): raise error if no version is found * Interface: add host, join(), repository, split(), sep * TST: add tests for unversioned interface * Backend.*: call utils.check_path() * TST: rename backend to interface * Backend: add get_archive() and put_archive() * TST: test unversioned interface in docstring * DOC: add interfaces * DOC: update docstring of interface classes * TST: fix PEP8 errors * TST: full code coverage * TST: fix owner in test_unversioned * TST: fix owner in test_versioned * access()/create(): set interface class * DOC: add Interface * interface as sub module * access()/create(): add interface_kwargs argument * DOC: usage section on interface * DOC: fix typo * DOC: mention interface section in preamble * TST: test versioned interface only on file-system * TST: improve names of tests scripts * fix github actions after renaming test files * TST: fix ignored test
* first rough implementation * introduce interface classes * Interface: add backend property * Versioned.latest_version(): raise error if no version is found * Interface: add host, join(), repository, split(), sep * TST: add tests for unversioned interface * Backend.*: call utils.check_path() * TST: rename backend to interface * Backend: add get_archive() and put_archive() * TST: test unversioned interface in docstring * DOC: add interfaces * DOC: update docstring of interface classes * TST: fix PEP8 errors * TST: full code coverage * TST: fix owner in test_unversioned * TST: fix owner in test_versioned * access()/create(): set interface class * DOC: add Interface * interface as sub module * access()/create(): add interface_kwargs argument * DOC: usage section on interface * DOC: fix typo * DOC: mention interface section in preamble * TST: test versioned interface only on file-system * TST: improve names of tests scripts * fix github actions after renaming test files * TST: fix ignored test
Closes #155
Introduces the concept of an interface as an intermediate layer between the user and the backend. For instance, the default interface
audbackend.interface.Versioned
takes as input/sub/file.ext
andversion
and converts it to/path/version/file.ext
. Whereas the interfaceaudbackend.interface.Unversioned
does not take an additionalversion
parameter and stores a file directly under/sub/file.txt
. It will also offer a more elegant solution for the issue the old file structure if we introduce another interface, e.g.VersionedLegacy
(not done in this PR).Documentation
The documentation is extended accordingly:
And the usage section has a new section "Backend interface":
Tests
The test file
tests/test_backend.py
is now further split intotests/test_versioned.py
andtests/test_unversioned.py
. Since we now test with both interfaces (Unversioned
andVersioned
), we have twice as many tests that involve Artifactory. To shorten the time it takes to execute the tests we could think about testing only one of the interface withArtifactory
.