Skip to content

Commit f9b34b9

Browse files
DOC: improvements to developers documentation
1 parent d0c0f61 commit f9b34b9

File tree

6 files changed

+277
-16
lines changed

6 files changed

+277
-16
lines changed

docs/development/first_pr.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Your first Pull Request (PR)
2+
============================
3+
4+
This page describes a few steps to help you get started with your first PR to RocketPy.
5+
We are excited to have you here!
6+
7+
Picking an issue
8+
----------------
9+
10+
Before you start coding, you should pick an issue to work on. You can find a
11+
list of issues in the `Issues`_ tab on GitHub.
12+
.. _Issues: https://github.com/RocketPy-Team/RocketPy/issues
13+
If you are new hear, it is really recommended that you talk to maintainers
14+
before starting to work on an issue.
15+
That way you avoid working on something that is already being worked on or
16+
something that is not in line with the project's goals.
17+
18+
If you want to develop a new feature that is not in the issues list, please open
19+
a new issue to discuss it with the maintainers before submitting a PR.
20+
21+
Once the issue is assigned to you, you can start working on it.
22+
23+
24+
25+
Creating a new branch
26+
---------------------
27+
28+
At your local machine, ...
29+
30+
Opening the PR
31+
--------------
32+
33+
When you open a PR, you should:
34+
35+
* Use labels to help maintainers understand what the PR is about.
36+
* Link any issue that may be closed when the PR is merged.
37+
38+
39+
Remember, the PR is yours, not ours! You should keep track of it and update it as needed.
40+
41+
42+
Continuous Integration (CI)
43+
---------------------------
44+
45+
There are several automation on our repository to help us maintain the code quality.
46+
47+
Currently, our CI pipeline runs the following checks:
48+
49+
* **Linting**: we run `flake8`, `pylint`, `black` and `isort` on top of your latest commit in order to check for code style issues. To understand more about these tools, please read ...
50+
* **Testing**: we run the tests defined in the `tests` folder to make sure your changes do not break any existing functionality. The tests will be executed 6 times, each time with a different Python version (the oldest and newest supported version) and with three different operating systems (Windows, Linux and MacOS).
51+
* **Coverage**: based on the tests results, we also check the code coverage. There is an automation to check if the code coverage increased or decreased with your PR. It also points
52+
53+
Once you open your PR or commit and push to your branch, the CI will be initialized.
54+
Please correct any issues that may arise from the CI checks.
55+
56+
.. note::
57+
58+
All the commands we run in the CI pipeline can also be run locally. It is important \
59+
that you run the checks locally before pushing your changes to the repository.
60+
61+
The CHANGELOG file
62+
------------------
63+
64+
We keep track of the changes in the `CHANGELOG.md` file. When you open a PR, you should add a new entry to the `Unreleased` section of the file. This entry should simply be the title of your PR.
65+
66+
.. note::
67+
68+
In the future we would like to automate the CHANGELOG update, but for now \
69+
it is a manual process, unfortunately.
70+

docs/development/index.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
Contributing to RocketPy
22
========================
33

4+
Here you will find information on how to contribute to our code base.
5+
RocketPy is an open-source project and we welcome contributions from everyone.
6+
There are a few guidelines we would like to share with you to make the as
7+
smooth as possible:
8+
49
.. toctree::
510
:maxdepth: 2
611
:caption: Contents:
712

13+
Setting Up the repository <setting_up.rst>
814
Running RocketPy as a Developer <rocketpy_as_developer.rst>
15+
Your First Pull Request (PR) <first_pr.rst>
916
Style Guide <style_guide>
1017
Testing Guidelines <testing.rst>
1118
RocketPy with Docker <docker.rst>
1219
Building the Documentation <build_docs.rst>
20+
Pro Tips <pro_tips.rst>
21+
22+
23+
.. important::
1324

14-
This section is still a work in progress. Here you will find information on how to contribute to our code base.
25+
Our Development Documentation matters as much as the Usage Documentation to us. \
26+
In case you find any trouble when following this guide, please let us know so \
27+
we can improve it.

