-
Notifications
You must be signed in to change notification settings - Fork 15
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
[WIP] Reduce and explicitly define our public API #115
base: master
Are you sure you want to change the base?
Conversation
@kiudee, I would take your slack comments to mean that the top-level
Is that understanding correct? |
Codecov Report
@@ Coverage Diff @@
## master #115 +/- ##
==========================================
- Coverage 60.01% 59.97% -0.04%
==========================================
Files 116 116
Lines 7642 7636 -6
==========================================
- Hits 4586 4580 -6
Misses 3056 3056
|
For the public record, @kiudee agreed in slack. Also the python conventions seem to agree with a two-level hierarchy: https://www.python.org/dev/peps/pep-0423/#avoid-deep-nesting |
This is a pre-requisite for cleaning up our public API.
I'm sorry, its been a while and I don't quite remember what I meant myself with comment #115 (comment). Does this mean all those functions should be directly accessible from I.e. do we want Option 1from csrank.choicefunction import FATEChoiceFunction
from csrank.objectranking import FATEObjectRanker Option 2from csrank.choicefunction import FATE
from csrank.objectranking import FATE as FATEObject Option 3from csrank import FATEChoiceFunction
from csrank import FATEObjectRanker I have kidn of operated under the assumption (1) and implemented that for now. But the comment could also be read as option (3). If we go this way, I think we should
Then we would have no direct exports from
I think this would improve tab-completion and discoverability of our API. |
Description
This is a work in progress. I haven't quite figured out how githubs draft PRs work.
With the absolute imports in the tests we could have
csrank/__init__.py
empty now. The test suite would still pass. I think that would actually be my preference: Start with an empty top-level, add re-exports when experience shows that it would be more convenient.However @kiudee advocated for some top-level imports on slack
Which is also also fine by me.
Motivation and Context
Currently we re-export everything at the toplevel. That is suboptimal. It pollutes our public namespace with a lot of irrelevant definitions. It provides multiple ways to import things, while there should be one preferred way, ideally only one way to do it. It makes tab import less useful. It necessitates star imports.
Therefore we want to reduce our public API to an explicitly defined subset.
How Has This Been Tested?
Ran the testsuite and the pre-commit hooks.
Does this close/impact existing issues?
Closes #105.
Types of changes
Checklist: