|
| 1 | +# Introspection when developing |
| 2 | + |
| 3 | +Nathan McDougall, August 2024. |
| 4 | + |
| 5 | +When developing, so many of our actions are reflexive. If you are interesting in |
| 6 | +developing usethis, then it is very valuable to slow down, and consider thoroughly |
| 7 | +which actions you are undertaking. Some of them might be running off-the-shelf automated |
| 8 | +tools. Sometimes you might be setting up bespoke configuration for those tools. |
| 9 | +Other times, you might have to do something manually. |
| 10 | + |
| 11 | +These are all useful points to note down and can provide a lot of insight into potential |
| 12 | +features for usethis (besides just being useful documentation). |
| 13 | + |
| 14 | +For example, when developing usethis, here are a list of actions that I undertook (not |
| 15 | +necessarily listed chronologically): |
| 16 | + |
| 17 | +## Toolset decisions |
| 18 | + |
| 19 | +- Use GitHub Actions for CI. |
| 20 | +- Always use the hash to pin the version of a GitHub action `uses:` |
| 21 | +- Use uv for package management. |
| 22 | + |
| 23 | +## Repo configuration |
| 24 | + |
| 25 | +- Created a repo on GitHub wih template .gitignore, MIT license and README. |
| 26 | +- Created a develop branch. |
| 27 | +- Set up sensible rulesets for branches. |
| 28 | +- Created a template for GitHub issues that are development tasks. |
| 29 | +- Created a Makefile. |
| 30 | +- Created a `make requirements` command to make platform-specific requirements files. |
| 31 | +- Ran `uv init --name usethis`. |
| 32 | +- Ran `uv python pin 3.12.4`. |
| 33 | +- Created a `.requirements` directory with Python version and OS specific files. |
| 34 | + |
| 35 | +## Add GitHub Actions CI |
| 36 | + |
| 37 | +- Create a GitHub workflow file for CI manually in `.github/workflows/ci.yml`. |
| 38 | +- Use the following configuration to support GitFlow-style branch management: |
| 39 | + |
| 40 | +```yml |
| 41 | +name: CI |
| 42 | +on: |
| 43 | + workflow_dispatch: |
| 44 | + push: |
| 45 | + branches: ['main', 'develop'] |
| 46 | + pull_request: |
| 47 | +``` |
| 48 | +
|
| 49 | +- Add <https://github.com/hynek/setup-cached-uv>. |
| 50 | +- Add <https://github.com/actions/checkout>. |
| 51 | +- Set up the GitHub actions matrix to use Ubuntu, Windows and MacOS. |
| 52 | +- Set up the GitHub actions to use different Python versions. |
| 53 | +- Set up logic to use uv in GitHub actions. |
| 54 | +
|
| 55 | +## Local development configuration |
| 56 | +
|
| 57 | +- Cloned the repo from GitHub. |
| 58 | +- Ran `uv sync`. |
| 59 | +- Set up git username, email, and signing key. |
| 60 | + |
| 61 | +## Set up tests |
| 62 | + |
| 63 | +- Ran `uv add --dev pytest`. |
| 64 | +- Created a tests folder. |
| 65 | +- Added a trivial test module `test_nothing.py`. |
| 66 | +- Add a trivial test `test_pass` to the test module. |
| 67 | +- Add step to CI to install pytest |
| 68 | +- Add step to CI to install pytest-md and pytest-emoji (used by Action). |
| 69 | +- Confirm pytest is working with `pytest tests` in the CLI. |
| 70 | +- Add <https://github.com/pavelzw/pytest-action> to set up pytest in CI, using the |
| 71 | + correct CLI args to pytest. |
0 commit comments