Registry / data / regions

regions

JSON →
library0.11pypypi✓ verified 89d ago

An Astropy coordinated package for region handling, providing tools for representing and working with astronomical regions (e.g., circles, ellipses, polygons) in various coordinate systems. Current version is 0.11, requiring Python >= 3.11. Releases follow irregular cadence.

pip install regions
INSTALL
IMPORT
SIG · REGIONS
R
regions
datapythonv0.11
Install
6.9s avg
Import
2004ms
Disk
162MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
build_error
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 6.9s · import 2.004s · 155MB
162MB installed
● package 162MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

regions
✓ import regions

Creates a circular sky region using SkyCoord and basic units.

import regions from astropy.coordinates import SkyCoord import astropy.units as u # Create a circular region at RA=10.68458, Dec=41.26917 (degrees) with radius=0.1 deg center = SkyCoord(10.68458, 41.26917, unit=u.deg) region = regions.CircleSkyRegion(center, 0.1 * u.deg) print(region)
Debug
Known issues
deprecatedThe old convenience function `regions.Region` for auto-detecting region format from a string is deprecated. Use explicit constructors like `CircleSkyRegion` or `regions.Region.parse()`.
fix
Replace `regions.Region('circle ...')` with `regions.CircleSkyRegion(...)` or `regions.Region.parse('circle ...')`.
affects: <0.9
gotchaRegion constructors expect `center` as a `SkyCoord` object for sky regions, not bare tuples or strings. Passing a tuple leads to confusing errors.
fix
Always convert coordinates to `SkyCoord` before passing to region constructors.
affects: >=0.1
breakingIn version 0.7, the `regions.io` module was reorganized. Functions like `write_ds9` moved to `regions.io.ds9.write_all`. Old imports break.
fix
Update imports: `from regions.io.ds9 import write_all` instead of `from regions.io import write_ds9`.
affects: <0.7
gotchaWhen reading DS9 region files, the `read_ds9` function returns a `Regions` (list-like) object, not a single region. Looping or indexing is needed to access individual regions.
fix
Use `regions = regions.io.ds9.read_ds9(filename)` then iterate or index.
affects: >=0.1
Errors
Common errors & fixes
TypeError: 'module' object is not callable
Using `regions.Region(...)` which is deprecated and no longer works in newer versions.
fix
Use explicit region constructors like `regions.CircleSkyRegion(...)` or `regions.EllipseSkyRegion(...)`.
AttributeError: module 'regions' has no attribute 'read_ds9'
The `read_ds9` function was moved to `regions.io.ds9` in version 0.7.
fix
Use `from regions.io.ds9 import read_ds9` or `regions.io.ds9.read_ds9(filename)`.
TypeError: 'str' object has no attribute 'ra'
Passing a string coordinate (e.g., '10.68458 41.26917') instead of a `SkyCoord` object to a region constructor.
fix
Convert the string to `SkyCoord` first: `center = SkyCoord('10.68458 41.26917', unit=u.deg)`.
Upgrade
Version history
0.11latest on PyPI · released Nov 5, 2025
Audit
Dependencies
numpyrequiredCore dependency for array operations
astropyrequiredCoordinate system and table support
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
regions — pip install regions · libregistry