How to contribute
If you are reading this, then you are probably looking for a way to contribute to Kosmorro or Kosmorrolib. Thank you! There are multiple ways to contribute that can match with your possibilities.
Opening issues
Reporting bugs
If you find a bug, please check it is not already reported in the Issues tab on GitHub. If it is not, create a bug report and fill in the form. Feel free to give as much information as possible, as it will make the bug easier to fix.
- Kosmorro: click here
- Kosmorrolib: click here
Suggest a new feature
Have an idea of feature you think would be nice on Kosmorro? Time to suggest it! First, please check someone didn't suggest your next revolution in the Issues tab. If it's not, create a feature request and fill in the form.
- Kosmorro: click here
- Kosmorrolib: propose a feature request or an event type
Translating
If you speak another language than English, another nice way to enhance Kosmorro is to translate its messages. The recommended way to begin translating Kosmorro is to join the Weblate project.
Writing code
First, if you are fixing an opened issue, check that nobody is already working on it — if someone seems to be but their Pull Request seems stuck, please ask them first if you can continue the development. If you retake the code they produced, don't change the author of the commits.
Before writing the code, first create a fork of the repository and clone it. You may also want to add the original repository (Kosmorro/kosmorro
or Kosmorro/lib
), so you can update your fork with the last upstream commits.
Then create a new branch and start coding. Finally, commit and push, then open a pull request on the original repository. If your work is not complete, feel free to open it as Draft, then mark it as ready for review when you're done.
Choosing the right target branch
When you create your PR, select the right source and target branch:
- If you are fixing a bug or optimizing something, then your base branch is
master
. - If you are doing anything else, then your base branch is
features
.
This allows to make easier to publish patch releases, which have a higher priority than the minor releases.
Dealing with the translations
On Kosmorro, the messages file contains all the messages Kosmorro can display, in order to make them translatable. When you change code, you may change also the messages displayed by the software.
When you add a new string that will be displayed to the end user, please pass it to the _()
function made available in the kosmorro.i18n
package:
# Don't:
print(f'{object1} and {object2} are in conjunction')
# Do:
from kosmorro.i18n import _
print(_('%s and %s are in conjunction') % (object1, object2))
This will allow Python's internationalization tool to translate the string in any available language.
Once you have done your work, please remember to tell Babel to extract the new strings:
make messages
Note that if you forget to update the messages file, the CI will fail.
Matching the coding standards
The source code follows the major coding standards of Python (PEPs). Before marking your Pull Request as ready for review, don't forget to check that the code respects the coding standards with Black:
make black
Testing the code
Kosmorro
On Kosmorro, the tests are located in the /tests
folder.
Their principle is pretty simple:
- First, we run a Kosmorro command as we would in command line application. We use the Aurornis package to do this.
- Then, we test the return of the command against what we expected. We use PyTest to do this.
To run the tests, invoke the following command:
make tests
# Or, if you have TeXLive installed on your machine (Linux only):
make TEXLIVE_INSTALLED=1 tests
Kosmorrolib
On Kosmorrolib, we use doctests to check that the code works as expected. This allows to make sure that the code works and, at the same time, ensure the code documentation is up to date.
See Python official documentation for more information.
Commiting
The commit messages of this project follow the Conventional Commits Specification: basically, when you commit your changes, please prefix them with the following:
fix:
if your changes fix a bug;feat:
if your changes add a new feature.
The message of your commit must start with a lowercase.
Once your PR is ready to review, please squash your commits so it contains only one.
The commit messages are then used to generate the changelog using conventional-changelog
, so make sure that the commit message is clear.
Licensing and Copyright Attribution
When you open a Pull Request to the project, you agree to license your code under the GNU Affero General Public License version 3.