-
Notifications
You must be signed in to change notification settings - Fork 2
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
Public Interface #145
Comments
Let's do 2) first and then, if needed, afterwards 1) I'll edit the top entry to add a list of needed entries |
We also have to agree on a strategy for |
That's fair, but less urgent. |
I believe pandas is following our current best proposal and it provides the two functions we need (here and here) together with the pre-commit hook |
First, we definitely need to prioritize this issue. In particular, we need a way to mark the package content as private/public, in order to start doing it. The general scheme is that everything is going to be private, unless those things that we really want to provide to the users, and we know that are going to be useful.
We want to allow public members to access private members, but this is complicated because when importing a module, it enters the scope of the importing one.
We also want a tool to automatically check that rule 2. is respected (so it is not violating the publicity defined by rule 1. and underscores). The following stages will be followed:
Please @NNPDF/theory start marking EKO issues according to the latest possible required stage, i.e. do not make your issue beta, if it is not a big breaking change, and if it is not breaking at all it has to be |
Because of the we-are-adults-here policy, the state of solutions for public API definition in Python packages is rather poor. Here possible approaches:
The preferred solution at the moment is 1. with import renaming. |
This was half a lie: import ciao
from ciao import come
from come import va as bene into Module(
body=[
Import(
names=[
alias(name='ciao')]),
ImportFrom(
module='ciao',
names=[
alias(name='come')],
level=0),
ImportFrom(
module='come',
names=[
alias(name='va', asname='bene')],
level=0)],
type_ignores=[]) but it is meant to be compiled to executable code, not to be dumped again. For round-trip parsing, we need a Concrete Syntax Tree, not an abstract one. One of the following should perfectly work:
So the actual options are three: LibCST, parso, or stick to In case we want to limit deps (not incredibly critical) but still attempt replacement, we could also use |
A popular solution (adopted by Pandas, but I seem to remember to have seen also somewhere else) is to move the full implementation inside a cd src/eko
mkdir core
mv * core/ And then use modules and sub-packages outside With this convention, everything that is outside However, it adds the overhead of manually defining all the public modules. But, possibly, it is more clear and less cumbersome than writing our own checker... |
We have to decide the public interface of EKO, for the following reason: at the moment, everything is potentially public.
In this way, we won't ever have a v1.0.0, since it is impossible that all internal details will be forever stable.
We also have to decide how to discriminate the public interface from the non-public one. Essentially, I know two ways:
_myfunc
, then it is privatemyobj
is publicThe point about majors is preserving backward compatibility, if we only add stuffs to the public API we won't need a new major ever.
So new major are needed only for refactoring the public API. Otherwise, EKO will be v1.x.y forever :)
the list of exposed features should be (at least):
run_dglap
: let's keep this our default entry pointmake_lambert_grid
version
ThresholdAtlas
,interpolation
: needed byyadism
Couplings
,basis_rotation
: needed byyadism
,pineko
, and benchmarkscompatibility
stuff for NNPDF and benchmarksThe text was updated successfully, but these errors were encountered: