DEV Community

Discussion on: I am kind of baffled by this code in the `__init__.py` file in my Python project. How does this work internally?

Collapse
 
rhymes profile image
rhymes

I didn't know about pyscaffold. get_distribution comes from setuptools which is a library to distribute Python projects.

That part I believe is about finding the package version at runtime.

I'd say unless you're shipping a library it's probably overkill.

Collapse
 
seanballais profile image
Sean Francis N. Ballais

In what cases would you need to find the package version at runtime?

Collapse
 
rhymes profile image
rhymes

Probably for conflict resolution in case multiple packages require your library with different versions...

I'm sorry Sean, I don't know much about this topic :(

Thread Thread
 
seanballais profile image
Sean Francis N. Ballais

It's alright.