Skip to content

Commit e74dcc2

Browse files
committed
Move contributing details
It is as though there was a file for these details all along.
1 parent 0d2edad commit e74dcc2

3 files changed

Lines changed: 171 additions & 165 deletions

File tree

CONTRIBUTING.md

Lines changed: 155 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,15 @@ Before contributing, please either ask to claim an existing open issue or create
44
a new issue to discuss your proposed changes with the owner(s) of this repo
55
before making any changes.
66

7-
*Any pull requests without an approved issue associated with them will be
8-
closed*
7+
Any pull requests without a clearly defined issue being solved will be closed.
98

10-
## Bug reports
9+
### Bug reports
1110

1211
Found a bug but do not have time or do not wish to contribute a fix? Please
1312
submit an issue for our awareness. Your feedback drives the continued
1413
development of the project!
1514

16-
## Fork
17-
18-
Create your own fork of this repo that you will make your changes on.
19-
20-
## Creating your feature
21-
22-
Always base your changes off the `main` branch unless otherwise asked.
23-
24-
## Pull Request
15+
### Pull Request
2516

2617
All pull requests must:
2718

@@ -30,16 +21,166 @@ All pull requests must:
3021
- If the PR is a bug fix there must be a test that duplicates the bug, proving
3122
it is fixed
3223

33-
## Code Style
24+
### Code Style
3425

3526
Follow the patterns seen in the code. Walk where others have walked.
3627

3728
The majority of code style nits will be met when passing `pre-commit` checks
3829
prior to submitting a pull request.
3930

40-
## Tests
31+
### Tests
4132

