Skip to content

revisit get_package_dir #57

@sbillinge

Description

@sbillinge

Problem

no problem, but I think we are handling this task differently in other packages so let's revisit and see if there is a standard way to do it. In general, I would rather not have it in the __init__.py file. I am not sure why, but I never really like importing things from there as a I don't fully understand the behavior.

Proposed solution

Right now it has to be there because files(__name) returns the package name when it is called from the init for some reason, and then this is returned as a context manager. I think in other packages in diffpy where we are trying to do the same thing, we do something like find the path of current file as a Pathlib object, then recurse around using .parent and so on to get the path we are after and then pass that to a function that opens the file. This just seems more explicit and less magical to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions