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

flit+get_version requires all dependencies to be installed at build time #8

Closed
grst opened this issue Nov 1, 2019 · 1 comment
Closed

Comments

@grst
Copy link

grst commented Nov 1, 2019

I just noted that using get_version with flit requires all package dependencies to be installed at build time. This is because flit tries to derive the version from AST-parsing, if that fails it imports the module (and therefore all dependencies). See flit source code.

This is, for instance, annoying when building conda packages (all dependencies need to be included in the host section of meta.yml).

@flying-sheep, do you think there would be an elegant solution to this? The only thing I could think of are conditional imports in the __init__.py file, i.e. not importing dependencies when the package is imported from flit:

__init__.py

# To avoid that all dependencies need to be installed at build
# time:
import sys
if "flit" not in sys.argv[0]:
    from .foo import bar
    from .bar import foobar    

(However, in its current version, it's not very robust and might have side-effects)

@flying-sheep
Copy link
Owner

flying-sheep commented Nov 4, 2019

That’s even more elegant than what I came up with…

This issue is pypa/flit#253. I’m of the opinion that all dependencies should be available at build time.

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

No branches or pull requests

2 participants