Skip to content

python improvement: import all modules after the build is finished #3821

@domenkozar

Description

@domenkozar

It might be a good idea to import all module once a package is built. It will detect missing dependencies and other errors at build time.

One good reason for such behaviour is that pypy cffi verifier writes some files on first import. If we don't do this during build time, Nix throws permissions errors due to readonly store.

Sample code to get all modules for a package:

import pkgutil
import email

package = email
for importer, modname, ispkg in pkgutil.walk_packages(path=package.__path__,
                                                      prefix=package.__name__+'.',
                                                      onerror=lambda x: None):
    print(modname)

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancementAdd something new or improve an existing system.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: pythonPython is a high-level, general-purpose programming language.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions