|
1 |
| -# Table of Contents |
2 |
| - |
3 |
| -- [Pull request workflow](#pull-request-workflow) |
4 |
| - * [Syncing your fork's `main` with `upstream main`](#syncing-your-fork-s--main--with--upstream-main-) |
5 |
| - * [Working on a feature (and rebasing)](#working-on-a-feature--and-rebasing-) |
6 |
| - + [Working on a feature](#working-on-a-feature) |
7 |
| - + [Rebasing without conflicts](#rebasing-without-conflicts) |
8 |
| - + [Rebasing WITH conflicts](#rebasing-with-conflicts) |
9 |
| - + [Rebasing ... panic mode (or "the easy way")](#rebasing--panic-mode--or--the-easy-way--) |
10 |
| -- [Info about docs](#info-about-docs) |
11 |
| -- [Info about versioning](#info-about-versioning) |
12 |
| -- [How to make a release](#how-to-make-a-release) |
13 |
| - |
14 |
| -# Pull request workflow |
15 |
| - |
16 |
| -- assuming you are working with `git` from a command line |
17 |
| -- assuming your GitHub username is `username` |
18 |
| -- `github.com/sappelhoff/pyprep` is `upstream` |
19 |
| -- `github.com/username/pyprep` is `origin` (your *fork*) |
20 |
| - |
21 |
| -## Syncing your fork's `main` with `upstream main` |
22 |
| - |
23 |
| -- first, you start with *forking* `upstream` |
24 |
| -- then, you continue by *cloning* your fork: `git clone https://github.com/username/pyprep` |
25 |
| - - you'll have your own `main` branch there |
26 |
| -- **you always want to make sure that your fork's `main` and `upstream main` are aligned** |
27 |
| - - to do this, you work with *git remotes* |
28 |
| - - Note: this also means that you NEVER work on `main` (unless you know |
29 |
| - what you are doing) ... because you want to always be able to SYNC your |
30 |
| - fork with `upstream`, which would mean losing your own work on `main` |
31 |
| -- use `git remote -v` to list your configured remotes |
32 |
| - - initially this will only list `origin` ... a bit like this maybe: |
33 |
| - |
34 |
| -```Text |
35 |
| -origin https://github.com/username/pyprep (fetch) |
36 |
| -origin https://github.com/username/pyprep (push) |
37 |
| -``` |
38 |
| - |
39 |
| -- Now you want to add `upstream` as a remote. Use |
40 |
| - `git remote add upstream https://github.com/sappelhoff/pyprep` |
41 |
| -- again, do `git remote -v`, it should look like this: |
42 |
| - |
43 |
| -```Text |
44 |
| -origin https://github.com/username/pyprep (fetch) |
45 |
| -origin https://github.com/username/pyprep (push) |
46 |
| -upstream https://github.com/sappelhoff/pyprep (fetch) |
47 |
| -upstream https://github.com/sappelhoff/pyprep (push) |
48 |
| -
|
49 |
| -``` |
50 |
| - |
51 |
| -- Now you can use your `upstream` *remote* to make sure your fork's `main` is |
52 |
| - up to date. |
53 |
| - 1. `git checkout main` to make sure you are on your `main` branch |
54 |
| - 1. Make sure you do not have any changes on your `main`, because we will |
55 |
| - discard them! |
56 |
| - 1. `git pull upstream main` SYNC your fork and `upstream` |
57 |
| - 1. sometimes there are issues, so to be safe, do: |
58 |
| - `git reset --hard upstream/main` ... this makes sure that both |
59 |
| - branches are really synced. |
60 |
| - 1. ensure with another `git pull upstream main` ... this should say |
61 |
| - "already up to date" |
| 1 | +# Contributions |
62 | 2 |
|
63 |
| -## Working on a feature (and rebasing) |
| 3 | +Contributions are welcome in the form of feedback and discussion in issues, |
| 4 | +or pull requests for changes to the code. |
64 | 5 |
|
65 |
| -### Working on a feature |
| 6 | +Once the implementation of a piece of functionality is considered to be free of |
| 7 | +bugs and properly documented, it can be incorporated into the `main` branch. |
66 | 8 |
|
67 |
| -- before working on any feature: always do `git checkout main` and |
68 |
| - `git pull upstream main` |
69 |
| -- then make your new branch to work on and check it out, for example |
70 |
| - `git checkout -b my_feature` |
71 |
| - - do your work |
72 |
| - - submit a pull request |
73 |
| - - hope you are lucky and nobody did work in between |
74 |
| -- however IF somebody did work in between, we need to *rebase*. Just follow the |
75 |
| - steps below |
| 9 | +To help developing `pyprep`, |
| 10 | +you will need a few adjustments to your installation as shown below. |
76 | 11 |
|
77 |
| -### Rebasing without conflicts |
| 12 | +## Install the development version |
78 | 13 |
|
79 |
| -1. sync `main` through: `git checkout main` and `git pull upstream main` |
80 |
| -1. go back to your branch and rebase it: `git checkout my_feature` and then |
81 |
| - `git rebase main` |
| 14 | +First make a fork of the repository under your `USERNAME` GitHub account. |
| 15 | +Then, in your Python environment follow these steps: |
82 | 16 |
|
83 |
| -Now it could be that you are lucky and there no conflicts ... in that case, the |
84 |
| -rebase just works and you can then finish up by *force pushing* your rebased |
85 |
| -branch: `git push -f my_feature` ... you need to force it, because rebasing |
86 |
| -changed the history of your branch. But don't worry, if rebasing "just worked" |
87 |
| -without any conflicts, this should be very safe. |
88 |
| - |
89 |
| -### Rebasing WITH conflicts |
| 17 | +```Shell |
| 18 | +git clone https://github.com/USERNAME/pyprep |
| 19 | +cd pyprep |
| 20 | +git fetch --tags --prune --prune-tags |
| 21 | +python -m pip install -e ".[dev]" |
| 22 | +pre-commit install |
| 23 | +``` |
90 | 24 |
|
91 |
| -In case you are unlucky, there are conflicts and you'll have to resolve them |
92 |
| -step by step ... `git` will be in *rebase* mode and try to rebase one commit |
93 |
| -after another ... for each commit where conflicts are detected, it'll stop. |
| 25 | +You may also clone the repository via ssh, depending on your preferred workflow |
| 26 | +( `git clone [email protected]:USERNAME/pyprep.git`). |
94 | 27 |
|
95 |
| -Then you have to do: `git status` to see conflicting files ... then edit these |
96 |
| -files to resolve conflicts ... then `git add <filename>` ... and then |
97 |
| -`git rebase --continue` to go on to the next commit, rinse and repeat. |
| 28 | +Note that we are working with "pre-commit hooks". |
| 29 | +See https://pre-commit.com/ for more information. |
98 | 30 |
|
99 |
| -**NOTE: the conflict resolution part is the dangerous part that can get very |
100 |
| -messy and where you can actually lose stuff ... so make backups of your branch |
101 |
| -before.** |
| 31 | +## Running tests and coverage |
102 | 32 |
|
103 |
| -After everything is resolved, you can again do `git push -f my_feature`. |
| 33 | +If you have followed the steps to get the development version, |
| 34 | +you can run tests as follows. |
| 35 | +From the project root, call: |
104 | 36 |
|
105 |
| -If you screw up **during** rebasing and you panic, you can do |
106 |
| -`git rebase --abort` and start again. |
| 37 | +- `pytest` to run tests and coverage |
| 38 | +- `pre-commit run -a` to run style checks (Ruff and some additional hooks) |
107 | 39 |
|
108 |
| -### Rebasing ... panic mode |
| 40 | +## Building the documentation |
109 | 41 |
|
110 |
| -If nothing helps and you just don't know how to resolve the issues and |
111 |
| -conflicts that arise during rebasing, just make a new branch: |
112 |
| - 1. `git checkout main` |
113 |
| - 1. `git pull upstream main` |
114 |
| - 1. `git checkout -b my_feature_2nd_attempt` |
| 42 | +The documentation can be built using [Sphinx](https://www.sphinx-doc.org). |
115 | 43 |
|
116 |
| -... and apply your changes manually. |
| 44 | +The publicly accessible documentation is built and hosted by |
| 45 | +[Read the Docs](https://readthedocs.org/). |
| 46 | +Credentials for Read the Docs are currently held by: |
117 | 47 |
|
118 |
| -This method is not really a `git` workflow, ... but in cases where there are |
119 |
| -only few changes, this is often a practical solution. |
| 48 | +- [@sappelhoff](https://github.com/sappelhoff/) |
120 | 49 |
|
121 |
| -# Info about versioning |
| 50 | +## Info about versioning |
122 | 51 |
|
123 | 52 | We follow a [semantic versioning scheme](https://semver.org/).
|
124 | 53 | This is implemented via [hatch-vcs](https://github.com/ofek/hatch-vcs).
|
125 | 54 |
|
126 |
| -# Info about docs |
127 |
| - |
128 |
| -The documentation is build and hosted by [https://readthedocs.org/](https://readthedocs.org/). |
129 |
| - |
130 |
| -Admin credentials are needed to access the setup. |
131 |
| - |
132 |
| -# How to make a release |
| 55 | +## Making a release on GitHub, PyPi, and Conda-Forge |
133 | 56 |
|
134 | 57 | - needs admin rights
|
135 | 58 | - we are using [semver](https://semver.org/) (see section on versioning)
|
|
0 commit comments