diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..c2155c4 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,11 @@ +FROM jhale1805/python-poetry:1.1.13-py3.8-slim +ENV PROJECT_ROOT_DIR=/workspaces + +RUN apt update \ + && apt install git --assume-yes --no-install-recommends + +WORKDIR $PROJECT_ROOT_DIR +ENV PATH="$PROJECT_ROOT_DIR/.venv/bin:$PATH" + +COPY poetry.lock pyproject.toml ./ +RUN poetry install diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..5d0cfd6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +{ + // How to build the devcontainer + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "postCreateCommand": "pre-commit install", + + // VS Code tooling and settings to include automatically. + "extensions": [ + "ms-python.python", // Python Intellisense/Debugging + "njpwerner.autodocstring", // Easily create docstrings + "mhutchie.git-graph", // Nice Git Log Visualizer + "stkb.rewrap", // Easily line-wrap comments at the ruler(s) below. + "ymotongpoo.licenser" // Auto-insert license headers + ], + "settings": { + "licenser.author": "Joseph Hale", + "licenser.license": "MPLv2", + "licenser.projectName": "Multicounter", + "[python]": { + "editor.rulers": [88], // `black`'s default line width + "editor.insertSpaces": true, + "editor.tabSize": 4 + } + } +} diff --git a/CONTRIBUTING.MD b/CONTRIBUTING.md similarity index 55% rename from CONTRIBUTING.MD rename to CONTRIBUTING.md index 8de2228..269c009 100644 --- a/CONTRIBUTING.MD +++ b/CONTRIBUTING.md @@ -8,37 +8,41 @@ # Contributing to `MultiCounter` -Thank you for your interest in contributing to `MultiCounter`! +Thank you for your interest in contributing to `MultiCounter`! This document +will guide you through setting up your development environment so you can bring +your ideas for `MultiCounter` to life. ## Development Setup +This project ships with a VS Code +["devcontainer"](https://code.visualstudio.com/docs/remote/create-dev-container) +to provide you with the easiest possible environment setup. -1. [Make your own fork](https://github.com/python-poetry/poetry/fork) of `MultiCounter` +1. Make sure you have both [Docker](https://docs.docker.com/get-docker/) and [VS +Code](https://code.visualstudio.com/) (including the [Remote Containers +Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)) +installed on your machine. -2. Clone the source code of `MultiCounter` onto your machine. +2. [Make your own fork](https://github.com/python-poetry/poetry/fork) of + `MultiCounter` + +3. Clone the source code of `MultiCounter` onto your machine and open it in VS + Code - Make sure to replace `YOUR_GITHUB_USERNAME` in the command below with your actual GitHub username! ```bash git clone https://github.com/YOUR_GITHUB_USERNAME/multicounter.git cd multicounter +code . ``` -3. [Install Poetry ](https://python-poetry.org/docs/#installation) for -`MultiCounter`'s dependency - management and publishing to PyPi. - -4. Install the dependencies of `MultiCounter` -```bash -poetry shell -poetry install -``` +4. Accept the prompt from VS Code to **Reopen in Container**. + - If you don't see this pop-up, go to `View` -> `Command Palette` -> + `Remote-Containers: Open Folder in Container` + - Note that the devcontainer may take several minutes to load for the first + time. Successive launches will be much faster. -5. Install the pre-commit hooks that automatically test and lint your code on each -commit. -``` -pre-commit install -``` -6. Run the unit tests to make sure everything is working. +5. Run the unit tests to make sure everything is working. ```bash poetry run pytest ``` @@ -50,8 +54,8 @@ improvements you want in the codebase. When you are done, simply commit your code with a brief message explaining what was changed, and why. A series of automated checks will run to make sure everything looks good before the commit gets saved: -- The unit test suite will automatically run and inform you of any failing - tests that need fixing. +- The unit test suite will automatically run and inform you of any failing tests + that need fixing. - Linters will automatically run and correct any code formatting problems. Make sure to `git add .` after these run to capture their changes. @@ -67,7 +71,7 @@ Finally push up your changes to your fork and open a Pull Request (PR) back into ## Other Useful Information -You can easily update the project dependencies using Poetry +You can easily update the project dependencies using Poetry. ```bash poetry update ```