Skip to content

Feature request: Setup proper imports #195

@grburgess

Description

@grburgess

The way that we do python import * in both 3ML and astromodels is very bad practice as it can lead to namespace collisions. We need to eventually clean this up which will mean that we will have to fix up the docs (and our own scripts).

This will be especially important when we work with packages like gammapy because they may use the same model name and it could cause all kinds of strange bugs.

I have started working on this in a branch, but I think this is a breaking change so something for like a minor version bump.

It would look something like this:

import astromodels as amod

pl = amod.functions_1D.Powerlaw()

ps = amod.sources.PointSource()

for example. Of course, someone could always go through and import everything if they like, but it makes controlling names a lot easier. We would have something similar for 3ML

import threeml as datatools

p = datatools.plugins.OGIPLike()

Thoughts?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions