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

"examples" package erroneously installed #1706

Closed
pganssle opened this issue Sep 19, 2018 · 6 comments
Closed

"examples" package erroneously installed #1706

pganssle opened this issue Sep 19, 2018 · 6 comments

Comments

@pganssle
Copy link

@pganssle pganssle commented Sep 19, 2018

Because there's an examples/__init__.py file in the repo, this line of setup.py is erroneously deciding to install two packages, flask-admin and examples. I suspect other packages make this same mistake, which can lead to some file conflicts during installation.

It would be best to either change your find_packages invocation to blacklist exclude:

find_packages(exclude=['examples', 'examples.*'])

Or (and this is how I would do it to avoid this problem in the future) or to whitelist flask_admin:

find_packages(include=['flask_admin'])

I would also go further and also blacklist flask_admin.tests, since I think tests should not be part of the installation:

find_packages(include=['flask_admin'], exclude=['flask_admin.tests.*'])

But I think just not shipping the examples package is a good start.

@mrjoes
Copy link
Member

@mrjoes mrjoes commented Sep 19, 2018

Sounds good. The include option won't work as all "batteries" are shipped as flask_admin.contrib sub-packages.

But sure, examples and tests can be safely removed.

Loading

@pganssle
Copy link
Author

@pganssle pganssle commented Sep 19, 2018

@mrjoes I always get these find_packages things confused. I think the "include" version is actually:

find_packages(include=['flask_admin', 'flask_admin.*'])

Though for some reason adding exclude=['flask_admin.tests.*'] doesn't remove the flask_admin.tests module. Not entirely sure what's up with that.

Another, more radical perspective to consider might be using the src layout, which Hynek Schlawack compellingly argues for here. A less radical version of that is moving flask_admin/tests into a tests directory alongside flask_admin, though that would still probably entail quite a bit of refactoring (haven't looked at the code myself to check this).

Probably the easy thing to do is start by blacklisting and then revisit a whitelist later.

Loading

@elvijs
Copy link

@elvijs elvijs commented Oct 18, 2018

This is a substantial issue for a project I'm working on. The examples package installed alongside flask-admin is overwriting our project's examples package.

Is there any way I could speed up the fix? Happy to do a PR if that would help.

Loading

@elvijs elvijs mentioned this issue Oct 19, 2018
@elvijs
Copy link

@elvijs elvijs commented Oct 19, 2018

Added a proposed super-lightweight fix, see the PR above

Loading

@pganssle
Copy link
Author

@pganssle pganssle commented Oct 21, 2018

I think this probably still needs a more long-term fix, like adding a test that only things under the correct namespace are built, or using one of the find_packages-based approaches.

Loading

@elvijs
Copy link

@elvijs elvijs commented Oct 21, 2018

Good point.

For what it's worth, I think that explicitly whitelisting flask-admin is the cleanest solution (as long as tests are moved out of flask-admin).

Loading

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

Successfully merging a pull request may close this issue.

None yet
3 participants