Skip to content

Commit

Permalink
Merge pull request #177 from czi-catalystproject/contributing
Browse files Browse the repository at this point in the history
Updating contributing and readme files
  • Loading branch information
jnywong authored Aug 22, 2024
2 parents 9a0e40c + bed8fd6 commit ad0a61a
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 261 deletions.
259 changes: 137 additions & 122 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,125 +1,140 @@
# Contributing

<!-- word count: 960 -->
## Getting Started

We recommend editing the contents of this repo using the 2i2c Community Showcase Hub.

> [!NOTE]
> If you require collaborator access to contribute to this repo, please [Get in Touch](README.md#contacting-us). Otherwise, you can fork this repository instead.
1. Access the 2i2c Community Showcase Hub at [https://showcase.2i2c.cloud/](https://showcase.2i2c.cloud/). If you require authorisation to access this hub, please [Get in Touch](README.md#contacting-us).

1. Select the *Shared Small: 1-4 CPU, 8-32 GB* server option and in the *Image* dropdown box select *Handbook Authoring*.

1. Once the JupyterLab interface has loaded, set up GitHub authentication with `gh-scoped-creds`. This allows you to pull and push to GitHub repos securely. To enable this, open a terminal, run the command

```bash
gh-scoped-creds
```

and follow the prompts to enter your code at [https://github.com/login/device](https://github.com/login/device)

1. Git clone [this project repo](https://github.com/czi-catalystproject/hub-champion-training) using the Terminal with the command

```bash
git clone https://github.com/czi-catalystproject/hub-champion-training.git
```

1. Follow the instructions in [Localisation to Spanish](#localisation-to-spanish) for authoring and previewing content using Jupyter Book.

> [!CAUTION]
> We do not recommend entering your GitHub credentials (GitHub password, personal access tokens or otherwise) on any kind of shared infrastructure (e.g. private and public cloud, HPC, any remote machine) as this information will be at risk. We highly advise using `gh-scoped-creds` for authentication on our hubs. Read [this article](https://blog.jupyter.org/securely-pushing-to-github-from-a-jupyterhub-3ee42dfdc54f) for more information.
<details>
<summary>NOTE: GitHub permissions for 2i2c-org and czi-catalystproject owners</summary>

These are extra instructions for GitHub [2i2c-org](https://github.com/2i2c-org) and [czi-catalystproject](https://github.com/czi-catalystproject) owners to grant permissions to collaborators when requested.

**Access to the Community Showcase Hub**

Add the Hub Champion to the `2i2c-community-showcase/access-2i2c-showcase` team with maintainer rights, and community/test users as a general member of `2i2c-community-showcase`. This is so that Hub Admins can then add community users/test users to the `access-2i2c-showcase` team using their maintainer rights to *practise* granting access to the Showcase Hub as part of their hub champion training.

**Add collaborator to [this project repo](https://github.com/czi-catalystproject/hub-champion-training)**

Go to the [GH repo](https://github.com/czi-catalystproject/hub-champion-training), click *Settings -> Access - Collaborators and teams* and add the relevant user or team. Assign the *Write* role in the first instance (this can be upgraded later if needed).

**Info about `gh-scoped-creds` and GitHub App**

The GitHub App [2i2c Community Showcase Hub](https://showcase.2i2c.cloud/) is currently installed on `czi-catalystproject/website` and `czi-catalystproject/hub-champion-training` repos to enable `gh-scoped-creds`.
</details>

## Localisation to Spanish

The following are instructions for localising the Jupyter Book to Spanish, adapted from the [Sphinx documentation](https://www.sphinx-doc.org/en/master/usage/advanced/intl.html).

1. Open a Terminal and navigate to the `hub-champion-training` folder

```bash
cd hub-champion-training/
```

1. If a `config.py` file does not exist in this folder, **or** if you have made changes to `_config.yml`, then automatically generate this from the `_config.yml` with

```bash
jupyter-book config sphinx .
```

(See [Jupyter Book docs](https://jupyterbook.org/en/stable/explain/sphinx.html#jupyter-book-is-a-distribution-of-sphinx))

1. Generate `.pot` files with `gettext` to extract all translatable strings from the doctree

```bash
jupyter-book build --builder custom --custom-builder gettext .
```

The generated `.pot` files will be placed in the `_build/gettext` directory. The `.pot` files are empty template files and need to be updated if the source content changes. The `msgid` line contains the source text. The empty `msgstr` line will eventually contain the actual translation in the `.po` file.

1. Create `.po` files in the `locale` folder in the `es_LA` target language (ensure that the `locale` folder matches the `locale_dirs` setting in `_config.yml`)

```bash
sphinx-intl update -p _build/gettext -d locale -l es_LA
```

The generated `.po` files are the files that will contain the actual translations in the `msgstr` lines that are created in the next step.

1. Translate the `.po` files located inside the `locale/es_LA/LC_MESSAGES` folder as required, e.g. with human translation services, machine translation or professional translation services with [Crowdin](https://crowdin.com/).

1. Build the HTML files in English (the source language)

```bash
jupyter-book build .
```

1. Build the HTML files in Spanish (the target language)

```bash
jupyter-book config sphinx .
sphinx-build -b html -D language=es_LA . _build/html/es
```

1. Open a **new** Terminal and navigate to the HTML folder using the command

```bash
cd hub-champion-training/_build/html/
```

1. Run a simple Python webserver with the command

```bash
python -m http.server
```

1. Open a new browser tab and preview the Spanish version of the website by opening the following URL

```bash
https://<your-hub-url>/user/<your-username>/proxy/8000/es/index.html
```

> [!TIP]
> If you run into the following error
> `sphinx.errors.SphinxError: This environment is incompatible with the selected builder, please choose another doctree directory.`
> try cleaning the build outputs first before building again
> ```bash
> jupyter-book clean .
> jupyter-book build .
> ```
## Deployment
On push to main:
- The Hub Champion Training website will be deployed at [https://czi-catalystproject.github.io/hub-champion-training/](https://czi-catalystproject.github.io/hub-champion-training/) via the GitHub actions defined in `.github/workflows/deploy_website.yml`.
- Changes to the `locale` directory are uploaded to the `l10n` branch on Crowdin via the GitHub actions defined in `.github/workflows/crowdin-action-upload.yml`.
On cron schedule and manual trigger:
- Approved Crowdin translations will be pushed to the `l10n` branch on GitHub and an automatic PR is opened.
- If `l10n` branch already exists on GitHub, then Crowdin translations will be force pushed to the `l10n` branch on GitHub to the existing PR.
- GitHub action is defined in `.github/workflows/crowdin-action-download.yml`.
[The Carpentries][cp-site] ([Software Carpentry][swc-site], [Data
Carpentry][dc-site], and [Library Carpentry][lc-site]) are open source
projects, and we welcome contributions of all kinds: new lessons, fixes to
existing material, bug reports, and reviews of proposed changes are all
welcome.

## Contributor Agreement

By contributing, you agree that we may redistribute your work under [our
license](LICENSE.md). In exchange, we will address your issues and/or assess
your change proposal as promptly as we can, and help you become a member of our
community. Everyone involved in [The Carpentries][cp-site] agrees to abide by
our [code of conduct](CODE_OF_CONDUCT.md).

## How to Contribute

The easiest way to get started is to file an issue to tell us about a spelling
mistake, some awkward wording, or a factual error. This is a good way to
introduce yourself and to meet some of our community members.

1. If you do not have a [GitHub][github] account, you can [send us comments by
email][contact]. However, we will be able to respond more quickly if you use
one of the other methods described below.

2. If you have a [GitHub][github] account, or are willing to [create
one][github-join], but do not know how to use Git, you can report problems
or suggest improvements by [creating an issue][repo-issues]. This allows us
to assign the item to someone and to respond to it in a threaded discussion.

3. If you are comfortable with Git, and would like to add or change material,
you can submit a pull request (PR). Instructions for doing this are
[included below](#using-github). For inspiration about changes that need to
be made, check out the [list of open issues][issues] across the Carpentries.

Note: if you want to build the website locally, please refer to [The Workbench
documentation][template-doc].

## Where to Contribute

1. If you wish to change this lesson, add issues and pull requests here.
2. If you wish to change the template used for workshop websites, please refer
to [The Workbench documentation][template-doc].


## What to Contribute

There are many ways to contribute, from writing new exercises and improving
existing ones to updating or filling in the documentation and submitting [bug
reports][issues] about things that do not work, are not clear, or are missing.
If you are looking for ideas, please see [the list of issues for this
repository][repo-issues], or the issues for [Data Carpentry][dc-issues],
[Library Carpentry][lc-issues], and [Software Carpentry][swc-issues] projects.

Comments on issues and reviews of pull requests are just as welcome: we are
smarter together than we are on our own. **Reviews from novices and newcomers
are particularly valuable**: it's easy for people who have been using these
lessons for a while to forget how impenetrable some of this material can be, so
fresh eyes are always welcome.

## What *Not* to Contribute

Our lessons already contain more material than we can cover in a typical
workshop, so we are usually *not* looking for more concepts or tools to add to
them. As a rule, if you want to introduce a new idea, you must (a) estimate how
long it will take to teach and (b) explain what you would take out to make room
for it. The first encourages contributors to be honest about requirements; the
second, to think hard about priorities.

We are also not looking for exercises or other material that only run on one
platform. Our workshops typically contain a mixture of Windows, macOS, and
Linux users; in order to be usable, our lessons must run equally well on all
three.

## Using GitHub

If you choose to contribute via GitHub, you may want to look at [How to
Contribute to an Open Source Project on GitHub][how-contribute]. In brief, we
use [GitHub flow][github-flow] to manage changes:

1. Create a new branch in your desktop copy of this repository for each
significant change.
2. Commit the change in that branch.
3. Push that branch to your fork of this repository on GitHub.
4. Submit a pull request from that branch to the [upstream repository][repo].
5. If you receive feedback, make changes on your desktop and push to your
branch on GitHub: the pull request will update automatically.

NB: The published copy of the lesson is usually in the `main` branch.

Each lesson has a team of maintainers who review issues and pull requests or
encourage others to do so. The maintainers are community volunteers, and have
final say over what gets merged into the lesson.

## Other Resources

The Carpentries is a global organisation with volunteers and learners all over
the world. We share values of inclusivity and a passion for sharing knowledge,
teaching and learning. There are several ways to connect with The Carpentries
community listed at <https://carpentries.org/connect/> including via social
media, slack, newsletters, and email lists. You can also [reach us by
email][contact].

[repo]: https://example.com/FIXME
[repo-issues]: https://example.com/FIXME/issues
[contact]: mailto:[email protected]
[cp-site]: https://carpentries.org/
[dc-issues]: https://github.com/issues?q=user%3Adatacarpentry
[dc-lessons]: https://datacarpentry.org/lessons/
[dc-site]: https://datacarpentry.org/
[discuss-list]: https://carpentries.topicbox.com/groups/discuss
[github]: https://github.com
[github-flow]: https://guides.github.com/introduction/flow/
[github-join]: https://github.com/join
[how-contribute]: https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github
[issues]: https://carpentries.org/help-wanted-issues/
[lc-issues]: https://github.com/issues?q=user%3ALibraryCarpentry
[swc-issues]: https://github.com/issues?q=user%3Aswcarpentry
[swc-lessons]: https://software-carpentry.org/lessons/
[swc-site]: https://software-carpentry.org/
[lc-site]: https://librarycarpentry.org/
[template-doc]: https://carpentries.github.io/workbench/
Loading

0 comments on commit ad0a61a

Please sign in to comment.