You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sharing/index.md
+39-14Lines changed: 39 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ These are stored as YAML files in `.github/workflows`, with a slightly convolute
58
58
For instance, the file `CI.yml` contains instructions that execute the tests of your package (see below) for each pull request, tag or push to the `main` branch.
59
59
This is done on a GitHub server and should theoretically cost you money, but your GitHub repository is public, you get an unlimited workflow budget for free.
60
60
61
-
A variety workflows and functionalities are available through optional [plugins](https://juliaci.github.io/PkgTemplates.jl/stable/user/#Plugins-1).
61
+
A variety of workflows and functionalities are available through optional [plugins](https://juliaci.github.io/PkgTemplates.jl/stable/user/#Plugins-1).
62
62
The interactive setting `Template(..., interactive=true)` allows you to select the ones you want for a given package.
63
63
Otherwise, you will get the [default selection](https://juliaci.github.io/PkgTemplates.jl/stable/user/#Default-Plugins), which you are encouraged to look at.
64
64
@@ -82,19 +82,32 @@ Such tests belong in `test/runtests.jl`, and they are executed with the `]test`
82
82
Unit testing may seem rather naive, or even superfluous, but as your code grows more complex, it becomes easier to break something without noticing.
83
83
Testing each part separately will increase the reliability of the software you write.
84
84
85
+
\advanced{
86
+
87
+
To test the arguments provided to the functions within your code (for instance their sign or value), avoid `@assert` (which can be deactivated) and use [ArgCheck.jl](https://github.com/jw3126/ArgCheck.jl) instead.
88
+
89
+
}
90
+
85
91
At some point, your package may require [test-specific dependencies](https://pkgdocs.julialang.org/v1/creating-packages/#Adding-tests-to-the-package).
86
92
This often happens when you need to test compatibility with another package, on which you do not depend for the source code itself.
87
93
Or it may simply be due to testing-specific packages like the ones we will encounter below.
88
94
For interactive testing work, use [TestEnv.jl](https://github.com/JuliaTesting/TestEnv.jl) to activate the full test environment (faster than running `]test` repeatedly).
89
95
96
+
\vscode{
97
+
98
+
The Julia extension also has its own testing framework, which relies on sprinkling "test items" throughout the code.
99
+
See [TestItemRunner.jl](https://github.com/julia-vscode/TestItemRunner.jl) and [ReTestItems.jl](https://github.com/JuliaTesting/ReTestItems.jl) for indications on how to use them optimally.
100
+
101
+
}
102
+
90
103
\advanced{
91
104
92
105
If you want to have more control over your tests, you can try
93
106
94
107
*[ReferenceTests.jl](https://github.com/JuliaTesting/ReferenceTests.jl) to compare function outputs with reference files.
95
108
*[ReTest.jl](https://github.com/JuliaTesting/ReTest.jl) to define tests next to the source code and control their execution.
96
-
*[TestItemRunner.jl](https://github.com/julia-vscode/TestItemRunner.jl)and [ReTestItems.jl](https://github.com/JuliaTesting/ReTestItems.jl)to leverage the testing interface of VSCode.
97
-
*[TestReadme.jl](https://github.com/thchr/TestReadme.jl) to test whatever samples are in your README
109
+
*[TestSetExtensions.jl](https://github.com/ssfrr/TestSetExtensions.jl) to make test set outputs more readable.
110
+
*[TestReadme.jl](https://github.com/thchr/TestReadme.jl) to test whatever code samples are in your README.
98
111
99
112
}
100
113
@@ -130,7 +143,7 @@ The [default formatter](https://www.julia-vscode.org/docs/stable/userguide/forma
130
143
131
144
\advanced{
132
145
133
-
You can format code automatically in GitHub pull requests with the [`julia-format` action](https://github.com/julia-actions/julia-format).
146
+
You can format code automatically in GitHub pull requests with the [`julia-format` action](https://github.com/julia-actions/julia-format), or add the formatting check directly to your test suite.
134
147
135
148
}
136
149
@@ -142,7 +155,7 @@ It is usually a good idea to include the following in your tests:
142
155
143
156
```>aqua
144
157
using Aqua, MyAwesomePackage
145
-
Aqua.test_all(MyAwesomePackage);
158
+
Aqua.test_all(MyAwesomePackage)
146
159
```
147
160
148
161
Meanwhile, [JET.jl](https://github.com/aviatesk/JET.jl) is a complementary tool, similar to a static linter.
@@ -184,7 +197,9 @@ Unsurprisingly, its own [documentation](https://documenter.juliadocs.org/stable/
184
197
To build the documentation locally, just run
185
198
186
199
```julia-repl
187
-
julia> using Pkg; Pkg.activate("docs")
200
+
julia> using Pkg
201
+
202
+
julia> Pkg.activate("docs")
188
203
189
204
julia> include("docs/make.jl")
190
205
```
@@ -203,11 +218,11 @@ The only thing left to do is to [select the `gh-pages` branch as source](https:/
203
218
204
219
\advanced{
205
220
221
+
[DocumenterCitations.jl](https://github.com/ali-ramadhan/DocumenterCitations.jl) allows you to insert citations inside the documentation website from a BibTex file.
222
+
206
223
Assuming you are looking for an alternative to Documenter.jl, you can try out [Pollen.jl](https://github.com/lorenzoh/Pollen.jl).
207
224
In another category, [Replay.jl](https://github.com/AtelierArith/Replay.jl) allows you to replay instructions entered into your terminal as an ASCII video, which is nice for tutorials.
208
225
209
-
[DocumenterCitations.jl](https://github.com/ali-ramadhan/DocumenterCitations.jl) allows you to insert citations inside the documentation website from a BibTex file.
210
-
211
226
}
212
227
213
228
## Literate programming
@@ -235,12 +250,21 @@ To prevent that, the [julia-downgrade-compat](https://github.com/julia-actions/j
235
250
236
251
}
237
252
238
-
If your package is useful to others in the community, it may be a good idea to register it, that is, make it part of the pool of packages that can be installed with `Pkg.add(MyAwesomePackage)`.
239
-
Note that unregistered packages can also be installed by anyone, but the command is slightly different: `Pkg.add(url="https://github.com/myuser/MyAwesomePackage")`.
253
+
If your package is useful to others in the community, it may be a good idea to register it, that is, make it part of the pool of packages that can be installed with
254
+
255
+
```julia-repl
256
+
pkg> add MyAwesomePackage # made possible by registration
257
+
```
258
+
259
+
Note that unregistered packages can also be installed by anyone from the GitHub URL, but this a less reproducible solution:
260
+
261
+
```julia-repl
262
+
pkg> add https://github.com/myuser/MyAwesomePackage # not ideal
263
+
```
240
264
241
265
To register your package, check out the [general registry](https://github.com/JuliaRegistries/General) guidelines.
242
266
The [Registrator.jl](https://github.com/JuliaRegistries/Registrator.jl) bot can help you automate the process.
243
-
Another handy botis [TagBot](https://github.com/JuliaRegistries/TagBot), which automatically tags new versions of your package following each release: yet another default plugin in the PkgTemplates.jl setup.
267
+
Another handy bot, provided by default with PkgTemplates.jl, is [TagBot](https://github.com/JuliaRegistries/TagBot): it automatically tags new versions of your package following each registry release.
244
268
If you have performed the [necessary SSH configuration](https://documenter.juliadocs.org/stable/man/hosting/#travis-ssh), TagBot will also trigger documentation website builds following each release.
245
269
246
270
\advanced{
@@ -265,16 +289,19 @@ Similarly, your papers should cite the packages you use as dependencies: [PkgCit
265
289
266
290
## Interoperability
267
291
292
+
To ensure compatibility with earlier Julia versions, [Compat.jl](https://github.com/JuliaLang/Compat.jl) is your best ally.
293
+
268
294
Making packages play nice with one another is a key goal of the Julia ecosystem.
269
295
Since Julia 1.9, this can be done with [package extensions](https://pkgdocs.julialang.org/v1/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)), which override specific behaviors based on the presence of a given package in the environment.
270
296
[PackageExtensionTools.jl](https://github.com/cjdoris/PackageExtensionTools.jl) eases the pain of setting up extensions.
271
-
As for compatibility with earlier Julia versions, [Compat.jl](https://github.com/JuliaLang/Compat.jl) is your best ally.
272
297
273
298
Furthermore, the Julia ecosystem as a whole plays nice with other programming languages too.
274
299
[C and Fortran](https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/) are natively supported.
275
300
Python can be easily interfaced with the combination of [CondaPkg.jl](https://github.com/cjdoris/CondaPkg.jl) and [PythonCall.jl](https://github.com/cjdoris/PythonCall.jl).
276
301
Other language compatibility packages can be found in the [JuliaInterop](https://github.com/JuliaInterop) organization, like [RCall.jl](https://github.com/JuliaInterop/RCall.jl).
277
302
303
+
Part of interoperability is also flexibility and customization: the [Preferences.jl](https://github.com/JuliaPackaging/Preferences.jl) package gives a nice way to specify various options in TOML files.
304
+
278
305
\advanced{
279
306
280
307
Some package developers may need to define what kind of behavior they expect from a certain type, or what a certain method should do.
@@ -283,8 +310,6 @@ This problem of "interfaces" does not yet have a definitive solution in Julia, b
283
310
284
311
}
285
312
286
-
Part of interoperability is also flexibility and customization: the [Preferences.jl](https://github.com/JuliaPackaging/Preferences.jl) package gives a nice way to specify various options in TOML files.
287
-
288
313
## Collaboration
289
314
290
315
Once your package grows big enough, you might need to bring in some help.
0 commit comments