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

Comments

@pganssle
Copy link

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

This comment has been minimized.

Copy link
Member

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.

@pganssle

This comment has been minimized.

Copy link
Author

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.

@pganssle pganssle referenced this issue Sep 20, 2018
0 of 2 tasks complete
@elvijs

This comment has been minimized.

Copy link

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.

@elvijs elvijs referenced this issue Oct 19, 2018
@elvijs

This comment has been minimized.

Copy link

commented Oct 19, 2018

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

@pganssle

This comment has been minimized.

Copy link
Author

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.

@elvijs

This comment has been minimized.

Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.