pyscript-cli icon indicating copy to clipboard operation
pyscript-cli copied to clipboard

CLI config file and Default project config file names

Open fpliger opened this issue 3 years ago • 3 comments

Naming is hard but necessary!

We need a place to PyScript CLI global configurations (that I'm referring to as CLI config file) and PyScript apps now have a JSON/[TOML] format for Apps configuration. So we need to choose a default name for that file when the CLI creates a new project (referring to as project config).

My proposal here is that:

  1. we use TOML for the CLI config file format
  2. we name it pyscript.config.toml or .pyscriptconfig
  3. we name the default project config file to pyscript.json

/cc @ntoll @mattkram

fpliger avatar Sep 15 '22 15:09 fpliger

My vote is to use TOML for local CLI config. Ideally, we would either use pyscript.toml, or define our own sections inside pyproject.toml. When a PyScript project is uploaded, or bundled/built via the CLI, we could do a json.dumps(toml.load(fp)) to convert to the JSON format required by PyScript itself.

To summarize, my preference would be to:

  1. Use TOML because it's easier for humans to edit and already becoming the new standard for tool config.
  2. If we can, use pyproject.toml to stick with the standard, and potentially open us up to being able to define a build backend via PEP 518 in the future. This is already common for tool config, e.g. for black, even if you aren't defining a package.
  3. Converting the config from TOML -> JSON should be pretty trivial for the CLI to do, whether in an Upload, or Bundle, or ...
  4. The detail of storing config in TOML and converting, or including a JSON file, could be configured inside the TOML file so the user can decide. This detail can be deferred.

mattkram avatar Sep 15 '22 16:09 mattkram

Oh sorry., duh. Yeah... +1 from me as well on using TOML as well for the default project config.

I'm -1 on using pyproject.toml because they are VERY different and that, imho, would actually confusing.

Points 3 and 4 might not even be necessary.

Thoughts on my point 2?

fpliger avatar Sep 16 '22 00:09 fpliger

Assuming you mean the naming, I'd vote to have a section [config] or [pyscript.config] inside pyscript.toml.

Having at least one level of nesting opens the structure of the file up for later expansion if needed.

mattkram avatar Sep 16 '22 00:09 mattkram