astropy / astropy/specutils

import of specutils is slow

Open
#731 0 comments 0 reactions 0 assignees View on GitHub
discussion
Dominant language
Python
Stars
204
Forks
134
Avg merge
12h 55m
Merged PRs (30d)
1

Description

Importing `spectuils` is slow, taking 1.3-2 seconds. See attached screenshot, captured with `python -X importtime -c "import specutils" 2> imports.txt` and shown with tuna. For users developing packages that want to use and build off `Spectrum1D` it's unfortunate that importing `Spectrum1D` adds upwards of a second to the import time. If you drill down it looks like a big slowdown comes from importing `pkg_resources` in `astropy.modeling`, as well as `astropy.coordinates` within `astropy.nddata`. Has there been any discussion on ways of improving this?

specutils_importtimes

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with `python -X importtime -c "import specutils" 2> imports.txt` and inspect the result with tuna. Trace the import paths involving `Spectrum1D`, `pkg_resources` in `astropy.modeling`, and `astropy.coordinates` within `astropy.nddata`; done means establishing a concrete import-time improvement without changing the public behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.