Skip to content
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 a top-level public api #2387

Closed
mmerickel opened this issue Mar 1, 2016 · 2 comments
Closed

add a top-level public api #2387

mmerickel opened this issue Mar 1, 2016 · 2 comments

Comments

@mmerickel
Copy link
Member

Pyramid has never used the top-level namespace for anything other than subpackages. However, we also don't use conventions like _ prefixes to indicate private classes and functions. This means that a user exploring the pyramid package via an autocompleting IDE has no way to tell what is public and what is private.

ONE OPTION (but maybe not the best?) is to define the top-level api in pyramid as the public api. We could use something like apipkg to do this such that imports occur lazily. From there we could expose public functions, classes and attributes as pyramid.view_config, pyramid.Configurator, etc.

IDEs still have the issue that the subpackages themselves appear public, so if someone navigates into the subpackage everything looks public (pyramid.session.foo) but perhaps that's less of an issue?

@digitalresistor
Copy link
Member

I personally am "meh" on this.

@mmerickel
Copy link
Member Author

That's fine. I'd be curious to know any other ideas on how to make an easily discoverable public API by simply navigating the code. Some thoughts:

  • Go through the codebase and convert everything to _prefix where private.
  • Define a pyramid.private package which mirrors the public api. For example pyramid.private.session vs pyramid.session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants