Skip to content

Commit b227042

Browse files
Update contributing guide and docs
1 parent b2ce4ca commit b227042

File tree

9 files changed

+177
-172
lines changed

9 files changed

+177
-172
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ tick all *appropriate* boxes. But please read our
77
[contribution guide](https://github.com/robbievanleeuwen/section-properties/blob/master/CONTRIBUTING.md)
88
at least once, it will save you unnecessary review cycles! -->
99

10+
- [ ] Added a description of your pull request below.
1011
- [ ] Added **tests** for changed code.
1112
- [ ] Updated **documentation** for changed code.
12-
- [ ] Run the **Nox** test suite to check for errors and warnings.
13+
- [ ] Run `uv run pre-commit run --all-files` and `uv run pyright` to ensure code quality.
1314

1415
<!-- If you have *any* questions to *any* of the points above, just **submit and ask**!
1516
This checklist is here to *help* you, not to deter you from contributing! -->
17+
18+
<!-- PR descrtiption below -->

.github/release-drafter.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ categories:
3535
- "build"
3636

3737
category-template: "### $TITLE"
38+
name-template: "v$RESOLVED_VERSION"
39+
tag-template: "v$RESOLVED_VERSION"
3840

3941
version-resolver:
4042
major:
@@ -51,7 +53,7 @@ version-resolver:
5153
# Custom text at start of release
5254
header: >
5355
54-
xxx ?Add contributors?
56+
Insert header here...
5557
5658
template: |
5759

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
uses: actions/checkout@v4
1414

1515
- name: Run Labeler
16-
uses: crazy-max/ghaction-github-labeler@v5.0.0
16+
uses: crazy-max/ghaction-github-labeler@v5
1717
with:
1818
skip-delete: true

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ repos:
66
- id: check-toml
77
- id: end-of-file-fixer
88
- id: trailing-whitespace
9-
- id: requirements-txt-fixer
109
- repo: https://github.com/astral-sh/ruff-pre-commit
1110
rev: v0.7.0
1211
hooks:

CONTRIBUTING.md

Lines changed: 61 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Contributor Guide
22

3-
Thank you for your interest in improving this project.
4-
This project is open-source under the [MIT license] and
5-
welcomes contributions in the form of bug reports, feature requests, and pull requests.
3+
Thank you for your interest in improving this project. This project is open-source under the [MIT license] and welcomes contributions in the form of bug reports, feature requests, and pull requests.
64

75
Here is a list of important resources for contributors:
86

@@ -28,138 +26,131 @@ When filing an issue, make sure to answer these questions:
2826
- What did you expect to see?
2927
- What did you see instead?
3028

31-
The best way to get your bug fixed is to provide a test case,
32-
and/or steps to reproduce the issue.
29+
The best way to get your bug fixed is to provide a test case, and/or steps to reproduce the issue.
3330

3431
## How to request a feature
3532

36-
Features that improve `sectionproperties` can be suggested on the [Issue Tracker].
37-
It's a good idea to first submit the proposal as a feature request prior to submitting
38-
a pull request as this allows for the best coordination of efforts by preventing the
39-
duplication of work, and allows for feedback on your ideas.
33+
Features that improve `sectionproperties` can be suggested on the [Issue Tracker]. It's a good idea to first submit the proposal as a feature request prior to submitting a pull request as this allows for the best coordination of efforts by preventing the duplication of work, and allows for feedback on your ideas.
4034

4135
## How to set up your development environment
4236

43-
You need Python 3.10, 3.11 or 3.12, and the following tools:
37+
`sectionproperties` uses `uv` for python project management. `uv` can be installed on using the standalone installer:
4438

45-
- [Poetry]
46-
- [Nox]
47-
- [nox-poetry]
39+
```shell
40+
curl -LsSf https://astral.sh/uv/install.sh | sh
41+
```
42+
43+
Installation instructions for other methods and Windows can be found [here](https://docs.astral.sh/uv/getting-started/installation/).
4844

49-
Recommended dependency installation method:
45+
`uv` can then be used to install the latest compatible version of python:
46+
47+
```shell
48+
uv python install 3.12
49+
```
5050

51-
1. Install [pipx](https://pypa.github.io/pipx/installation/):
51+
`sectionproperties` and it's development dependencies can be installed with:
5252

5353
```shell
54-
python3 -m pip install --user pipx
55-
python3 -m pipx ensurepath
54+
uv sync
5655
```
5756

58-
2. Install [Poetry]:
57+
If you have other versions of python installed on your machine you may need to add the `-p` flag to ensure the correct version of python is used:
5958

6059
```shell
61-
pipx install poetry
62-
poetry --version
60+
uv sync -p 3.12
61+
uv run -p 3.12 example.py
6362
```
6463

65-
3. Install [Nox] and [nox-poetry]:
64+
Specific extras (e.g. `numba`) can be installed with the `--extra` flag or all extras with the `--all-extras` flag:
6665

6766
```shell
68-
pipx install nox
69-
pipx inject nox nox-poetry
67+
uv sync --extra numba
68+
uv sync --all-extras
7069
```
7170

72-
4. If you do not have `pandoc` installed, it will be required to build the docs. The
73-
[installation method](https://pandoc.org/installing.html) depends on what OS you are
74-
running.
71+
If you want to build the documentation locally, you will need to install `pandoc`. The [installation method](https://pandoc.org/installing.html) depends on what OS you are running.
7572

76-
Now that you have all the dependencies up and running, you can install
77-
`sectionproperties` with development requirements:
73+
To run a script using the development virtual environment, you can run:
7874

7975
```shell
80-
git clone https://github.com/robbievanleeuwen/section-properties.git
81-
cd section-properties
82-
poetry install
76+
uv run example.py
8377
```
8478

85-
Install with the `rhino` and `cad` extras:
79+
Refer to the `uv` [documentation](https://docs.astral.sh/uv/) for more information relating to using `uv` for project management.
80+
81+
## How to test the project
82+
83+
### Pre-commit
84+
85+
[Pre-commit](https://pre-commit.com/) ensures code quality and consistency by running the `ruff` linter and formatter, stripping out execution cells in jupyter notebooks, and running several pre-commit hooks.
86+
87+
These can be run against all files in the project with:
8688

8789
```shell
88-
poetry install --extras "dxf rhino"
90+
uv run pre-commit run --all-files
8991
```
9092

91-
You can now run an interactive Python session, or the command-line interface:
93+
However, the best way to ensure code quality is by installing the git pre-commit hook:
9294

9395
```shell
94-
poetry run python
95-
poetry run sectionproperties
96+
uv run pre-commit install
9697
```
9798

98-
[poetry]: https://python-poetry.org/
99-
[nox]: https://nox.thea.codes/
100-
[nox-poetry]: https://nox-poetry.readthedocs.io/
99+
This will run `pre-commit` against all changed files when attempting to `git commit`. You will need to fix the offending files prior to being able to commit a change unless you run `git commit --no-verify`.
101100

102-
## How to test the project
101+
### Type Checking
103102

104-
Run the full test suite:
103+
`sectionproperties` uses `pyright` to ensure strict type-checking where possible. `pyright` can be run on all files with:
105104

106105
```shell
107-
nox
106+
uv run pyright
108107
```
109108

110-
List the available Nox sessions:
109+
### Tests
110+
111+
The `sectionproperties` tests are located in the `tests/` directory and are written using the [pytest] testing framework. The test suite can be run with:
111112

112113
```shell
113-
nox --list-sessions
114+
uv run pytest -m 'not benchmark_suite'
114115
```
115116

116-
You can also run a specific Nox session. For example, invoke the unit test suite like
117-
this:
117+
#### Benchmarks
118+
119+
If the code you are modifying may affect the performance of `sectionproperties`, it is recommended that you run the benchmarking tests to verify the performance before and after your changes. There are three different benchmarking suites: `geometry`, `meshing` and `analysis`. These can be run like this:
118120

119121
```shell
120-
nox --session=tests
122+
uv run pytest -m benchmark_geom
123+
uv run pytest -m benchmark_mesh
124+
uv run pytest -m benchmark_analysis
121125
```
122126

123-
Unit tests are located in the _tests_ directory, and are written using the [pytest]
124-
testing framework.
127+
Note that a plot of the results can be generated by adding the `--benchmark-histogram` option to the above commands.
128+
129+
[pytest]: https://pytest.readthedocs.io/
125130

126-
### Benchmarks
131+
### Documentation
127132

128-
If the code you are modifying may affect the performance of `sectionproperties`, it is
129-
recommended that you run the benchmarking tests to verify the performance before and
130-
after your changes. There are three different benchmarking suites: `geometry`, `meshing`
131-
and `analysis`. These can be run like this:
133+
You can build the documentation locally with:
132134

133135
```shell
134-
poetry run pytest -m benchmark_geom
135-
poetry run pytest -m benchmark_mesh
136-
poetry run pytest -m benchmark_analysis
136+
uv run sphinx-build docs docs/_build
137137
```
138138

139-
Note that a plot of the results can be generated by adding the `--benchmark-histogram`
140-
option to the above commands.
139+
Make sure that you have a recent version of `pandoc` installed so that the example notebooks can be generated.
141140

142-
[pytest]: https://pytest.readthedocs.io/
141+
Note that all pull requests also build the documentation on Read the Docs, so building the documentation locally is not required.
143142

144143
## How to submit changes
145144

146145
Open a [pull request] to submit changes to this project.
147146

148147
Your pull request needs to meet the following guidelines for acceptance:
149148

150-
- The Nox test suite must pass without errors and warnings.
149+
- The test suite, pre-commit and pyright checks must pass without errors and warnings.
151150
- Include unit tests. This project aims for a high code coverage.
152151
- If your changes add functionality, update the documentation accordingly.
153152

154-
To run linting and code formatting checks before committing your change, you can install
155-
pre-commit as a Git hook by running the following command:
156-
157-
```shell
158-
nox --session=pre-commit -- install
159-
```
160-
161-
It is recommended to open an issue before starting work on anything.
162-
This will allow a chance to talk it over with the owners and validate your approach.
153+
It is recommended to open an issue before starting work on anything. This will allow a chance to talk it over with the owners and validate your approach.
163154

164155
[pull request]: https://github.com/robbievanleeuwen/section-properties/pulls
165156
[code of conduct]: CODE_OF_CONDUCT.md

README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99
[![Python Version](https://img.shields.io/pypi/pyversions/sectionproperties)][python version]
1010
[![License](https://img.shields.io/pypi/l/sectionproperties)][license]
1111
[![Read the documentation at https://sectionproperties.readthedocs.io/](https://img.shields.io/readthedocs/sectionproperties/stable.svg?label=Read%20the%20Docs)][read the docs]
12-
[![Tests](https://github.com/robbievanleeuwen/section-properties/actions/workflows/tests.yml/badge.svg?branch=master)][tests]
13-
[![Codecov](https://codecov.io/gh/robbievanleeuwen/section-properties/branch/master/graph/badge.svg)][codecov]
12+
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)][uv]
13+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)][ruff]
1414
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]
15-
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
15+
[![Tests](https://github.com/robbievanleeuwen/section-properties/actions/workflows/ci.yml/badge.svg?branch=master)][tests]
16+
[![Codecov](https://codecov.io/gh/robbievanleeuwen/section-properties/branch/master/graph/badge.svg)][codecov]
1617
[![DOI](https://joss.theoj.org/papers/10.21105/joss.06105/status.svg)][joss]
1718

1819
[pypi_]: https://pypi.org/project/sectionproperties/
1920
[status]: https://pypi.org/project/sectionproperties/
2021
[python version]: https://pypi.org/project/sectionproperties
2122
[read the docs]: https://sectionproperties.readthedocs.io/
22-
[tests]: https://github.com/robbievanleeuwen/section-properties/actions?workflow=Tests
23-
[codecov]: https://app.codecov.io/gh/robbievanleeuwen/section-properties
23+
[uv]: https://github.com/astral-sh/uv
24+
[ruff]: https://github.com/astral-sh/ruff
2425
[pre-commit]: https://github.com/pre-commit/pre-commit
25-
[black]: https://github.com/psf/black
26+
[tests]: https://github.com/robbievanleeuwen/section-properties/actions/workflows/ci.yml
27+
[codecov]: https://app.codecov.io/gh/robbievanleeuwen/section-properties
2628
[joss]: https://doi.org/10.21105/joss.06105
2729

2830
`sectionproperties` is a python package for the analysis of arbitrary cross-sections
@@ -75,14 +77,7 @@ that relevant engineering theories have been correctly implemented, it remains t
7577
user's responsibility to confirm and accept the output. Refer to the
7678
[license](LICENSE.md) for clarification of the conditions of use.
7779

78-
## Credits
79-
80-
This project was generated from [@cjolowicz]'s [Hypermodern Python Cookiecutter]
81-
template.
82-
83-
[@cjolowicz]: https://github.com/cjolowicz
8480
[pypi]: https://pypi.org/
85-
[hypermodern python cookiecutter]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
8681
[pip]: https://pip.pypa.io/
8782
[license]: https://github.com/robbievanleeuwen/section-properties/blob/master/LICENSE
8883
[contributor guide]: https://github.com/robbievanleeuwen/section-properties/blob/master/CONTRIBUTING.md

0 commit comments

Comments
 (0)