You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of the commands used in the development of `samplepackagename` use the tool `nox`.
167
-
The `nox` commands are defined in the file [`noxfile.py`](https://github.com/organizationname/samplepackagename/blob/main/Makefile), and are run in the terminal / command prompt with the format ```nox -s <<command name>>```.
167
+
The `nox` commands are defined in the file [`noxfile.py`](https://github.com/organizationname/samplepackagename/blob/main/noxfile.py), and are run in the terminal / command prompt with the format ```nox -s <<command name>>```.
168
168
169
169
You can install nox with `pip install nox`.
170
170
@@ -207,6 +207,8 @@ We use [pre-commit](https://pre-commit.com/) to check code style. This can be us
207
207
nox -s lint
208
208
```
209
209
210
+
To have `pre-commit` run automatically on commits, install it with `pre-commit install`
211
+
210
212
Go through the output of this and try to change the code based on the errors. Search the error codes on the [Ruff documentation](https://docs.astral.sh/ruff/), which should give suggestions. Re-run the check to see if you've fixed it. Somethings can't be resolved (unsplittable urls longer than the line length). For these, add `# noqa: []` at the end of the line and the check will ignore it. Inside the square brackets add the specific error code you want to ignore.
211
213
212
214
We also use [Pylint](https://pylint.readthedocs.io/en/latest/), which performs static-linting on the code. This checks the code and catches many common bugs and errors, without running any of the code. This check is slightly slower the the `Ruff` check. Run it with the following:
Copy file name to clipboardExpand all lines: README.md
+13-8Lines changed: 13 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,16 +20,20 @@ Steps:
20
20
- choose public or private. This can be changed later, but to be published on PyPI or Conda-Forge, or for the documentation website to work, it needs to be public.
21
21
- create the repository
22
22
- update any repository settings, below are my recommended settings:
23
-
- protect the main branch so any changed to it need to be made through a Pull Request.
23
+
- enable discussions
24
+
- only allow squash merging (disable the other options)
25
+
- always suggest updating pull request branches
26
+
- automatically delete head branches
27
+
- protect the main branch so any changes to it need to be made through a Pull Request.
24
28
- go to the repository's `Settings`, `Branches`, `Add branch ruleset`. Name it "protected_main", make the `Enforecement status` Active, include the Default branch as the target, and check the following `Rules`: `Restrict deletion`, `Require a pull request before merging`, only allow `Squash` as a merge method, and `Block force pushes`
25
29
2) Update this template:
26
-
- clone your repository to your computer with `git clone <url of the github repo>`
27
-
- change all instances of `samplepackagename` in this repository with your chosen name. (If use a program like VSCode use a `search and replace` function (i.e. `ctrl+f`))
30
+
- clone your repository to your computer with `git clone <url of the github repo>`; if you create the repository on an organization's GitHub instead of your personal one, first fork the repository before you clone it.
31
+
- change all instances of `samplepackagename` in this repository with your chosen name. (If use a program like VSCode use a `search and replace` function (i.e. `ctrl+f`)), there should be over 100 instances of `samplepackagename`.
28
32
- this includes the folder name of `src/samplepackagename/`
29
33
- replace all instances of `yourname` with your name
30
34
- your name can be "Maintainers of <samplepackagename>" if there are multiple people.
31
-
- replace all instances of `organizationname` with your GitHub organization (or personal) account name.
32
-
- update `pyproject.yml` with a description and keywords
35
+
- replace all instances of `organizationname` with your GitHub organization (or personal) account name, whichever is going to host the repository.
36
+
- update `pyproject.yml` with a description (1 sentence) and keywords ()
33
37
- add a description of your project here in the README, as well as in `docs/index.md`.
34
38
- add your info to `AUTHORS.md`
35
39
- at this point, it might be good to make your initial commit to your repository with the following git commands:
@@ -39,9 +43,10 @@ Steps:
39
43
git commit -m "initialize template with names"
40
44
git push -u origin new-branch
41
45
```
42
-
- inyour GitHub repository, go to the `Pull request` tab and open a PR for your changes. Merge this into main.
46
+
- inthe GitHub repository, go to the `Pull request` tab and open a PR for your changes. Merge this into main.
43
47
3) Add your code
44
-
- pull in your above changes with `git fetch` and `git pull`.
48
+
- pull in your above changes with `git checkout main` and `git merge upstream/main`
49
+
- if your working off a fork: push the above commit to sync your fork with upstream with `git push origin main`.
45
50
- decide on a module name(s)
46
51
- these need to be lowercase, should be short and while possible, shouldn't include underscores.
47
52
- if your package is going to be small, a single module with the same name as the package is fine. If it's going to be more than a few hundred lines of code, it's best to separate your code into distinct modules which perform similar tasks. - for each module you want do the following:
@@ -73,7 +78,7 @@ Steps:
73
78
5) Create environment, style check, test, and commit your changes.
74
79
- follow the instructions in`CONTRIBUTING.md` starting at section `Setting up nox` and stopping before `Publish a new release`.
75
80
- these steps should result in a merged PR with your code.
76
-
6) Set up automated Zenodo releases
81
+
6) Set up automated Zenodo releases (only for Public repositories)
77
82
- if you haven't already, link your organization (or personal) GitHub account to [Zenodo](https://zenodo.org/) using `Linked accounts` under your Zenodo profile.
78
83
- do to the `GitHub` menu on your Zenodo profile.
79
84
- click the Sync button and then turn on the switch for your repository.
0 commit comments