4233
- Smaller tests are easier to work with
4334
- Mock at a minimum
4435
- No test should be dependent on another
4536
- No test should be dependent on secrets/tokens
37+
38+
39+
---
40+
41+
# Local developer installation
42+
43+
The following steps outline how to install this repo for local development.
44+
45+
## Prerequisites
46+
47+
### Clone repo
48+
49+
```console
50+
git clone https://github.com/[ORG NAME]/[REPO NAME]
51+
52+
cd [REPO NAME]
53+
```
54+
55+
### Virtual Environment
56+
57+
Use a ([`venv`](https://docs.python.org/3/library/venv.html)), or equivalent,
58+
when working with python projects. Leveraging a `venv` will ensure the installed
59+
dependency files will not impact other python projects or any system
60+
dependencies.
61+
62+
**Windows users**: Depending on your python install you will use `py` in place
63+
of `python` to create the `venv`.
64+
65+
**Linux/Mac users**: Replace `python`, if needed, with the appropriate call to
66+
the desired version while creating the `venv`. (e.g. `python3` or `python3.12`)
67+
68+
**All users**: Once inside an active `venv` all systems should allow the use of
69+
`python` for command line instructions. This will ensure you are using the
70+
`venv`'s python and not the system level python.
71+
72+
### Create the `venv`:
73+
74+
```console
75+
python -m venv venv
76+
```
77+
78+
Activate the `venv`:
79+
80+
```console
81+
# Linux/Mac
82+
. venv/bin/activate
83+
84+
# Windows
85+
venv\Scripts\activate
86+
```
87+
88+
The command prompt should now have a `(venv)` prefix on it. `python` will now
89+
call the version of the interpreter used to create the `venv`
90+
91+
To deactivate (exit) the `venv`:
92+
93+
```console
94+
deactivate
95+
```
96+
97+
---
98+
99+
## Developer Installation Steps
100+
101+
### Install editable library and development requirements
102+
103+
```console
104+
python -m pip install --editable .[dev,test]
105+
```
106+
107+
### Install pre-commit [(see below for details)](#pre-commit)
108+
109+
```console
110+
pre-commit install
111+
```
112+
113+
### Install with nox
114+
115+
If you have `nox` installed with `pipx` or in the current venv you can use the
116+
following session. This is an alternative to the two steps above.
117+
118+
```console
119+
nox -s install
120+
```
121+
122+
---
123+
124+
## Pre-commit and nox tools
125+
126+
### Run pre-commit on all files
127+
128+
```console
129+
pre-commit run --all-files
130+
```
131+
132+
### Run tests with coverage (quick)
133+
134+
```console
135+
nox -e coverage
136+
```
137+
138+
### Run tests (slow)
139+
140+
```console
141+
nox
142+
```
143+
144+
### Build dist
145+
146+
```console
147+
nox -e build
148+
```
149+
150+
---
151+
152+
## Updating dependencies
153+
154+
New dependencys can be added to the `requirements-*.in` file. It is recommended
155+
to only use pins when specific versions or upgrades beyond a certain version are
156+
to be avoided. Otherwise, allow `pip-compile` to manage the pins in the
157+
generated `requirements-*.txt` files.
158+
159+
Once updated following the steps below, the package can be installed if needed.
160+
161+
### Update the generated files with changes
162+
163+
```console
164+
nox -e update
165+
```
166+
167+
### Upgrade all generated dependencies
168+
169+
```console
170+
nox -e upgrade
171+
```
172+
173+
---
174+
175+
## [pre-commit](https://pre-commit.com)
176+
177+
> A framework for managing and maintaining multi-language pre-commit hooks.
178+
179+
This repo is setup with a `.pre-commit-config.yaml` with the expectation that
180+
any code submitted for review already passes all selected pre-commit checks.
181+
182+
---
183+
184+
## Error: File "setup.py" not found
185+
186+
Update `pip` to at least version 22.3.1

README.md

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -37,154 +37,3 @@ fit.
3737
- **A:** I'm constantly finding new tweaks that make the template fit just a
3838
little better. I'm also open to ideas and suggestions so please drop an
3939
issue if you have one.
40-
41-
---
42-
43-
# Local developer installation
44-
45-
The following steps outline how to install this repo for local development. See
46-
the [CONTRIBUTING.md](CONTRIBUTING.md) file in the repo root for information on
47-
contributing to the repo.
48-
49-
## Prerequisites
50-
51-
### Clone repo
52-
53-
```console
54-
git clone https://github.com/[ORG NAME]/[REPO NAME]
55-
56-
cd [REPO NAME]
57-
```
58-
59-
### Virtual Environment
60-
61-
Use a ([`venv`](https://docs.python.org/3/library/venv.html)), or equivalent,
62-
when working with python projects. Leveraging a `venv` will ensure the installed
63-
dependency files will not impact other python projects or any system
64-
dependencies.
65-
66-
**Windows users**: Depending on your python install you will use `py` in place
67-
of `python` to create the `venv`.
68-
69-
**Linux/Mac users**: Replace `python`, if needed, with the appropriate call to
70-
the desired version while creating the `venv`. (e.g. `python3` or `python3.8`)
71-
72-
**All users**: Once inside an active `venv` all systems should allow the use of
73-
`python` for command line instructions. This will ensure you are using the
74-
`venv`'s python and not the system level python.
75-
76-
### Create the `venv`:
77-
78-
```console
79-
python -m venv venv
80-
```
81-
82-
Activate the `venv`:
83-
84-
```console
85-
# Linux/Mac
86-
. venv/bin/activate
87-
88-
# Windows
89-
venv\Scripts\activate
90-
```
91-
92-
The command prompt should now have a `(venv)` prefix on it. `python` will now
93-
call the version of the interpreter used to create the `venv`
94-
95-
To deactivate (exit) the `venv`:
96-
97-
```console
98-
deactivate
99-
```
100-
101-
---
102-
103-
## Developer Installation Steps
104-
105-
### Install editable library and development requirements
106-
107-
```console
108-
python -m pip install --editable .[dev,test]
109-
```
110-
111-
### Install pre-commit [(see below for details)](#pre-commit)
112-
113-
```console
114-
pre-commit install
115-
```
116-
117-
### Install with nox
118-
119-
If you have `nox` installed with `pipx` or in the current venv you can use the
120-
following session. This is an alternative to the two steps above.
121-
122-
```console
123-
nox -s install
124-
```
125-
126-
---
127-
128-
## Pre-commit and nox tools
129-
130-
### Run pre-commit on all files
131-
132-
```console
133-
pre-commit run --all-files
134-
```
135-
136-
### Run tests with coverage (quick)
137-
138-
```console
139-
nox -e coverage
140-
```
141-
142-
### Run tests (slow)
143-
144-
```console
145-
nox
146-
```
147-
148-
### Build dist
149-
150-
```console
151-
nox -e build
152-
```
153-
154-
---
155-
156-
## Updating dependencies
157-
158-
New dependencys can be added to the `requirements-*.in` file. It is recommended
159-
to only use pins when specific versions or upgrades beyond a certain version are
160-
to be avoided. Otherwise, allow `pip-compile` to manage the pins in the
161-
generated `requirements-*.txt` files.
162-
163-
Once updated following the steps below, the package can be installed if needed.
164-
165-
### Update the generated files with changes
166-
167-
```console
168-
nox -e update
169-
```
170-
171-
### Upgrade all generated dependencies
172-
173-
```console
174-
nox -e upgrade
175-
```
176-
177-
---
178-
179-
## [pre-commit](https://pre-commit.com)
180-
181-
> A framework for managing and maintaining multi-language pre-commit hooks.
182-
183-
This repo is setup with a `.pre-commit-config.yaml` with the expectation that
184-
any code submitted for review already passes all selected pre-commit checks.
185-
186-
---
187-
188-
## Error: File "setup.py" not found
189-
190-
Update `pip` to at least version 22.3.1

init_template.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
PLACEHOLDER_DIR = [Path("src/module_name/sample_data")]
1818
PYPROJECT_TARGET = Path("pyproject.toml")
1919
README_TARGET = Path("README.md")
20+
CONTRIBUTING_TARGET = Path("CONTRIBUTING.md")
2021
NOX_TARGET = Path("noxfile.py")
2122
ALT_FILE_DIR = Path("alt_files")
2223
REQUIREMENTS_DIR = Path("requirements")
@@ -111,6 +112,20 @@ def replace_readme_values(data: ProjectData) -> None:
111112
README_TARGET.write_text(readme)
112113

113114

115+
@bookends("Updating references in CONTRIBUTING.md")
116+
def replace_contributing_values(data: ProjectData) -> None:
117+
"""Update badge urls and placeholders in README.md"""
118+
readme = CONTRIBUTING_TARGET.read_text()
119+
default = ProjectData()
120+
121+
readme = re.sub(ORG, data.org_name, readme)
122+
readme = re.sub(REPO, data.repo_name, readme)
123+
readme = re.sub(re.escape(default.org_name), data.org_name, readme)
124+
readme = re.sub(re.escape(default.repo_name), data.repo_name, readme)
125+
126+
CONTRIBUTING_TARGET.write_text(readme)
127+
128+
114129
@bookends("Updating noxfile.py values")
115130
def replace_nox_values(data: ProjectData) -> None:
116131
"""Update nox value, replacing module_name with actual module name."""
@@ -134,6 +149,7 @@ def rename_module_folder(name: str) -> None:
134149
replace_pyproject_values(project_data)
135150
replace_nox_values(project_data)
136151
replace_readme_values(project_data)
152+
replace_contributing_values(project_data)
137153

138154
delete_placeholder_files()
139155
delete_placeholder_directories()

0 commit comments

Comments
 (0)