Skip to content

Commit

Permalink
Update dev packages, lint files (#139)
Browse files Browse the repository at this point in the history
* Update dev packages, lint files

* Remove some pre-commit checks
  • Loading branch information
tayden authored Feb 7, 2025
1 parent c144031 commit 3ec43de
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 102 deletions.
18 changes: 10 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
exclude: ^.*\.lock$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-merge-conflict
- id: debug-statements
- id: mixed-line-ending
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
hooks:
- id: poetry-check
- id: poetry-lock
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
rev: v0.9.4
hooks:
- id: ruff
args: [ '--fix', '--select', 'I']
types_or: [ python, pyi ]
args: [ --fix ]
- id: ruff-format
types_or: [ python, pyi ]
1 change: 0 additions & 1 deletion conda/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ about:
extra:
recipe-maintainers:
- tayden

24 changes: 12 additions & 12 deletions docs/beginner_guide/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ It is typical of many CLI tools to also have a `--help` option that can be used
To get help documentation for the `kom` tool, you can type `kom --help` into your terminal.

??? tip "Shorthand flags"
You can also use the shorthand flags `-h` to get help, e.g. `kom -h`. This is common for many CLI tools.
You can also use the shorthand flags `-h` to get help, e.g. `kom -h`. This is common for many CLI tools.
Options will be shown in the help documentation with both the long form (`--help`) and the shorthand form (`-h`).

```console
Expand All @@ -35,12 +35,12 @@ This will show you a list of the subcommands available to you, as well as a brie
### Processing an Image

??? note "A note on mussel detection"
The Kelp-O-Matic tool is designed to detect both kelp and mussels. The following information was written for kelp
detection, but the same information applies for mussels. All you have to do to find mussels instead of kelp is use
The Kelp-O-Matic tool is designed to detect both kelp and mussels. The following information was written for kelp
detection, but the same information applies for mussels. All you have to do to find mussels instead of kelp is use
the `kom find-mussels` subcommand instead of `kom find-kelp` in the following steps.

#### Subcommands and Options
To process an image, you will need to use the `kom find-kelp` subcommand. This subcommand is used to detect kelp in an
To process an image, you will need to use the `kom find-kelp` subcommand. This subcommand is used to detect kelp in an
image. Like we did for `kom`, we can also get help for subcommands:

```console
Expand Down Expand Up @@ -82,31 +82,31 @@ The various options available to you are detailed in the `--help` documentation.
The options are flags that can be used to enable or disable certain features of the tool, or they can take arguments to customize the behavior of the tool.

!!! example "An Example Command"

=== "Windows"

```console
kom find-kelp --species --crop-size 2048 .\some\image_with_kelp.tif .\some\output.tif
```

In this example, we are running the `find-kelp` subcommand with the `--species` option and a
`--crop-size` of 2048. The input image is located at `.\some\image_with_kelp.tif`.
In this example, we are running the `find-kelp` subcommand with the `--species` option and a
`--crop-size` of 2048. The input image is located at `.\some\image_with_kelp.tif`.
The output will be saved to `.\some\output.tif`.

=== "MacOS/Linux"

```console
kom find-kelp --species --crop-size 2048 ./some/image_with_kelp.tif ./some/output.tif
```

In this example, we are running the `find-kelp` subcommand with the `--species` option and a
`--crop-size` of 2048. The input image is located at `./some/image_with_kelp.tif`.
In this example, we are running the `find-kelp` subcommand with the `--species` option and a
`--crop-size` of 2048. The input image is located at `./some/image_with_kelp.tif`.
The output will be saved to `./some/output.tif`.

##### Executing the Command
Once you have constructed your command, execute it by pressing ++enter++.
Once you have constructed your command, execute it by pressing ++enter++.

Wait for the progress bar to reach 100%, then open the results in an image processing or spatial analysis software such as QGIS or ArcGIS.
Wait for the progress bar to reach 100%, then open the results in an image processing or spatial analysis software such as QGIS or ArcGIS.
Review the results for errors and edit as needed.

**Part 3 Kelp Segmentation is now complete!**
Expand Down
2 changes: 1 addition & 1 deletion docs/beginner_guide/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Beginner Guide

This document outlines step-by-step how to execute the Kelp-O-Matic tool for those with little to no experience with
This document outlines step-by-step how to execute the Kelp-O-Matic tool for those with little to no experience with
executing commands from the Terminal or Command Line.

1. [Terminal Crash Course](./terminal_crash_course.md)
Expand Down
18 changes: 9 additions & 9 deletions docs/beginner_guide/install_env_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ guide.

??? question "Why UV"

`uv` is a Python environment manager that is easy to use and works on Windows, MacOS, and Linux.
It is a good choice for beginners and experienced users alike. It's extremely fast and lightweight, and provides a
`uv` is a Python environment manager that is easy to use and works on Windows, MacOS, and Linux.
It is a good choice for beginners and experienced users alike. It's extremely fast and lightweight, and provides a
simple way to manage Python environments and install packages.

## UV Virtual Environment Setup
Expand All @@ -26,8 +26,8 @@ guide.

??? question "What's a Virtual Environment"

A virtual environment is a self-contained directory that contains a Python installation for a particular version
of Python, plus a number of additional packages. It allows you to work on a specific project without affecting
A virtual environment is a self-contained directory that contains a Python installation for a particular version
of Python, plus a number of additional packages. It allows you to work on a specific project without affecting
other projects or the system Python installation.

It's a good practice to create a new virtual environment for each project you work on. This way, you can install the
Expand Down Expand Up @@ -58,7 +58,7 @@ active.
## Install Kelp-O-Matic
Now that you have your virtual environment set up, you can install Kelp-O-Matic and its dependencies very easily with
Now that you have your virtual environment set up, you can install Kelp-O-Matic and its dependencies very easily with
`uv`.
1. Install Kelp-O-Matic using the following command:
Expand All @@ -68,15 +68,15 @@ Now that you have your virtual environment set up, you can install Kelp-O-Matic
!!! important
The `kom` command will be available only when the virtual environment is activated. If you close your terminal,
The `kom` command will be available only when the virtual environment is activated. If you close your terminal,
be sure to navigate to the location where you created the virtual environment and activate it again before running
`kom`.
??? question "What's `uv pip`?"
`uv` has a built-in package manager called `pip` that you can use to install Python packages. When not using `uv`,
`uv` has a built-in package manager called `pip` that you can use to install Python packages. When not using `uv`,
Python comes with a package manager called `pip`. `uv pip` is just a faster version of that default package manager.
## Next Steps
You're now ready to process some imagery, hooray! Head over to the next section,
[Running the Segmentation tool](./execution.md), to learn how to run the segmentation tool
You're now ready to process some imagery, hooray! Head over to the next section,
[Running the Segmentation tool](./execution.md), to learn how to run the segmentation tool
20 changes: 10 additions & 10 deletions docs/beginner_guide/terminal_crash_course.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ depending on your operating system, so choose the tab below based on which is re
application that appears.

=== "MacOS/Linux"
On MacOS and Linux, the default terminal is called Terminal. To open Terminal, search for "Terminal" in the search bar
On MacOS and Linux, the default terminal is called Terminal. To open Terminal, search for "Terminal" in the search bar
and click on the application that appears.

### Nagivating around
Expand All @@ -43,7 +43,7 @@ depending on your operating system, so choose the tab below based on which is re
| ------- | ----------- |
| `cd [some path]` | Change directory |
| `ls [some path]` | List files and folders in the current directory |


#### Specifying Paths

Expand All @@ -52,7 +52,7 @@ depending on your operating system, so choose the tab below based on which is re
- Using `..` is interpreted as "the parent directory" of my current location.
- Using `.` is interpreted as "the current directory".
- Using `~` is interpreted as the user's home directory. (e.g. `C:\Users\McLovin`, if that is your username)
- You can use relative paths to navigate to folders in relation to your current location, like ` cd .\Documents`
- You can use relative paths to navigate to folders in relation to your current location, like ` cd .\Documents`
- You can also use absolute paths to navigate, like `cd C:\Users\McLovin\Documents`.
- Use ++tab++ to autocomplete file and folder names. It is **very strongly** recommended to use this to avoid typos and save time typing long paths.
- e.g. `cd C:\Users\McLovin\Docu` then press ++tab++ to autocomplete to `cd C:\Users\McLovin\Documents`. Pressing ++tab++ again will cycle through all possible completions.
Expand All @@ -62,7 +62,7 @@ depending on your operating system, so choose the tab below based on which is re
- Using `..` is interpreted as "the parent directory" of my current location.
- Using `.` is interpreted as "the current directory".
- Using `~` is interpreted as the user's home directory. (e.g. `/home/mclovin`, if that is your username)
- You can use relative paths to navigate to folders in relation to your current location, like ` cd ./documents`
- You can use relative paths to navigate to folders in relation to your current location, like ` cd ./documents`
- You can also use absolute paths to navigate, like `cd /home/mclovin/documents`. Absolute paths start from the root directory `/`.
- Use ++tab++ to autocomplete file and folder names. It is **very strongly** recommended to use this to avoid typos and save time typing long paths.
- e.g. `cd /home/mclovin/docu` then press ++tab++ to autocomplete to `cd /home/mclovin/documents`. Pressing ++tab++ again will cycle through all possible completions.
Expand Down Expand Up @@ -101,15 +101,15 @@ depending on your operating system, so choose the tab below based on which is re
| `cd /home/mclovin/documents` | Move to a folder called `documents` inside the `mclovin` home directory |

!!! warning "Spaces in Paths"
If a folder or file name has a space in it, you need to enclose the path in quotes.
For example, if you have a folder called `My Documents`, you would need to use `cd "My Documents"`.
It's a good idea to avoid spaces in folder and file names to make your life easier. Many people use
If a folder or file name has a space in it, you need to enclose the path in quotes.
For example, if you have a folder called `My Documents`, you would need to use `cd "My Documents"`.
It's a good idea to avoid spaces in folder and file names to make your life easier. Many people use
underscores `_` or hyphens `-` instead of spaces.


You did it! You now know enough to navigate around the terminal. There are many commands you can use
in the terminal, but these are the most important ones to get you started. You're now going to copy and paste some
commands to set up the Kelp-O-Matic tool, detailed in the next section. This is going to add a new command to your
You did it! You now know enough to navigate around the terminal. There are many commands you can use
in the terminal, but these are the most important ones to get you started. You're now going to copy and paste some
commands to set up the Kelp-O-Matic tool, detailed in the next section. This is going to add a new command to your
terminal that you can use to run the Kelp-O-Matic tool.

### Next Steps
Expand Down
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

## Getting Started

Please see the [beginner guide](beginner_guide/index.md) if you are new to using command line tools. Otherwise, see the
Please see the [beginner guide](beginner_guide/index.md) if you are new to using command line tools. Otherwise, see the
[installation](installation.md) and the [CLI](cli.md) or [Python API](python_lib.md) documentation.

## Features
Expand All @@ -38,15 +38,15 @@ Please see the [beginner guide](beginner_guide/index.md) if you are new to using

## Contribute

Please file a bug report using our
[GitHub Issue Tracker :material-github:](https://github.com/HakaiInstitute/kelp-o-matic/issues) if you encounter any
Please file a bug report using our
[GitHub Issue Tracker :material-github:](https://github.com/HakaiInstitute/kelp-o-matic/issues) if you encounter any
problems.

Comments and questions are also appreciated!

## License

Kelp-O-Matic is released under the
Kelp-O-Matic is released under the
[MIT license](https://raw.githubusercontent.com/tayden/kelp-o-matic/main/LICENSE.txt).

## Contact
Expand Down
4 changes: 3 additions & 1 deletion kelp_o_matic/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
find_mussels as find_mussels_,
)

cli = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]}, add_completion=False)
cli = typer.Typer(
context_settings={"help_option_names": ["-h", "--help"]}, add_completion=False
)


@cli.command()
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ kom = "kelp_o_matic.cli:cli"

[dependency-groups]
dev = [
"pre-commit>=3.3.3",
"ruff>=0.0.272",
"pytest>=7.3.2",
"pre-commit>=4.1.0",
"ruff>=0.9.5",
"pytest>=8.3.4",
]
docs = [
"mkdocs>=1.5.3,<2",
"mkdocs-material>=9.5.2,<10",
"mkdocstrings-python>=1.7.5,<2",
"mkdocs>=1.6.1,<2",
"mkdocs-material>=9.6.3,<10",
"mkdocstrings-python>=1.14.6,<2",
]

[tool.uv]
Expand Down
Loading

0 comments on commit 3ec43de

Please sign in to comment.