Skip to content

Commit 7bb85fc

Browse files
authored
Dev (#5)
* fix RTD build and update instructions * fix pre-commit ignore files issue * use conda environment.yml for RTD build * add pip install to RTD config * fix RTD links * Add more template instructions * update readme * don't ingore pickle files * remove duplicate ipykernel in environment.yml * use packagename in make env commands * update contribute guide and readme * reorganize project urls in pyproject.toml * miss-spelling
1 parent 3bc7968 commit 7bb85fc

6 files changed

Lines changed: 24 additions & 23 deletions

File tree

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
data/*
33
!data/.gitkeep
44

5-
# Ignore any generated pickle files
6-
**.pickle
7-
85
# Ignore the virtual environment
96
**uv.lock
107

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ git remote add upstream https://github.com/organizationname/samplepackagenamee.g
164164
### Setting up `nox`
165165

166166
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>>```.
168168

169169
You can install nox with `pip install nox`.
170170

@@ -207,6 +207,8 @@ We use [pre-commit](https://pre-commit.com/) to check code style. This can be us
207207
nox -s lint
208208
```
209209

210+
To have `pre-commit` run automatically on commits, install it with `pre-commit install`
211+
210212
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.
211213

212214
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:

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Build, package, test, and clean
21
PROJECT=samplepackagename
32

43
####
@@ -8,13 +7,13 @@ PROJECT=samplepackagename
87
####
98

109
create:
11-
mamba env create --file environment.yml
10+
mamba env create --file environment.yml --name $(PROJECT)
1211

1312
install:
1413
pip install --no-deps -e .
1514

1615
update:
17-
mamba env update --file environment.yml --prune
16+
mamba env update --file environment.yml --name $(PROJECT) --prune
1817

1918
remove:
2019
mamba env remove --name $(PROJECT)

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,20 @@ Steps:
2020
- 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.
2121
- create the repository
2222
- 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.
2428
- 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`
2529
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`.
2832
- this includes the folder name of `src/samplepackagename/`
2933
- replace all instances of `yourname` with your name
3034
- 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 ()
3337
- add a description of your project here in the README, as well as in `docs/index.md`.
3438
- add your info to `AUTHORS.md`
3539
- 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:
3943
git commit -m "initialize template with names"
4044
git push -u origin new-branch
4145
```
42-
- in your GitHub repository, go to the `Pull request` tab and open a PR for your changes. Merge this into main.
46+
- in the GitHub repository, go to the `Pull request` tab and open a PR for your changes. Merge this into main.
4347
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`.
4550
- decide on a module name(s)
4651
- these need to be lowercase, should be short and while possible, shouldn't include underscores.
4752
- 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:
7378
5) Create environment, style check, test, and commit your changes.
7479
- follow the instructions in `CONTRIBUTING.md` starting at section `Setting up nox` and stopping before `Publish a new release`.
7580
- 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)
7782
- if you haven't already, link your organization (or personal) GitHub account to [Zenodo](https://zenodo.org/) using `Linked accounts` under your Zenodo profile.
7883
- do to the `GitHub` menu on your Zenodo profile.
7984
- click the Sync button and then turn on the switch for your repository.

environment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ dependencies:
1818
- nbsphinx
1919
- ipykernel
2020
# dev
21-
- ipykernel
2221
- jupyterlab
2322
# below packages need to be installed with pip (aren't available in conda-forge)
2423
# - pip

pyproject.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ dynamic = ["version"]
3333
dependencies = [
3434
]
3535

36-
[project.urls]
37-
Homepage = "https://github.com/organizationname/samplepackagename"
38-
"Bug Tracker" = "https://github.com/organizationname/samplepackagename/issues"
39-
Discussions = "https://github.com/organizationname/samplepackagename/discussions"
40-
Changelog = "https://github.com/organizationname/samplepackagename/docs/changelog.md"
41-
42-
4336
[dependency-groups]
4437
test = [
4538
"pytest >=6",
@@ -63,6 +56,12 @@ all = [
6356
{include-group = "docs"},
6457
]
6558

59+
[project.urls]
60+
Homepage = "https://github.com/organizationname/samplepackagename"
61+
"Bug Tracker" = "https://github.com/organizationname/samplepackagename/issues"
62+
Discussions = "https://github.com/organizationname/samplepackagename/discussions"
63+
Changelog = "https://github.com/organizationname/samplepackagename/docs/changelog.md"
64+
6665

6766
[tool.hatch]
6867
version.source = "vcs"

0 commit comments

Comments
 (0)