question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MNT: Get rid of minversion definitions in __init__.py

See original GitHub issue

Description

Do we really need all this stuff in __init__.py? It duplicates the info in setup.cfg anyway. For the usage in docs/conf.py, there is no reason we cannot get that info from setup.cfg instead?

https://github.com/astropy/astropy/blob/a995665c06b8d145ba811e3cbc59b0dfb8d20bd6/astropy/__init__.py#L15-L30

Additional context

If the package being checked has no __version__, importing astropy will fail. For example: liberfa/pyerfa#60

cc @saimn and @astrofrog @embray

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
saimncommented, Nov 23, 2020

https://importlib-metadata.readthedocs.io/en/latest/ (not importlib-resources 😉). It would be a requirement for Python 3.7 only. In the long term it’s the package to use as it was designed as a more efficient replacement to pkg_resources. (We could also use it for entry points, it should be must faster)

0reactions
mhvkcommented, Nov 23, 2020

Seems very nice. Could have a switch in __init__.py between pkg_resources and importlib.metadata… (see comments in PR)

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - What is __init__.py for? - Stack Overflow
Since I define Session here, I can start a new session using the syntax below. This code would be the same executed from...
Read more >
Understanding Python imports, __init__.py and pythonpath
What if I only want to import certain, but not all, items from the imported module? In our example, we only have a...
Read more >
What is __init__.py file in Python Packages ... - YouTube
In this video, we're gonna be discussing about the use case of __init__. py in Python or simply init. py in Python.
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/21 18 ...
Bug:128538 - "sys-apps/coreutils: /bin/hostname should be installed from coreutils not sys-apps/net-tools" status:UNCONFIRMED resolution: severity:enhancement ...
Read more >
Python Modules and Packages – An Introduction
This article explores Python modules and Python packages, two mechanisms that ... Reusability: Functionality defined in a single module can be easily reused ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found