Skip to content

Commit ebc9803

Browse files
committed
initial commit
0 parents  commit ebc9803

30 files changed

+2175
-0
lines changed

.gitattributes

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* text=auto
2+
*.pdf filter=lfs diff=lfs merge=lfs -text
3+
*.ppt* filter=lfs diff=lfs merge=lfs -text
4+
*.tar* filter=lfs diff=lfs merge=lfs -text
5+
*.xls* filter=lfs diff=lfs merge=lfs -text
6+
*.zip filter=lfs diff=lfs merge=lfs -text
7+
*.doc* filter=lfs diff=lfs merge=lfs -text
8+
# *.jp*g filter=lfs diff=lfs merge=lfs -text
9+
# *.png filter=lfs diff=lfs merge=lfs -text

.github/CODE_OF_CONDUCT.md

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
[INSERT CONTACT METHOD].
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
120+
121+
Community Impact Guidelines were inspired by
122+
[Mozilla's code of conduct enforcement ladder][mozilla coc].
123+
124+
For answers to common questions about this code of conduct, see the FAQ at
125+
[https://www.contributor-covenant.org/faq][faq]. Translations are available
126+
at [https://www.contributor-covenant.org/translations][translations].
127+
128+
[homepage]: https://www.contributor-covenant.org
129+
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
130+
[mozilla coc]: https://github.com/mozilla/diversity
131+
[faq]: https://www.contributor-covenant.org/faq
132+
[translations]: https://www.contributor-covenant.org/translations

.github/CONTRIBUTING.md

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# Guidelines for contributing
2+
3+
## Table of Contents <!-- omit in toc -->
4+
5+
- [Summary](#summary)
6+
- [Contributors](#contributors)
7+
- [Maintainers](#maintainers)
8+
- [Git](#git)
9+
- [Python](#python)
10+
- [Python code style](#python-code-style)
11+
- [Poetry](#poetry)
12+
- [Docker](#docker)
13+
14+
## Summary
15+
16+
### Contributors
17+
18+
**PRs welcome!**
19+
20+
- **Consider starting a [discussion](https://docs.github.com/en/discussions) to see if there's interest in what you want to do.**
21+
- **Submit PRs from feature branches on forks.**
22+
- **Ensure PRs pass all CI checks.**
23+
- **Maintain or increase test coverage.**
24+
25+
### Maintainers
26+
27+
- **Make `develop` the default branch.**
28+
- **Merge PRs into `develop`.** Configure repository settings so that branches are deleted automatically after PRs are merged.
29+
- **Only merge to `main` if [fast-forwarding](https://www.git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging) from `develop`.**
30+
- **Enable [branch protection](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/about-protected-branches) on `develop` and `main`.**
31+
- **Set up a release workflow.** Here's an example release workflow, controlled by Git tags:
32+
- Bump the version number in `pyproject.toml` with `poetry version` and commit the changes to `develop`.
33+
- Push to `develop` and verify all CI checks pass.
34+
- Fast-forward merge to `main`, push, and verify all CI checks pass.
35+
- Create an [annotated and signed Git tag](https://www.git-scm.com/book/en/v2/Git-Basics-Tagging)
36+
- Follow [SemVer](https://semver.org/) guidelines when choosing a version number.
37+
- List PRs and commits in the tag message:
38+
```sh
39+
git log --pretty=format:"- %s (%h)" "$(git describe --abbrev=0 --tags)"..HEAD
40+
```
41+
- Omit the leading `v` (use `1.0.0` instead of `v1.0.0`)
42+
- Example: `git tag -a -s 1.0.0`
43+
- Push the tag. GitHub Actions will build and push the Python package and Docker images.
44+
45+
## Git
46+
47+
- _[Why use Git?](https://www.git-scm.com/about)_ Git enables creation of multiple versions of a code repository called branches, with the ability to track and undo changes in detail.
48+
- Install Git by [downloading](https://www.git-scm.com/downloads) from the website, or with a package manager like [Homebrew](https://brew.sh/).
49+
- [Configure Git to connect to GitHub with SSH](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/connecting-to-github-with-ssh)
50+
- [Fork](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo) this repo
51+
- Create a [branch](https://www.git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) in your fork.
52+
- Commit your changes with a [properly-formatted Git commit message](https://chris.beams.io/posts/git-commit/).
53+
- Create a [pull request (PR)](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/about-pull-requests) to incorporate your changes into the upstream project you forked.
54+
55+
## Python
56+
57+
### Python code style
58+
59+
- Python code is formatted with [Black](https://black.readthedocs.io/en/stable/). Configuration for Black is stored in _pyproject.toml_.
60+
- Python imports are organized automatically with [isort](https://pycqa.github.io/isort/).
61+
- The isort package organizes imports in three sections:
62+
1. Standard library
63+
2. Dependencies
64+
3. Project
65+
- Within each of those groups, `import` statements occur first, then `from` statements, in alphabetical order.
66+
- You can run isort from the command line with `poetry run isort .`.
67+
- Configuration for isort is stored in _pyproject.toml_.
68+
- Other web code (JSON, Markdown, YAML) is formatted with [Prettier](https://prettier.io/).
69+
- Code style is enforced with [pre-commit](https://pre-commit.com/), which runs [Git hooks](https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Hooks).
70+
71+
- Configuration is stored in _.pre-commit-config.yaml_.
72+
- Pre-commit can run locally before each commit (hence "pre-commit"), or on different Git events like `pre-push`.
73+
- Pre-commit is installed in the Poetry environment. To use:
74+
75+
```sh
76+
# after running `poetry install`
77+
path/to/repo
78+
❯ poetry shell
79+
80+
# install hooks that run before each commit
81+
path/to/repo
82+
.venv ❯ pre-commit install
83+
84+
# and/or install hooks that run before each push
85+
path/to/repo
86+
.venv ❯ pre-commit install --hook-type pre-push
87+
```
88+
89+
- Pre-commit is also useful as a CI tool. The GitHub Actions workflows run pre-commit hooks with [GitHub Actions](https://github.com/features/actions).
90+
91+
### Poetry
92+
93+
This project uses [Poetry](https://python-poetry.org/) for dependency management.
94+
95+
#### Highlights
96+
97+
- **Automatic virtual environment management**: Poetry automatically manages the `virtualenv` for the application.
98+
- **Automatic dependency management**: rather than having to run `pip freeze > requirements.txt`, Poetry automatically manages the dependency file (called _pyproject.toml_), and enables SemVer-level control over dependencies like [npm](https://semver.npmjs.com/). Poetry also manages a lockfile (called _poetry.lock_), which is similar to _package-lock.json_ for npm. Poetry uses this lockfile to automatically track specific versions and hashes for every dependency.
99+
- **Dependency resolution**: Poetry will automatically resolve any dependency version conflicts. pip did not have dependency resolution [until the end of 2020](https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020).
100+
- **Dependency separation**: Poetry can maintain separate lists of dependencies for development and production in the _pyproject.toml_. Production installs can skip development dependencies to speed up Docker builds.
101+
- **Builds**: Poetry has features for easily building the project into a Python package.
102+
103+
#### Installation
104+
105+
The recommended installation method is through the [Poetry custom installer](https://python-poetry.org/docs/#installation), which vendorizes dependencies into an isolated environment, and allows you to update Poetry with `poetry self update`.
106+
107+
You can also install Poetry however you prefer to install your user Python packages (`pipx install poetry`, `pip install --user poetry`, etc). Use the standard update methods with these tools (`pipx upgrade poetry`, `pip install --user --upgrade poetry`, etc).
108+
109+
#### Key commands
110+
111+
```sh
112+
# Basic usage: https://python-poetry.org/docs/basic-usage/
113+
poetry install # create virtual environment and install dependencies
114+
poetry show --tree # list installed packages
115+
poetry add PACKAGE@VERSION # add a package to production dependencies, like pip install
116+
poetry add PACKAGE@VERSION --dev # add a package to development dependencies
117+
poetry update # update dependencies (not available with standard tools)
118+
poetry version # list or update version of this package
119+
poetry shell # activate the virtual environment, like source venv/bin/activate
120+
poetry run COMMAND # run a command within the virtual environment
121+
poetry env info # manage environments: https://python-poetry.org/docs/managing-environments/
122+
poetry config virtualenvs.in-project true # configure Poetry to install virtualenvs into .venv
123+
poetry export -f requirements.txt > requirements.txt --dev # export dependencies
124+
```
125+
126+
## Docker
127+
128+
- **[Docker](https://www.docker.com/)** is a technology for running lightweight virtual machines called **containers**.
129+
- An **image** is the executable set of files read by Docker.
130+
- A **container** is a running image.
131+
- The **[Dockerfile](https://docs.docker.com/engine/reference/builder/)** tells Docker how to build the container.
132+
- To [get started with Docker](https://www.docker.com/get-started):
133+
- Ubuntu Linux: follow the [instructions for Ubuntu Linux](https://docs.docker.com/install/linux/docker-ce/ubuntu/), making sure to follow the [postinstallation steps](https://docs.docker.com/install/linux/linux-postinstall/) to activate the Docker daemon.
134+
- macOS and Windows: install [Docker Desktop](https://www.docker.com/products/docker-desktop) (available via [Homebrew](https://brew.sh/) with `brew cask install docker`).
135+
- <details><summary>Expand this details element for more <a href="https://docs.docker.com/engine/reference/commandline/cli/">useful Docker commands</a>.</summary>
136+
137+
```sh
138+
# Log in with Docker Hub credentials to pull images
139+
docker login
140+
# List images
141+
docker images
142+
# List running containers: can also use `docker container ls`
143+
docker ps
144+
# View logs for the most recently started container
145+
docker logs -f $(docker ps -q -n 1)
146+
# View logs for all running containers
147+
docker logs -f $(docker ps -aq)
148+
# Inspect a container (web in this example) and return the IP Address
149+
docker inspect web | grep IPAddress
150+
# Stop a container
151+
docker stop # container hash
152+
# Stop all running containers
153+
docker stop $(docker ps -aq)
154+
# Remove a downloaded image
155+
docker image rm # image hash or name
156+
# Remove a container
157+
docker container rm # container hash
158+
# Prune images
159+
docker image prune
160+
# Prune stopped containers (completely wipes them and resets their state)
161+
docker container prune
162+
# Prune everything
163+
docker system prune
164+
# Open a shell in the most recently started container (like SSH)
165+
docker exec -it $(docker ps -q -n 1) /bin/bash
166+
# Or, connect as root:
167+
docker exec -u 0 -it $(docker ps -q -n 1) /bin/bash
168+
# Copy file to/from container:
169+
docker cp [container_name]:/path/to/file destination.file
170+
```
171+
172+
</summary>

.github/ISSUE_TEMPLATE/bug_report.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug report
3+
about: Report a problem
4+
---
5+
6+
## Description
7+
8+
<!-- Provide clear description of the issue in 1-2 sentences. -->
9+
10+
- System info
11+
- Operating system and version: <!-- macOS 10.15.6 -->
12+
- Browser and version: <!-- Firefox 79.0 -->
13+
- Steps to reproduce:
14+
- Step
15+
- Next step
16+
17+
<!-- Add at least one screenshot of the problem. -->
18+
19+
## Suggestions
20+
21+
<!-- Describe how the application should work instead. -->
22+
23+
<!-- List locations of relevant code modules. -->
24+
25+
## Related
26+
27+
Relates to organization/repo#number <!-- Reference related commits, issues and pull requests. Type `#` and select from the list. -->
28+
29+
- [ ] I have reviewed the [Guidelines for Contributing](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
---
5+
6+
## Description
7+
8+
<!-- Describe how the application works currently in 1-2 sentences. -->
9+
10+
<!-- A screenshot is helpful. -->
11+
12+
## Suggestions
13+
14+
<!-- Provide a clear and concise description of how the application should work instead. -->
15+
16+
<!-- Describe any alternatives you've considered. -->
17+
18+
## Related
19+
20+
Relates to organization/repo#number <!-- Reference related commits, issues and pull requests. Type `#` and select from the list. -->
21+
22+
- [ ] I have reviewed the [Guidelines for Contributing](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).

.github/PULL_REQUEST_TEMPLATE.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Description
2+
3+
This repository needs <!-- Add 1-2 sentences explaining the purpose of this PR. -->
4+
5+
The commits in this pull request will <!-- Summarize PR. -->
6+
7+
## Changes
8+
9+
- Imperative commit or change title (commit ID) <!-- Add commit ID and [GitHub will autolink](https://help.github.com/en/github/writing-on-github/autolinked-references-and-urls). -->
10+
- Add some bullet points to explain the change
11+
- Next commit or change (commit ID)
12+
13+
## Related
14+
15+
Relates to organization/repo#number
16+
17+
<!-- Reference related commits, issues and pull requests. Type `#` and select from the list. -->
18+
19+
Closes organization/repo#number
20+
21+
<!-- List issues for GitHub to automatically close after merge to default branch. Type `#` and select from the list. See the [GitHub docs on linking PRs to issues](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue) for more. -->
22+
23+
- [ ] I have reviewed the [Guidelines for Contributing](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).

0 commit comments

Comments
 (0)