fortran-lang / fpm-registry

Centralized registry of fpm packages
https://fpm.fortran-lang.org/en/registry/
MIT License
36 stars 17 forks source link

Store size of package in the index #35

Open aslozada opened 3 years ago

aslozada commented 3 years ago

Should the fpm.toml file contain information about the size of the package?

The subroutines new_package and check, in the module fpm_manifest_package, contain 18 keywords with information about a package, name, author, version, etc. However, no keyword provides information about the size of the package. 

An idea,

  1. Build the package
  2. Update the file fpm.toml with information about the size of the package

The command execute_command_line can get this information from shell.

milancurcic commented 3 years ago

What is the size of a package? Many things come to mind: Number of modules, procedures, source files, dependencies? Number of lines of code? Number of bytes on disk of source files? Number of bytes of the binaries?

What is it useful for?

LKedward commented 3 years ago

Thanks for opening @aslozada but I think there may be some misunderstanding about the role of the fpm.toml file.

fpm.toml is an input file written by the user to specify the necessary information to build and distribute the package; it is not a cache for metadata and properties of the package. Put another way, fpm.toml describes inputs (akin to independent variables) whereas the 'size' of a package is a property of the package and is hence an output (akin to a dependent variable). It is for this reason that we do not in general want a workflow where fpm modifies fpm.toml since this implies a circular relationship of sorts.

ghost commented 3 years ago

I think the information about the package size is useful in this scenario: a package contains many dependencies or a huge dependency (several GB of data) and we're in limited internet connection. I think fpm could display a message like this one: "I will download N GB of data. Do you want to continue?". This information could be stored in fpm-registry.

LKedward commented 3 years ago

This information could be stored in fpm-registry.

Yes I agree, this type of information would be well-suited to the fpm-registry which is setup extract and cache such data.

aslozada commented 3 years ago

Put another way, fpm.toml describes inputs (akin to independent variables) whereas the 'size' of a package is a property of the package and is hence an output (akin to a dependent variable).

Thanks, @LKedward.

The proposal is related to the scenario described by @brocolis. I thought that the file fpm.toml would be appropriate to contain this information. Of course, this file would be modified after building the package. Now I see that this procedure could be impractical.

LKedward commented 3 years ago

Thanks @aslozada and @brocolis, the scenario makes sense for a central registry; providing more information about packages and their dependencies prior to downloading them is one of the motivations for developing a central fpm-registry. I'll move this issue to fpm-registry so that it can be tracked there.

certik commented 3 years ago

Indeed, the fpm-registry should automatically extract this information and make it available.