docs/development/pro_tips.rst

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
Pro Tips
2+
========
3+
4+
Last but not least, here are some pro tips that can help you to be more
5+
productive when developing in the project (or any other project).
6+
7+
8+
Makefile
9+
--------
10+
11+
We have a `Makefile` in the repository that contains some useful commands to
12+
help you with the development process.
13+
14+
Some examples of commands are:
15+
16+
* ``make black``: runs the black formatter on the code.
17+
* ``make format``: runs the isort and black formatters on the code.
18+
* ``lint``: runs the flake8 and pylint tools.
19+
* ``build-docs``: This will build the documentation locally, so you can check if everything is working as expected.
20+
* ``pytest-slow``: runs only the slow tests (marked with the `@pytest.mark.slow` decorator).
21+
22+
These commands are meant to be system agnostic, so you can run them on any
23+
Operational System (OS).
24+
25+
Knowing your editor
26+
-------------------
27+
28+
Something we usually notice on beginners is that they don't know all the power
29+
their editor can provide. Knowing your editor can save you a lot of time and
30+
make you more productive.
31+
32+
As stated earlier, we recommend using VS Code as your editor, as most of the
33+
RocketPy developers use it. Therefore it is easier to help you if you are using
34+
the same editor.
35+
36+
Some of the features that can help you are:
37+
38+
...
39+
40+
Extensions
41+
----------
42+
43+
We have listed some recommended extensions in the `.vscode/extensions.json` file.
44+
These are general recommendations based on what our developers usually install
45+
in their VSCode.
46+
Obviously, it is not mandatory to install them, but they can help you to be more
47+
productive.
48+
49+
50+
Code assistance
51+
---------------
52+
53+
Artificial Intelligence (AI) assistance has becoming more and more common in
54+
software development.
55+
Some editors have AI assistance built-in.
56+
Famous options are GitHub Copilot, and
57+
58+
At this repo, the use of AI tools is welcome, we don't have any restrictions
59+
against it.
60+
61+
A few possible applications of AI tools are:
62+
63+
* Writing documentation.
64+
* Writing tests.
65+
* Getting explanations of code sections.
66+
67+
.. tip::
68+
69+
As of today, November 2024, GitHub Copilot still provides free access for \
70+
university email addresses. We can't guarantee this will still be the case \
71+
when you are reading this, so check the GitHub Copilot website for more \
72+
information.
73+
74+
75+
If you are against the use of AI tools, do not worry, you can still contribute
76+
to the project without using them.
77+
78+
79+
Engaging with the community
80+
---------------------------
81+
82+
The most important part of contributing to an open-source project is engaging
83+
with the community.
84+
Our developers are frequently available on the `Discord`_ server, and you can
85+
ask any questions you may have there.
86+
Either a question about the project, or a question about how to contribute, or
87+
even a suggestion of a new feature.
88+
Any kind of interaction is welcome.

docs/development/rocketpy_as_developer.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ For example, to open VS Code type on terminal
2727
2828
Alternatively, you can open the folder directly through your editor's interface.
2929

30+
.. tip::
31+
32+
Although it is not mandatory, we recommend using VS Code as your editor, as \
33+
most (to not say all) of the RocketPy developers use it. Therefore it is easier \
34+
to help you if you are using the same editor.
35+
36+
3037
Preparing directory for code editing
3138
====================================
3239

