Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Im/contributor vs maintainer #115

Merged
merged 4 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 45 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,55 @@
# Contributing

## Installation
Please makes sure to complete the following steps if you are interested in contributing to `BTK`.

Please makes sure to complete the following steps if you are interested in contributing to `BTK`:
## Installing

1. Start by git cloning the `BTK` repository:

```
git clone https://github.com/LSSTDESC/BlendingToolKit.git
```

2. We use [poetry](https://python-poetry.org) as python package manager for BTK. It guarantees all developers are sharing the same python environment, makes it really easy to update dependencies, and publish to [pypi](https://pypi.org). Given some of the complications with installing `galsim` via `poetry`, we follow a hybrid approach of `conda`+`poetry`.
2. It is highly recommended that you have a separate virtual environment (e.g. conda) for your BTK development. Then, inside your favorite python virtual environment run the following:

3. It is recommended to create a `conda` virtual environment (using `python3.8`) from scratch and use it to install all required dependencies. After having installed `conda`, please follow the following series of steps:
```
cd BlendingToolKit
pip install -r requirements.txt # includes all requirements you need.
pre-commit install
```

If you have any problems with the installation, they are probably due to `galsim`. It is recommended that you follow the instructions for [installing galsim](https://galsim-developers.github.io/GalSim/_build/html/install.html) first, and then try again.

## Pull Requests

1. Every contribution to BTK must be made in a form of a Pull Request (PR) that can eventually be merged to the `main` branch. If you are planning to create a PR and merge it into BTK, it is recommended that you create a branch inside the `BTK` repo so that other people can contribute too :)

2. Every pull request must pass the workflows specified in `.github/workflows` before merging.

- The tool known as `pre-commit` will make it easy to for you to pass the linting workflow, install it in your local repository by running `pre-commit install`.

- For `BTK` we are using the `black` formatter, you can format your code by running `black .` which formats all python files accessible from your current directory. If you have an IDE that you like there are also [options](https://black.readthedocs.io/en/stable/editor_integration.html) to format on save.

- You can run all the tests locally by simply running `poetry run pytest` inside your local repository.

3. If other branches were merged while you were working on this PR to the `main` branch, then you will to rebase before merging:

```
git rebase origin/main
# follow the instructions and resolve conflicts...
# Feel free to ask other developers if you are not sure of the conflicts.
git push --force
```

4. Finally, ask for at least one approving review from [@ismael-mendoza](https://github.com/ismael-mendoza) or other collaborators.

# Maintainer

The following sections are only relevant for the maintainer of BTK (currently Ismael Mendoza).

1. We use [poetry](https://python-poetry.org) as python package manager for BTK. It guarantees all developers are sharing the same python environment, makes it really easy to update dependencies, and publish to [pypi](https://pypi.org). Given some of the complications with installing `galsim` via `poetry`, we follow a hybrid approach of `conda`+`poetry`.

2. It is recommended to create a `conda` virtual environment (using `python3.8`) from scratch and use it to install all required dependencies. After having installed `conda`, please follow the following series of steps:

```
# enter to the local repo
Expand Down Expand Up @@ -49,26 +86,12 @@ pre-commit install

But I find the first method is more robust (works on a MAC too).

4. If any of the dependencies requires an update, you can simply run `poetry update` inside your local repo to automatically update and install them. Feel free to push the changes of the `pyproject.toml` or `poetry.lock` file to the PR you are working on.

## Pull Requests

1. Every contribution to BTK must be made in a form of a Pull Request (PR) that can eventually be merged to the `main` branch. If you are planning to create a PR and merge it into BTK, it is recommended that you create a branch inside the `BTK` repo so that other people can contribute too :)
3. If any of the dependencies requires an update, you can simply run `poetry update` inside your local repo to automatically update and install them. Feel free to push the changes of the `pyproject.toml` or `poetry.lock` file to the PR you are working on.

2. Every pull request must pass the workflows specified in `.github/workflows` before merging.

- The tool known as `pre-commit` will make it easy to for you to pass the linting workflow, install it in your local repository by running `pre-commit install`.

- For `BTK` we are using the `black` formatter, you can format your code by running `black .` which formats all python files accessible from your current directory. If you have an IDE that you like there are also [options](https://black.readthedocs.io/en/stable/editor_integration.html) to format on save.

- You can run all the tests locally by simply running `poetry run pytest` inside your local repository.

3. If other branches were merged while you were working on this PR to the `main` branch, then you will to rebase before merging:
4. You might also want to update the `requirements.txt` file every now and then:

```
git rebase origin/main
# follow the instructions and resolve conflicts...
git push --force
poetry export -f requirements.txt --output requirements.txt
```

4. Finally, ask for at least one approving review from [@ismael-mendoza](https://github.com/ismael-mendoza) or other collaborators.
ideally everytime you run `poetry update`.
Loading