|
1 | | ---- |
2 | | -title: Contributing |
3 | | -aliases: |
4 | | - - ../../tutorials/docs-01-contributing-guide/index.html |
5 | | ---- |
6 | | - |
7 | | -Turing is an open-source project and is [hosted on GitHub](https://github.com/TuringLang). |
8 | | -We welcome contributions from the community in all forms large or small: bug reports, feature implementations, code contributions, or improvements to documentation or infrastructure are all extremely valuable. |
9 | | -We would also very much appreciate examples of models written using Turing. |
10 | | - |
11 | | -### How to get involved |
12 | | - |
13 | | -Our outstanding issues are tabulated on our [issue tracker](https://github.com/TuringLang/Turing.jl/issues). |
14 | | -Closing one of these may involve implementing new features, fixing bugs, or writing example models. |
15 | | - |
16 | | -You can also join the `#turing` channel on the [Julia Slack](https://julialang.org/slack/) and say hello! |
17 | | - |
18 | | -If you are new to open-source software, please see [GitHub's introduction](https://guides.github.com/introduction/flow/) or [Julia's contribution guide](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md) on using version control for collaboration. |
19 | | - |
20 | | -### Documentation |
21 | | - |
22 | | -Each of the packages in the Turing ecosystem (see [Libraries](/library)) has its own documentation, which is typically found in the `docs` folder of the corresponding package. |
23 | | -For example, the source code for DynamicPPL's documentation can be found in [its repository](https://github.com/TuringLang/DynamicPPL.jl). |
24 | | - |
25 | | -The documentation for Turing.jl itself consists of the tutorials that you see on this website, and is built from the separate [`docs` repository](https://github.com/TuringLang/docs). |
26 | | -None of the documentation is generated from the [main Turing.jl repository](https://github.com/TuringLang/Turing.jl); in particular, the API that Turing exports does not currently form part of the documentation. |
27 | | - |
28 | | -Other sections of the website (anything that isn't a package, or a tutorial) – for example, the list of libraries – is built from the [`turinglang.github.io` repository](https://github.com/TuringLang/turinglang.github.io). |
29 | | - |
30 | | -### Tests |
31 | | - |
32 | | -Turing, like most software libraries, has a test suite. You can run the whole suite by running `julia --project=.` from the root of the Turing repository, and then running |
33 | | - |
34 | | -```julia |
35 | | -import Pkg; Pkg.test("Turing") |
36 | | -``` |
37 | | - |
38 | | -The test suite subdivides into files in the `test` folder, and you can run only some of them using commands like |
39 | | - |
40 | | -```julia |
41 | | -import Pkg; Pkg.test("Turing"; test_args=["optim", "hmc", "--skip", "ext"]) |
42 | | -``` |
43 | | - |
44 | | -This one would run all files with "optim" or "hmc" in their path, such as `test/optimisation/Optimisation.jl`, but not files with "ext" in their path. Alternatively, you can set these arguments as command line arguments when you run Julia |
45 | | - |
46 | | -```julia |
47 | | -julia --project=. -e 'import Pkg; Pkg.test(; test_args=ARGS)' -- optim hmc --skip ext |
48 | | -``` |
49 | | - |
50 | | -Or otherwise, set the global `ARGS` variable, and call `include("test/runtests.jl")`. |
51 | | - |
52 | | -### Style Guide |
53 | | - |
54 | | -Turing has a style guide, described below. |
55 | | -Reviewing it before making a pull request is not strictly necessary, but you may be asked to change portions of your code to conform with the style guide before it is merged. |
56 | | - |
57 | | -Most Turing code follows [Blue: a Style Guide for Julia](https://github.com/JuliaDiff/BlueStyle). |
58 | | -These conventions were created from a variety of sources including Python's [PEP8](http://legacy.python.org/dev/peps/pep-0008/), Julia's [Notes for Contributors](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md), and Julia's [Style Guide](https://docs.julialang.org/en/v1/manual/style-guide/). |
59 | | - |
60 | | -#### Synopsis |
61 | | - |
62 | | - - Use 4 spaces per indentation level, no tabs. |
63 | | - - Try to adhere to a 92 character line length limit. |
64 | | - - Use upper camel case convention for [modules](https://docs.julialang.org/en/v1/manual/modules/) and [types](https://docs.julialang.org/en/v1/manual/types/). |
65 | | - - Use lower case with underscores for method names (note: Julia code likes to use lower case without underscores). |
66 | | - - Comments are good, try to explain the intentions of the code. |
67 | | - - Use whitespace to make the code more readable. |
68 | | - - No whitespace at the end of a line (trailing whitespace). |
69 | | - - Avoid padding brackets with spaces. ex. `Int64(value)` preferred over `Int64( value )`. |
70 | | - |
71 | | -#### A Word on Consistency |
72 | | - |
73 | | -When adhering to the Blue style, it's important to realize that these are guidelines, not rules. This is [stated best in the PEP8](http://legacy.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds): |
74 | | - |
75 | | -> A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is most important. |
76 | | -
|
77 | | -> But most importantly: know when to be inconsistent – sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask! |
78 | | -
|
| 1 | +--- |
| 2 | +title: Contributing |
| 3 | +aliases: |
| 4 | + - ../../tutorials/docs-01-contributing-guide/index.html |
| 5 | +--- |
| 6 | + |
| 7 | +Turing is an open-source project and is [hosted on GitHub](https://github.com/TuringLang). |
| 8 | +We welcome contributions from the community in all forms large or small: bug reports, feature implementations, code contributions, or improvements to documentation or infrastructure are all extremely valuable. |
| 9 | +We would also very much appreciate examples of models written using Turing. |
| 10 | + |
| 11 | +### How to get involved |
| 12 | + |
| 13 | +Our outstanding issues are tabulated on our [issue tracker](https://github.com/TuringLang/Turing.jl/issues). |
| 14 | +Closing one of these may involve implementing new features, fixing bugs, or writing example models. |
| 15 | + |
| 16 | +You can also join the `#turing` channel on the [Julia Slack](https://julialang.org/slack/) and say hello! |
| 17 | + |
| 18 | +If you are new to open-source software, please see [GitHub's introduction](https://guides.github.com/introduction/flow/) or [Julia's contribution guide](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md) on using version control for collaboration. |
| 19 | + |
| 20 | +### Documentation |
| 21 | + |
| 22 | +Each of the packages in the Turing ecosystem (see [Libraries](/library)) has its own documentation, which is typically found in the `docs` folder of the corresponding package. |
| 23 | +For example, the source code for DynamicPPL's documentation can be found in [its repository](https://github.com/TuringLang/DynamicPPL.jl). |
| 24 | + |
| 25 | +The documentation for Turing.jl itself consists of the tutorials that you see on this website, and is built from the separate [`docs` repository](https://github.com/TuringLang/docs). |
| 26 | +None of the documentation is generated from the [main Turing.jl repository](https://github.com/TuringLang/Turing.jl); in particular, the API that Turing exports does not currently form part of the documentation. |
| 27 | + |
| 28 | +Other sections of the website (anything that isn't a package, or a tutorial) – for example, the list of libraries – is built from the [`turinglang.github.io` repository](https://github.com/TuringLang/turinglang.github.io). |
| 29 | + |
| 30 | +### Tests |
| 31 | + |
| 32 | +Turing, like most software libraries, has a test suite. You can run the whole suite by running `julia --project=.` from the root of the Turing repository, and then running |
| 33 | + |
| 34 | +```julia |
| 35 | +import Pkg; Pkg.test("Turing") |
| 36 | +``` |
| 37 | + |
| 38 | +The test suite subdivides into files in the `test` folder, and you can run only some of them using commands like |
| 39 | + |
| 40 | +```julia |
| 41 | +import Pkg; Pkg.test("Turing"; test_args=["optim", "hmc", "--skip", "ext"]) |
| 42 | +``` |
| 43 | + |
| 44 | +This one would run all files with "optim" or "hmc" in their path, such as `test/optimisation/Optimisation.jl`, but not files with "ext" in their path. Alternatively, you can set these arguments as command line arguments when you run Julia |
| 45 | + |
| 46 | +```julia |
| 47 | +julia --project=. -e 'import Pkg; Pkg.test(; test_args=ARGS)' -- optim hmc --skip ext |
| 48 | +``` |
| 49 | + |
| 50 | +Or otherwise, set the global `ARGS` variable, and call `include("test/runtests.jl")`. |
| 51 | + |
| 52 | +### Style Guide |
| 53 | + |
| 54 | +Turing has a style guide, described below. |
| 55 | +Reviewing it before making a pull request is not strictly necessary, but you may be asked to change portions of your code to conform with the style guide before it is merged. |
| 56 | + |
| 57 | +Most Turing code follows [Blue: a Style Guide for Julia](https://github.com/JuliaDiff/BlueStyle). |
| 58 | +These conventions were created from a variety of sources including Python's [PEP8](http://legacy.python.org/dev/peps/pep-0008/), Julia's [Notes for Contributors](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md), and Julia's [Style Guide](https://docs.julialang.org/en/v1/manual/style-guide/). |
| 59 | + |
| 60 | +#### Synopsis |
| 61 | + |
| 62 | + - Use 4 spaces per indentation level, no tabs. |
| 63 | + - Try to adhere to a 92 character line length limit. |
| 64 | + - Use upper camel case convention for [modules](https://docs.julialang.org/en/v1/manual/modules/) and [types](https://docs.julialang.org/en/v1/manual/types/). |
| 65 | + - Use lower case with underscores for method names (note: Julia code likes to use lower case without underscores). |
| 66 | + - Comments are good, try to explain the intentions of the code. |
| 67 | + - Use whitespace to make the code more readable. |
| 68 | + - No whitespace at the end of a line (trailing whitespace). |
| 69 | + - Avoid padding brackets with spaces. ex. `Int64(value)` preferred over `Int64( value )`. |
| 70 | + |
| 71 | +#### A Word on Consistency |
| 72 | + |
| 73 | +When adhering to the Blue style, it's important to realize that these are guidelines, not rules. This is [stated best in the PEP8](http://legacy.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds): |
| 74 | + |
| 75 | +> A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is most important. |
| 76 | +
|
| 77 | +> But most importantly: know when to be inconsistent – sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask! |
| 78 | +
|
0 commit comments