Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cantera needlessly exports external/built-in modules and functions #616

@ischoegl

Description

@ischoegl

Cantera version

2.4.0 / 2.5.0a

Operating System

all

Python/MATLAB version

all Python

Expected Behavior

External (and built-in) modules should not be added to the cantera package as they are not part of cantera, e.g. numpy, math, os, sys, weakref, erf, warnings, appdelete, ...
While they are obviously required internally, they should not necessarily be exposed (can be avoided by defining __all__ in modules where cantera objects/functions are defined, so the from <> import * in __init__.py will only include what needs to be exposed).

Actual Behavior

cantera.np is numpy (external project), cantera.math is math (built-in), etc.
While this is admittedly a minor issue, it conflicts with PEP 423 as it obfuscates the origin of modules (np), and needlessly creates an additional level.

Steps to reproduce

  1. import cantera as ct
  2. dir(ct) includes both cantera and non-cantera modules

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions