Skip to content

Commit

Permalink
Add GitHub Pages content, linting + formatting checks, and code of co…
Browse files Browse the repository at this point in the history
…nduct (#3)

* add github pages content and linting CI

* add code of conduct

* Update CODE_OF_CONDUCT.MD

Co-authored-by: Gregory Way <[email protected]>

* adjust readme with a link

* spelling update

* generalize title

---------

Co-authored-by: Gregory Way <[email protected]>
  • Loading branch information
d33bs and gwaybio authored Sep 16, 2024
1 parent 0882ae1 commit 93235e7
Show file tree
Hide file tree
Showing 12 changed files with 402 additions and 296 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/pre-commit-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
pre_commit_checks:
runs-on: ubuntu-22.04
steps:
# checks out the repo
- uses: actions/checkout@v4
# setup python
- name: Python setup
uses: actions/setup-python@v5
with:
python-version: "3.11"
# run pre-commit
- uses: pre-commit/[email protected]
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.11
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: detect-private-key
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint
131 changes: 131 additions & 0 deletions CODE_OF_CONDUCT.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at [[email protected]](mailto:[email protected]).
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][mozilla coc].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[faq]: https://www.contributor-covenant.org/faq
[homepage]: https://www.contributor-covenant.org
[mozilla coc]: https://github.com/mozilla/diversity
[translations]: https://www.contributor-covenant.org/translations
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Playbooks
# Lab Playbooks

Playbooks relevant to Way Lab operations.

See the GitHub Pages version of this content here: [https://wayscience.github.io/playbooks/](https://wayscience.github.io/playbooks/).

Top-level playbooks have information which may be relevant to other computational labs.
Playbooks in the `/internal` folder have information specific to the Way Lab.

| Playbook | Type | Description |
|-------------------------|-----------------------|------------------------------------|
| [Code Strategy](code_strategy.md) | General | Strategy for using and writing code in a scientific setting. |
| [Conference Playbook](conference_playbook.md) | General | Playbook for selecting and participating in conferences. |
| [Data Strategy](data_strategy.md) | General | Strategy for using and storing data; includes our 3 data perspectives. |
| [GitHub Strategy](github_strategy.md) | General | Strategy for using GitHub efficiently; details our 3 types of repositories. |
| [Calendar Playbook](internal/calendar_playbook.md) | Internal | Playbook for joining and using Way Lab calendar. |
| [Computer Setup](internal/computer_setup.md) | Internal | Instructions for lab computer setup. |
| [Onboarding](internal/onboarding.md) | Internal | Onboarding materials for the Way Lab. |
| [Remote Access](internal/remote_access.md) | Internal | Instructions for remotely connecting to and using Way Lab computers. |
| Playbook | Type | Description |
| -------------------------------------------------- | -------- | --------------------------------------------------------------------------- |
| [Code Strategy](code_strategy.md) | General | Strategy for using and writing code in a scientific setting. |
| [Conference Playbook](conference_playbook.md) | General | Playbook for selecting and participating in conferences. |
| [Data Strategy](data_strategy.md) | General | Strategy for using and storing data; includes our 3 data perspectives. |
| [GitHub Strategy](github_strategy.md) | General | Strategy for using GitHub efficiently; details our 3 types of repositories. |
| [Calendar Playbook](internal/calendar_playbook.md) | Internal | Playbook for joining and using Way Lab calendar. |
| [Computer Setup](internal/computer_setup.md) | Internal | Instructions for lab computer setup. |
| [Onboarding](internal/onboarding.md) | Internal | Onboarding materials for the Way Lab. |
| [Remote Access](internal/remote_access.md) | Internal | Instructions for remotely connecting to and using Way Lab computers. |
29 changes: 14 additions & 15 deletions code_strategy.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Code Strategy

We are biomedical data scientists who use code to answer biological hypotheses and explore biological data.
It is therefore important to define how we use, write, and share code. 
It is therefore important to define how we use, write, and share code.

## 1. Using code

Expand Down Expand Up @@ -38,7 +40,7 @@ Good code is readable.
Based on the logic, variable names, and documentation, anyone (especially you!) should be able to understand what your code is doing.
Readability also means standard formatting.
We always lint our code, and use automatic formatting wherever possible (e.g. [python black](https://github.com/psf/black)).
We use pre-commit hooks to ensure our code follows conventions before commiting.
We use pre-commit hooks to ensure our code follows conventions before committing.

### 3. Code should be well organized (maintainable)

Expand All @@ -54,12 +56,10 @@ Waylab code should (usually) follow these conventions for readable, functional c
Note that these conventions will change as the field of biomedical data science evolves and improves.

1. Use [formatted string literals (f-strings)](https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings) to concatenate or insert information into strings.
1. Use [pathlib](https://docs.python.org/3/library/pathlib.html) to represent file-system paths.
1. Save intermediate files in parquet (`.parquet`) format when possible.

2. Use [pathlib](https://docs.python.org/3/library/pathlib.html) to represent file-system paths.

3. Save intermediate files in parquet (`.parquet`) format when possible.

In general, we follow these [10 simple rules for reproducible computational research](https://doi.org/10.1371/journal.pcbi.1003285)
In general, we follow these [10 simple rules for reproducible computational research](https://doi.org/10.1371/journal.pcbi.1003285).

## 3. Sharing code

Expand Down Expand Up @@ -95,7 +95,6 @@ Reviewing code can be tricky.
It is important to understand someone else's code and goals, but also to let their own style shine through their work.
We strive for individuality, understanding, and accuracy, so if you are able to spot a bug (or the potential for one), please highlight in a concise review.


### Code review checklist

- [ ] Do you understand the code’s intention?
Expand All @@ -121,7 +120,7 @@ We strive for individuality, understanding, and accuracy, so if you are able to
Having someone else look at your code can be scary and intimidating!
The Waylab PI (Greg) will review your first couple pull requests to ease you into this process. However, with the lab growing and projects expanding, lab-wide pull requests are necessary.
Work with Greg to find a pull request buddy, who will quickly become an expert on, and a cheerleader for, your project.
Alternatively, post your pull request in the `pull-request-review` Discord channel. 
Alternatively, post your pull request in the `pull-request-review` Discord channel.

Please make your pull requests easy to review.
They should be concise, clearly documented, and only change a minimum number of topics (ideally, 1 core change per PR).
Expand Down Expand Up @@ -149,14 +148,14 @@ The methodology is as follows:

1. Create a new branch from _main_ for the entire refactor

2. Create a new branch from the entire refactor branch for a specific change
1. Create a new branch from the entire refactor branch for a specific change

3. File a PR from this change-specific branch into the entire refactor branch
1. File a PR from this change-specific branch into the entire refactor branch

4. Someone will review your PR and after approval…
1. Someone will review your PR and after approval…

5. Squash merge the change-specific branch into the entire refactor branch
1. Squash merge the change-specific branch into the entire refactor branch

6. Repeat 2-5 for all “chunks of change”
1. Repeat 2-5 for all “chunks of change”

7. Finally, once all the changes are introduced, file a PR from the entire refactor branch into _main_!
1. Finally, once all the changes are introduced, file a PR from the entire refactor branch into _main_!
Loading

0 comments on commit 93235e7

Please sign in to comment.