Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre ROpenSci comments #21

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 65 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,69 @@ Co-authored-by: name <name@example.com>
Co-authored-by: another-name <another-name@example.com>
```

## Getting Started
## Development

The `README.md` has developer setup instructions. Your contributions make this
project better for everyone. Thank you for participating!
Your contributions make this project better for everyone. Thank you for
participating!

### Local Development

Often it is useful to have [pixi](https://prefix.dev/) handle the dependencies:

```bash
pixi shell
```

A `pre-commit` job is set up on CI to enforce consistent styles. It is advisable
to set it up locally as well using [pipx](https://pypa.github.io/pipx/) for
isolation:

```bash
# Run before committing
pipx run pre-commit run --all-files
# Or install the git hook to enforce this
pipx run pre-commit install
```

For working with packages with compiled extensions, instead of `devtools::load_all()` it can be more useful to run this instead:

```{r eval=FALSE}
devtools::clean_dll()
cpp11::cpp_register()
devtools::document()
devtools::load_all()
```

Also don't forget to recreate the `readme` file:
```{r eval=FALSE}
devtools::build_readme()
```

If you find that `pre-commit` for R is flaky, you can consider the following commands:

```bash
find . \( -path "./.pixi" -o -path "./renv" \) -prune -o -type f -name "*.R" -exec Rscript -e 'library(styler); style_file("{}")' \;
Rscript -e 'library(lintr); lintr::lint_package(".")'
```

#### Tests

Tests and checks are run on the CI, however locally one can use:

```bash
Rscript -e 'devtools::test()'
```


#### Documentation

Ideally each change should be documented. Major changes should be `vignettes`,
and minor ones can be added to `newsfragments`.

Benchmark vignettes are pre-computed via:

```bash
Rscript rebuild-benchmarks.R
```

Which makes it faster to build the package and run checks.
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This is the changelog for the `fastMatMR` package.

<!-- towncrier release notes start -->

# 0.0.1.0 (2023-09-02)
# fastMatMR 0.0.1.0 (2023-09-02)

## Features

Expand All @@ -11,7 +11,7 @@ This is the changelog for the `fastMatMR` package.
- Support reading sparse matrices from Matrix.


# 0.0.0.9000 (2023-08-31)
# fastMatMR 0.0.0.9000 (2023-08-31)

## Improved Documentation

Expand Down
61 changes: 8 additions & 53 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ devtools::install_github("HaoZeke/fastMatMR")

```{r eval=FALSE}
library(fastMatMR)
Matrix::Matrix(c(1, 0, 3, 2), nrow = 2, sparse = TRUE) -> spmat
write_fmm(vec, "vector.mtx")
spmat <- Matrix::Matrix(c(1, 0, 3, 2), nrow = 2, sparse = TRUE)
write_fmm(spmat, "sparse.mtx")
```

To see what this does, consider reading it back in `python`:
Expand All @@ -53,59 +53,14 @@ To see what this does, consider reading it back in `python`:
pip install fast_matrix_market
python -c 'import fast_matrix_market as fmm; print(fmm.read_array_or_coo("sparse.mtx"))'
((array([1., 3., 2.]), (array([0, 0, 1], dtype=int32), array([0, 1, 1], dtype=int32))), (2, 2))
python -c 'import fast_matrix_market as fmm; print(fmm.read_array("sparse.mtx"))'
array([[1., 3.],
[0., 2.]])
```

Similarly, we support writing and reading from other `R` objects.

## Development

### Local Development

Often it is useful to have `pixi` handle the dependencies:

```bash
pixi shell
```

A `pre-commit` job is set up on CI to enforce consistent styles. It is advisable
to set it up locally as well using [pipx](https://pypa.github.io/pipx/) for
isolation:

```bash
# Run before committing
pipx run pre-commit run --all-files
# Or install the git hook to enforce this
pipx run pre-commit install
```

If you find that `pre-commit` for R is flaky, you can consider the following commands:

```bash
find . \( -path "./.pixi" -o -path "./renv" \) -prune -o -type f -name "*.R" -exec Rscript -e 'library(styler); style_file("{}")' \;
Rscript -e 'library(lintr); lintr::lint_package(".")'
```

#### Tests

Tests and checks are run on the CI, however locally one can use:

```bash
Rscript -e 'devtools::test()'
```


#### Documentation

Ideally each change should be documented. Major changes should be `vignettes`,
and minor ones can be added to `newsfragments`.

Benchmark vignettes are pre-computed via:

```bash
Rscript rebuild-benchmarks.R
```

Which makes it faster to build the package and run checks.
Similarly, we support writing and reading from other `R` objects (e.g. standard
R vectors and matrices), as seen in the [basic use
vignette](https://haozeke.github.io/fastMatMR/articles/basic_usage.html).

## License

Expand Down
61 changes: 8 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ devtools::install_github("HaoZeke/fastMatMR")

``` r
library(fastMatMR)
Matrix::Matrix(c(1, 0, 3, 2), nrow = 2, sparse = TRUE) -> spmat
write_fmm(vec, "vector.mtx")
spmat <- Matrix::Matrix(c(1, 0, 3, 2), nrow = 2, sparse = TRUE)
write_fmm(spmat, "sparse.mtx")
```

To see what this does, consider reading it back in `python`:
Expand All @@ -55,59 +55,14 @@ To see what this does, consider reading it back in `python`:
pip install fast_matrix_market
python -c 'import fast_matrix_market as fmm; print(fmm.read_array_or_coo("sparse.mtx"))'
((array([1., 3., 2.]), (array([0, 0, 1], dtype=int32), array([0, 1, 1], dtype=int32))), (2, 2))
python -c 'import fast_matrix_market as fmm; print(fmm.read_array("sparse.mtx"))'
array([[1., 3.],
[0., 2.]])
```

Similarly, we support writing and reading from other `R` objects.

## Development

### Local Development

Often it is useful to have `pixi` handle the dependencies:

``` bash
pixi shell
```

A `pre-commit` job is set up on CI to enforce consistent styles. It is
advisable to set it up locally as well using
[pipx](https://pypa.github.io/pipx/) for isolation:

``` bash
# Run before committing
pipx run pre-commit run --all-files
# Or install the git hook to enforce this
pipx run pre-commit install
```

If you find that `pre-commit` for R is flaky, you can consider the
following commands:

``` bash
find . \( -path "./.pixi" -o -path "./renv" \) -prune -o -type f -name "*.R" -exec Rscript -e 'library(styler); style_file("{}")' \;
Rscript -e 'library(lintr); lintr::lint_package(".")'
```

#### Tests

Tests and checks are run on the CI, however locally one can use:

``` bash
Rscript -e 'devtools::test()'
```

#### Documentation

Ideally each change should be documented. Major changes should be
`vignettes`, and minor ones can be added to `newsfragments`.

Benchmark vignettes are pre-computed via:

``` bash
Rscript rebuild-benchmarks.R
```

Which makes it faster to build the package and run checks.
Similarly, we support writing and reading from other `R` objects
(e.g. standard R vectors and matrices), as seen in the [basic use
vignette](https://haozeke.github.io/fastMatMR/articles/basic_usage.html).

## License

Expand Down
Loading