@@ -129,7 +136,7 @@ The motor class contains information about the thrust curve and uses some geomet
129136
.. code-block:: python
130137
131138
Pro75M1670 = SolidMotor(
132-
thrust_source="../data/motors/cesaroni/Cesaroni_M1670.eng", #copy here the path to the thrust source file
139+
thrust_source="../data/motors/cesaroni/Cesaroni_M1670.eng", # NOTE: update the path to the thrust source file
133140
burn_time=3.9,
134141
grain_number=5,
135142
grain_separation=5 / 1000,

docs/development/setting_up.rst

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Setting Up RocketPy as a Developer
2+
==================================
3+
4+
5+
Forking the repository
6+
----------------------
7+
8+
The first step is to fork the RocketPy repository. You can do this by clicking
9+
the **Fork** button on the top right corner of the repository page on GitHub.
10+
11+
By default, the fork will only have the `master` branch. You should also fork
12+
the `develop` branch. You can do this by going to the `develop` branch on the
13+
RocketPy repository before clicking the **Fork** button.
14+
15+
.. IMPORTANT: this part is usually not so clear.
16+
17+
.. important::
18+
19+
Our `master` branch is the stable branch, and the `develop` branch is the \
20+
development branch. You should always create your PRs against the `develop` \
21+
branch, unless it is a really important hotfix.
22+
23+
24+
Cloning the Repository
25+
----------------------
26+
27+
28+
Installation
29+
------------
30+
31+
32+
pip install -e .
33+
pip install -r requirements-optional.txt
34+
pip install -r requirements-tests.txt
35+
36+
37+
Navigating through the project
38+
------------------------------
39+
40+
git checkout ...
41+
42+
43+
Running a flight simulation
44+
---------------------------
45+
46+
Please see the other page... (link the other page)
47+
48+
Running the tests
49+
-----------------
50+
51+
make pytest
52+
53+
make pytest-slow
54+
55+
make coverage-report
56+

docs/development/style_guide.rst

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
Style Guide
22
===========
33

4-
This page describes code, documentation and git branching styles used throughout RocketPy's development.
4+
This page describes code, documentation and git branching styles used throughout
5+
RocketPy's development.
56

67
Code Style
78
----------
89

9-
We mostly follow the standard Python style conventions as described here: `Style Guide for Python Code <https://www.python.org/dev/peps/pep-0008/>`_
10+
We mostly follow the standard Python style conventions as described here:
11+
`Style Guide for Python Code <https://www.python.org/dev/peps/pep-0008/>`_
1012

1113
Naming Conventions
1214
^^^^^^^^^^^^^^^^^^
13-
RocketPy was, unfortunately, initially coded using `Camel Case <https://en.wikipedia.org/wiki/Camel_case>`_.
15+
RocketPy was, unfortunately, initially coded using
16+
`Camel Case <https://en.wikipedia.org/wiki/Camel_case>`_.
1417
However, PEP8 specifies the following::
1518

16-
Function names should be lowercase, with words separated by underscores as necessary to improve readability.
19+
Function names should be lowercase, with words separated by underscores as \
20+
necessary to improve readability.
1721
Variable names follow the same convention as function names.
1822

1923
mixedCase is allowed only in contexts where that is already the prevailing style (e.g. threading.py), to retain backwards compatibility.
2024

2125
Therefore, `Snake Case <https://en.wikipedia.org/wiki/Snake_case>`_ is preferred.
22-
For this reason, RocketPy is being converted from Camel to Snake as of version ``1.0.0``.
23-
New contributions should strive to follow Snake case as well.
26+
For this reason, RocketPy has being fully converted from `CamelCase` to `snake_case` as of version ``1.0.0``.
27+
New contributions should strive to follow `snake_case` case as well.
2428

25-
Furthermore, when it comes to naming new variables, functions, classes or anything in RocketPy, always try to use descriptive names.
29+
Furthermore, when it comes to naming new variables, functions, classes or
30+
anything in RocketPy, always try to use descriptive names.
2631

27-
As an example, instead of using `a` or `alpha` as a variable for a rocket's angle of attack, `angle_of_attack` is preferred.
28-
Such descriptive names make the code significantly easier to understand, review and maintain.
32+
As an example, instead of using `a` or `alpha` as a variable for a rocket's
33+
angle of attack, `angle_of_attack` is preferred.
34+
Such descriptive names make the code significantly easier to understand, review
35+
and maintain.
2936

3037
In summary:
3138

@@ -38,18 +45,38 @@ In summary:
3845
angle_of_attack = 0.2 # in rad
3946
4047
41-
Linting
42-
^^^^^^^
43-
As far as line wrapping, parentheses, calling chains and other code style related matter goes, RocketPy currently employs `Black style <https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html>`_.
48+
Linting and formatting
49+
^^^^^^^^^^^^^^^^^^^^^^
50+
51+
As far as line wrapping, parentheses, calling chains and other code style
52+
related matter goes, RocketPy currently employs `Black style <https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html>`_.
4453
Installing Black and running it before submitting a pull request is highly recommend.
4554
Currently, there are pull request tests in place to enforce that Black style is used.
4655

56+
Aside from Black, RocketPy also uses `Flake8 <https://flake8.pycqa.org/en/latest/>`_
57+
and `Pylint <https://pylint.pycqa.org/en/latest/>`_ to check for code style issues.
58+
59+
Running these commands before submitting a pull request is also highly recommended:
60+
61+
.. code-block:: bash
62+
63+
make flake8
64+
make pylint
65+
66+
These commands will check for any code style issues in the codebase.
67+
The `flake8` command will throw a report directly to the console, while the
68+
`pylint` command will create a `.pylint_report.txt` file in the root directory,
69+
which you can open to see the report.
70+
71+
4772

4873
Documentation Style
4974
-------------------
5075

51-
Every class, method, attribute and function added to RocketPy should be well documented using docstrings.
52-
RocketPy follows NumPy style docstrings, which are very well explained here: `NumPyDoc Style Guide <https://numpydoc.readthedocs.io/en/latest/format.html>`_.
76+
Every class, method, attribute and function added to RocketPy should be well
77+
documented using docstrings.
78+
RocketPy follows NumPy style docstrings, which are very well explained here:
79+
`NumPyDoc Style Guide <https://numpydoc.readthedocs.io/en/latest/format.html>`_.
5380

5481
Git Style
5582
---------

0 commit comments

Comments
 (0)