|
| 1 | +--- |
| 2 | +title: "Package Control: Submitting a package" |
| 3 | +--- |
| 4 | + |
| 5 | +<!-- Originals: --> |
| 6 | +<!-- https://packagecontrol.io/docs/submitting_a_package --> |
| 7 | +<!-- https://github.com/wbond/packagecontrol.io/blob/master/app/html/docs/submitting_a_package.html --> |
| 8 | + |
| 9 | +# Submitting a package |
| 10 | + |
| 11 | +One of the reasons developers love Sublime Text |
| 12 | +is because of the unmatched breadth and quality of the package ecosystem |
| 13 | +and community. |
| 14 | +Package Control is the community project that helps users find, |
| 15 | +install, and update packages. |
| 16 | + |
| 17 | +If you've taken the time to develop a package, |
| 18 | +please consider adding it to the default Package Control channel |
| 19 | +so users can easily install and keep your package up-to-date. |
| 20 | + |
| 21 | + |
| 22 | +## Review existing packages |
| 23 | + |
| 24 | +Start by looking for similar packages you might be able to contribute to. |
| 25 | + |
| 26 | +We strongly encourage improving or adding to existing packages. |
| 27 | +This means that packages are of higher quality, |
| 28 | +and users don't have to choose from several similar options. |
| 29 | +We regularly replace packages that have become outdated |
| 30 | +with newer implementations. |
| 31 | + |
| 32 | + |
| 33 | +## Pick a name |
| 34 | + |
| 35 | +Beyond taste there are some technical aspects to keep in mind |
| 36 | +when naming your package. |
| 37 | +A package is a directory, so the name must be safe for use in that context. |
| 38 | +And a package is (often) a Python module, |
| 39 | +meaning Python needs to be able to load it properly. |
| 40 | +Also think about how users will be able to search for your package: |
| 41 | +you don't want users to have to type in special characters or diacritics, |
| 42 | +to be able to find it. |
| 43 | + |
| 44 | +Some rules to follow: |
| 45 | + |
| 46 | +- Try not to use the word "Sublime" in your package name. |
| 47 | + Every package available via Package Control is for Sublime Text. |
| 48 | + Using the word Sublime just adds noise to the list |
| 49 | + when trying to find packages. |
| 50 | + You can use the word Sublime in your marketing material |
| 51 | + (README etc.) though of course. |
| 52 | +- Don't use a name too similar to another: we don't want Todo and T0d0. |
| 53 | +- Don't use snake_case. |
| 54 | + There are minor technical reasons to avoid that, |
| 55 | + but mostly it's just very uncommon (in other words, it looks weird). |
| 56 | +- Don't use a `.` in the package name. |
| 57 | + If your package includes any Python code, it will not load in Sublime Text. |
| 58 | + This is because Python uses . as a folder separator when importing code. |
| 59 | +- Don't use a `/` or other restricted characters in the package name. |
| 60 | + Invalid characters include: |
| 61 | + `<`, `\>`, `:`, `"`, `/`, `\`, `|`, `?` and `*`. |
| 62 | +- Use ASCII only. |
| 63 | +- Language support (aka "syntax" or "grammar") packages |
| 64 | + are named after the language it supports, |
| 65 | + without suffixes like "syntax" or "highlighting". |
| 66 | + |
| 67 | +Note that the package name is used in references to resources, |
| 68 | +for instance settings files. |
| 69 | +If your package name is different from its Git repository name, |
| 70 | +make sure you rename the local clone to match. |
| 71 | + |
| 72 | + |
| 73 | +## Decide how to host |
| 74 | + |
| 75 | +Pick one of the following two hosting options: |
| 76 | + |
| 77 | +- A public GitHub, Bitbucket or GitLab repository. |
| 78 | + Only include one package per Git repository |
| 79 | + and be sure the root of the package is the root of the repository. |
| 80 | + Do not include a packages.json file in your repository. |
| 81 | +- Host `.sublime-package` files and a `packages.json` on a web server with SSL. |
| 82 | + For each release you'll need to create and upload a new package file |
| 83 | + and update the `packages.json` information. |
| 84 | + Also see the [repository.json documentation][repo]. |
| 85 | + |
| 86 | +When using a public Git repository, |
| 87 | +you will need to create a tag each time |
| 88 | +you want to make a new version available to users. |
| 89 | +The tag names must be a [semantic version number][semver]. |
| 90 | + |
| 91 | +If you chose self-hosting, |
| 92 | +you will need to use semantic versioning in your `packages.json` file. |
| 93 | + |
| 94 | + |
| 95 | +## Prepare your Git repository |
| 96 | + |
| 97 | +- Create a [semver-numbered][semver] tag. |
| 98 | +- Ensure there are no `.pyc` files in your repository. |
| 99 | +- Remove `package-metadata.json`. |
| 100 | + This is automatically generated by Package Control |
| 101 | + when a package is installed |
| 102 | + and should not be in your repository. |
| 103 | +- Check file names for cross-platform compatibility, |
| 104 | + the same restricted characters apply as in your package name. |
| 105 | +- Under very specific circumstances, |
| 106 | + like including executables or shared libraries, |
| 107 | + add a `.no-sublime-package` file to the root of your repository. |
| 108 | + This file will prevent Package Control from shipping your package |
| 109 | + as a zipped `.sublime-package` file. |
| 110 | + It is not needed for bundling Python modules. |
| 111 | + If a module uses numerous absolute imports |
| 112 | + to import parts of itself |
| 113 | + and an addition to `sys.path` is necessary, |
| 114 | + this also works if the package is archived |
| 115 | + because of Python's internal ziploader. |
| 116 | + |
| 117 | + |
| 118 | +## Add your Git repository to the default channel |
| 119 | + |
| 120 | +Fork the [Package Control Channel][pcc]. Then: |
| 121 | + |
| 122 | +- For packages hosted on a public GitHub, Bitbucket or GitLab URL, |
| 123 | + add your package information to the correct file in the repository directory. |
| 124 | + For full details of the possibilities, |
| 125 | + please refer to the [repository.json documentation][repo]. |
| 126 | +- For self-hosted packages |
| 127 | + add the URL of your repository JSON file to the `channel.json` |
| 128 | + in the root directory. |
| 129 | + |
| 130 | + |
| 131 | +## Submit a pull request |
| 132 | + |
| 133 | +Now you're ready to push your changes and make a PR |
| 134 | +on the [Package Control Channel][pcc] repository. |
| 135 | +Follow any guidelines there and make sure the tests pass! |
| 136 | + |
| 137 | +For a cleaner process, |
| 138 | +you should only submit one package per PR. |
| 139 | +This allows package submissions to be reviewed and merged independenly. |
| 140 | + |
| 141 | +Note that this is a community project |
| 142 | +and people review PRs in their spare time; |
| 143 | +it might take a while. |
| 144 | + |
| 145 | +[repo]: /reference/package-control/repository.md |
| 146 | +[pcc]: https://github.com/wbond/package_control_channel |
| 147 | + |
| 148 | + |
| 149 | +### LSP and SublimeLinter |
| 150 | + |
| 151 | +Plugins for the LSP or SublimeLinter frameworks should be submitted to the repositories where those teams manage related packages: |
| 152 | + |
| 153 | +- Linter packages should be submitted over at [SublimeLinter][sl]. |
| 154 | +- Similarly, any language server protocol packages |
| 155 | + are managed via [SublimeLSP][lsp]. |
| 156 | + |
| 157 | +[sl]: https://github.com/SublimeLinter/package_control_channel |
| 158 | +[lsp]: https://github.com/SublimeLinter/package_control_channel |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | +### Things that help your submission get approved more quickly |
| 163 | + |
| 164 | +- We only accept submissions from maintainers of the package being submitted. |
| 165 | +- A valid [semver][] numbered tag must exist on the repository. |
| 166 | +- Ensure the README clearly describes the purpose of the package |
| 167 | + and how to use it. |
| 168 | +- We strongly advise against adding features to the context menu in most cases, |
| 169 | + because space in this menu is very limited. |
| 170 | + In any case, |
| 171 | + features should apply to the specific context, |
| 172 | + their visibility should be conditional, |
| 173 | + and preferably configurable. |
| 174 | +- We strongly advice against adding keybindings by default. |
| 175 | + There aren't enough keys for all packages, |
| 176 | + so you risk overriding those of other packages. |
| 177 | + Instead, provide commented out suggestions in a keymap file, |
| 178 | + and/or explain how to create bindings in your README. |
| 179 | +- Ensure preferences and keybindings (if any) |
| 180 | + are listed in the menu and the command palette, |
| 181 | + and open in split view (i.e. using `edit_settings`, not `open_file`). |
| 182 | +- Language support packages should not ship with color schemes |
| 183 | + to specifically support the language. |
| 184 | + Please review common [scope names][scopes] |
| 185 | + that will allow any color scheme to support your language. |
| 186 | +- Note that the [`git-archive`][arch] feature is used to create the package file, |
| 187 | + meaning you can use [`.gitattributes`][attr] to exclude images and other files |
| 188 | + that have no functionality in the package |
| 189 | + (typically drastically reducing file size of your package |
| 190 | + when images are included in the repository). |
| 191 | + |
| 192 | +[scopes]: https://www.sublimetext.com/docs/scope_naming.html |
| 193 | +[attr]: https://www.git-scm.com/docs/gitattributes#_export_ignore |
| 194 | +[arch]: https://git-scm.com/docs/git-archive |
| 195 | + |
| 196 | + |
| 197 | +### What labels to use |
| 198 | + |
| 199 | +For labels, please follow these recommendations: |
| 200 | + |
| 201 | +- Labels are always in lowercase. |
| 202 | +- Packages that provide ... |
| 203 | + - a [language syntax][syntax] have the "language syntax" label. |
| 204 | + - (the colors for) [syntax highlighting][colors] |
| 205 | + have the "color scheme" label, |
| 206 | + whereas packages that provide [theming for the UI][theme] |
| 207 | + have the "theme" label. |
| 208 | + - a [build system][build] have the "build system" label. |
| 209 | + - [snippets][snip] have the "snippets" label. |
| 210 | + - [completion metadata][complete] have the "completions" label. |
| 211 | + - any other kind of auto-complete have the "auto-complete" label. |
| 212 | + - formatters have the "formatting" label, |
| 213 | + and optionally "prettify" or "minify", if appropriate. |
| 214 | + - utilities have the "utilities" label. |
| 215 | + |
| 216 | +[syntax]: https://www.sublimetext.com/docs/syntax.html |
| 217 | +[colors]:https://www.sublimetext.com/docs/color_schemes.html |
| 218 | +[theme]: https://www.sublimetext.com/docs/themes.html |
| 219 | +[build]: https://www.sublimetext.com/docs/build_systems.html |
| 220 | +[snip]: https://www.sublimetext.com/docs/completions.html#snippets |
| 221 | +[complete]: https://www.sublimetext.com/docs/completions.html#completion-metadata |
| 222 | + |
| 223 | +[semver]: http://semver.org |
0 commit comments