-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
part of #41
- Loading branch information
Showing
4 changed files
with
202 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,33 @@ | ||
# pkg.json | ||
|
||
`pkg.json` is a wild-west "package" format for defining packages without a package system. | ||
It's a (very) limited subset of NPM's `package.json` that allows any project to declare dependencies on arbitrary URLs. | ||
|
||
The initial use-case is for Vim and Emacs plugins (which can be downloaded from anywhere), but the format is designed to be generic. | ||
|
||
## Example | ||
|
||
``` | ||
{ | ||
"name" : "lspconfig", // OPTIONAL cosmetic name, not used for resolution nor filesystem locations. | ||
"description" : "Quickstart configurations for the Nvim-lsp client", // OPTIONAL | ||
"engines": { | ||
"nvim": "^0.10.0", | ||
"vim": "^9.1.0" | ||
}, | ||
"repository": { // REQUIRED | ||
"type": "git", // reserved for future use | ||
"url": "https://github.com/neovim/nvim-lspconfig" | ||
}, | ||
"dependencies" : { // OPTIONAL | ||
"https://github.com/neovim/neovim" : "0.6.1", | ||
"https://github.com/lewis6991/gitsigns.nvim" : "0.3" | ||
}, | ||
} | ||
``` | ||
|
||
## Overview | ||
|
||
- `pkg.json` is just a way to declare dependencies on URLs and versions | ||
- Decentralized ("federated", omg) | ||
- Subset of `package.json` | ||
|
@@ -26,153 +54,18 @@ | |
|
||
## What about LuaRocks? | ||
|
||
LuaRocks is a natural as the Nvim plugin manager, but defining a ~~"plugin spec"~~ "federated package spec" also makes sense because: | ||
LuaRocks is a natural choice as the Nvim plugin manager, but defining a "federated package spec" also makes sense because: | ||
|
||
- There is no "federated" plugin spec (corrections welcome!). LuaRocks is a "centralized" approach. | ||
- LuaRocks + Nvim is starting to see real progress in the form of https://github.com/nvim-neorocks , but thus far has not gained momentum. A decentralized, lowest-common-denominator, "infectious" approach is high-leverage, while work continues on the centralized LuaRocks approach at its own pace. | ||
- There's no central _asset_ registry, just a bunch of URLs. | ||
- Could have a central _list_ of plugins, but not assets. | ||
- We can do both, at low cost. `pkg.json` is a fairly "cheap" approach. LuaRocks | ||
- We can do both, at low cost. `pkg.json` is a fairly "cheap" approach. | ||
- LuaRocks is a "centralized" approach that requires active participation from many plugins. | ||
In contrast, `pkg.json` is a decentralized, "infectious" approach that is useful at the "leaf nodes": | ||
it only requires the consumer to provide a `pkg.json`, the upstream dependencies don't need to be "compliant" or participate in any way. | ||
- LuaRocks + Nvim is starting to see [progress](https://github.com/nvim-neorocks), but momentum will take time. | ||
A decentralized, lowest-common-denominator, "infectious" approach can be tried without losing much time or effort. | ||
- There's no central _asset registry_, just a bunch of URLs. (Though "aggregators" are possible and welcome.) | ||
- LuaRocks has 10x more scope than `pkg.json` and 100x more [unresolved edge cases](https://github.com/luarocks/luarocks/issues/905). | ||
`pkg.json` side-steps all of that by punting the ecosystem-dependent questions to the ecosystem-dependent package manager client. | ||
|
||
## Release | ||
|
||
TBD | ||
|
||
--- | ||
|
||
# OLD | ||
|
||
The neovim package specification consists of three components: | ||
1. Guidelines which provide guidance to package authors, | ||
2. the `packspec` file format, and | ||
3. guidelines for `packspec`-compatible plugin manager implementers | ||
|
||
# Guidelines for plugin authors | ||
|
||
### Semantic versioning | ||
|
||
All Neovim packages should be [semantically versioned](https://semver.org/). While other versioning schema have uses, semver allows for plugin managers to provide smart dependency resolution. | ||
|
||
# The `packspec` file | ||
The Neovim package specification supports a single, top-level package metadata file. This file can be *either* 'packspec.lua' or 'packspec.json'. The format is loosely based on the [Rockspec Format](https://github.com/luarocks/luarocks/wiki/Rockspec-format) and can contain the following fields: | ||
|
||
* `package` (String) the name of the package | ||
|
||
* `version` (String) the version of the package. Should obey semantic versioning conventions, for example `0.1.0`. Plugins should have a git commit with a `tag` matching this version. For all version identifiers, implementation should check for a `version` prefixed with `v` in the git repository, as this is a common convention. | ||
|
||
* `packspec` (String) the current specification version. (0.1.0) at this time. | ||
|
||
* `source` (String) The URL of the package source archive. Examples: "http://github.com/downloads/keplerproject/wsapi/wsapi-1.3.4.tar.gz", "git://github.com/keplerproject/wsapi.git". Different protocols are supported: | ||
|
||
* `file://` - for URLs in the local filesystem (note that for Unix paths, the root slash is the third slash, resulting in paths like "file:///full/path/filename" | ||
* `git://` - for the Git source control manager | ||
* `git+https://` - for the Git source control manager when using repositories that need https:// URLs | ||
* `git+ssh://` - for the Git source control manager when using repositories that need SSH login, such as [email protected]/myrepo | ||
* `http://` - for HTTP URLs | ||
* `https://` - for HTTPS URLs | ||
* `luarocks://` - for Luarocks packages | ||
|
||
* `description` (Table) the description is a table that includes the following nested fields: | ||
* `summary` (String) a short description of the package, typically less than 100 character long. | ||
* `detailed` (String) a long-form description of the package, this should convey the package's principal functionality to the user without being as detailed as the package readme. | ||
* `homepage` (String) This is the homepage of the package, which in most cases will be the GitHub URL. | ||
* `license` (String) This is [SPDX](https://spdx.org/licenses/) license identifier. Dual licensing is indicated via joining the relevant licenses via `/`. | ||
|
||
* `dependencies` (List[Table]) A list of tables describing the package dependencies. Each entry in the table has the following, only `source` is mandatory: | ||
* `version` (String) The version constraints on the package. | ||
* Accepted operators are the relational operators of Lua: == \~= < > <= >= , as well as a special operator, \~>, inspired by the "pessimistic operator" of RubyGems ("\~> 2" means ">= 2, < 3"; "~> 2.4" means ">= 2.4, < 2.5"). No operator means an implicit == (i.e., "lfs 1.0" is the same as "lfs == 1.0"). "lua" is an special dependency name; it matches not a rock, but the version of Lua in use. Multiple version constraints can be joined with a `comma`, e.g. `"neovim >= 5.0, < 7.0"`. | ||
* If no version is specified, then HEAD is assumed valid. | ||
* If no upper bound is specified, then any commit after the tag corresponding to the lower bound is assumed valid. The commit chosen is up to the plugin manager's discretion, but implementers are strongly encouraged to always use the latest valid commit. | ||
* If an upper bound is specified, then the the tag corresponding to that upper bound is the latest commit that is valid | ||
|
||
* `source` (String) The source of the dependency. See previous `source` description. | ||
* `releases_only` (Boolean) Whether the package manager should only resolve version constraints to include tagged releases. | ||
|
||
|
||
* `external_dependencies` (Table) Like dependencies, this specifies packages which are required for the package but should *not* be managed by the Neovim package manager, such as `gcc` or `cmake`. Package managers are encouraged to provide a notification to the user if the dependency is not available. | ||
* `version` (String) same as `dependencies` | ||
|
||
# Example | ||
|
||
```lua | ||
package = "lspconfig" | ||
version = "0.1.2" | ||
specification_version = "0.1.0" | ||
source = "git://github.com/neovim/nvim-lspconfig.git", | ||
description = { | ||
summary = "Quickstart configurations for the Nvim-lsp client", | ||
detailed = [[ | ||
lspconfig is a set of configurations for language servers for use with Neovim's built-in language server client. Lspconfig handles configuring, launching, and attaching language servers. | ||
]], | ||
homepage = "git://github.com/neovim/nvim-lspconfig/", | ||
license = "Apache-2.0" | ||
} | ||
dependencies = { | ||
neovim = { | ||
version = ">= 0.6.1", | ||
source = "git://github.com/neovim/neovim.git" | ||
}, | ||
gitsigns = { | ||
version = "> 0.3", | ||
source = "git://github.com/lewis6991/gitsigns.nvim.git" | ||
} | ||
} | ||
external_dependencies = { | ||
git = { | ||
version = ">= 1.6.0", | ||
}, | ||
} | ||
``` | ||
|
||
And in json format | ||
```json | ||
{ | ||
"package" : "lspconfig", | ||
"version" : "0.1.2", | ||
"specification_version" : "0.1.0", | ||
"source" : "git://github.com/neovim/nvim-lspconfig.git", | ||
"description" : { | ||
"summary" : "Quickstart configurations for the Nvim-lsp client", | ||
"detailed" : "lspconfig is a set of configurations for language servers for use with Neovim's built-in language server client. Lspconfig handles configuring, launching, and attaching language servers", | ||
"homepage" : "https://github.com/neovim/nvim-lspconfig/", | ||
"license" : "Apache-2.0" | ||
}, | ||
"dependencies" : { | ||
"neovim" : { | ||
"version" : ">= 0.6.1", | ||
"source" : "git://github.com/neovim/neovim.git" | ||
}, | ||
"gitsigns" : { | ||
"version" : "> 0.3", | ||
"source" : "git://github.com/lewis6991/gitsigns.nvim.git" | ||
} | ||
}, | ||
"external_dependencies" : { | ||
"git" : { | ||
"version" : ">= 1.6.0", | ||
}, | ||
} | ||
} | ||
``` | ||
|
||
# Guidelines for `packspec` implementers | ||
|
||
The main features that must be implemented to be considered `packspec`-compatible are: | ||
|
||
## Managing package versions | ||
- Must be able to fetch and parse `packspec.json` files | ||
- Must be able to use `git` to retrieve and manipulate package sources | ||
- Must be able to fetch tagged commits for specified package versions | ||
- Must be able to check for updated `packspec.json` files | ||
|
||
## Managing Neovim dependencies | ||
|
||
- Must be able to check the current version of `Neovim` and warn on incompatibility | ||
- Must be able to retrieve and manage the specified versions of dependencies transitively, starting from user-specified packages | ||
- Must either be able to solve for compatible versions of dependency packages across all dependency relationships, or warn users if using a potentially inconsistent version resolution strategy (e.g. picking the first specified version of a dependency). | ||
- [optional] remove dependencies when they are no longer required (transitively) by any user-specified packages | ||
|
||
## Managing external dependencies | ||
|
||
- Must be able to check for the existence of a corresponding executable on the user's system | ||
- [optional] check the version constraints and warn the user if the external dependency are incompatible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# pkg.json client specification | ||
|
||
_Work-in-progress: These guideliens are subject to change._ | ||
|
||
pkg.json clients... | ||
|
||
## Fetching dependencies | ||
|
||
- MUST be able to fetch and parse `pkg.json` files | ||
- MUST be able to use `git` to clone dependencies and query git repo info | ||
- MUST be able to fetch tagged commits for specified package versions | ||
- MUST be able to check for updated `pkg.json` files | ||
|
||
## Resolving dependencies | ||
|
||
- MUST be able to check the current version of `Neovim` and warn on incompatibility | ||
- MUST be able to fetch and manage the specified versions of dependencies transitively: if dependencies have `pkg.json`, read it and process it, recursively. | ||
- MUST either be able to solve for compatible versions of dependency packages across all dependency relationships, or warn users if using a potentially inconsistent version resolution strategy (e.g. picking the first specified version of a dependency). | ||
- MAY remove dependencies when they are no longer required (transitively) by any user-specified packages |
Oops, something went wrong.