def from_path(cls, path, format=None):
        """Load a developer package.

        A developer package may for example be a package.yaml or package.py in a
        user's source directory.

        Args:
            path: Directory containing the package definition file, or file
                path for the package file itself
            format: which FileFormat to use, or None to check both .py and .yaml

        Returns:
            `Package` object.
        """
        name = None
        data = None

        if format is None:
            formats = (FileFormat.py, FileFormat.yaml)
        else:
            formats = (format,)

        try:
            mode = os.stat(path).st_mode
        except (IOError, OSError):
            raise PackageMetadataError(
                "Path %r did not exist, or was not accessible" % path)
        is_dir = stat.S_ISDIR(mode)

        for name_ in config.plugins.package_repository.filesystem.package_filenames:
            for format_ in formats:
                if is_dir:
                    filepath = os.path.join(path, "%s.%s" % (name_,
                                                             format_.extension))
                    exists = os.path.isfile(filepath)
                else:
                    # if format was not specified, verify that it has the
                    # right extension before trying to load
                    if format is None:
                        if os.path.splitext(path)[1] != format_.extension:
                            continue
                    filepath = path
                    exists = True

                if exists:
                    data = load_from_file(filepath, format_, disable_memcache=True)
                    break
            if data:
                name = data.get("name")
                if name is not None or isinstance(name, basestring):
                    break

        if data is None:
            raise PackageMetadataError("No package definition file found at %s" % path)

        if name is None or not isinstance(name, basestring):
            raise PackageMetadataError(
                "Error in %r - missing or non-string field 'name'" % filepath)

        package = create_package(name, data, package_cls=cls)

        # preprocessing
        result = package._get_preprocessed(data)

        if result:
            package, data = result

        package.filepath = filepath

        # find all includes, this is needed at install time to copy the right
        # py sourcefiles into the package installation
        package.includes = set()

        def visit(d):
            for k, v in d.iteritems():
                if isinstance(v, SourceCode):
                    package.includes |= (v.includes or set())
                elif isinstance(v, dict):
                    visit(v)

        visit(data)

        package._validate_includes()

        return package
Load a developer package.

        A developer package may for example be a package.yaml or package.py in a
        user's source directory.

        Args:
            path: Directory containing the package definition file, or file
                path for the package file itself
            format: which FileFormat to use, or None to check both .py and .yaml

        Returns:
            `Package` object.