Skip to content

Commit

Permalink
add pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
erexer committed Oct 15, 2024
1 parent 7fda6f7 commit b1aee89
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 21 deletions.
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# pre-commit hooks require a user to have installed `pre-commit`:
# $ pip install pre-commit
# Then install the hooks within the repo:
# $ cd /PATH/TO/REPO
# $ pre-commit install

repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix]
exclude: .rst
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
args: [--line-length=100]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-ast
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
36 changes: 21 additions & 15 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,19 @@ ______________________________________

1. I found a bug!

* Check if the bug has already been reported by searching the existing GitHub
`Issues <https://github.com/IMMM-SFA/tell/issues>`_. If you find a match, consider adding additional details to the
existing ticket.
* Check if the bug has already been reported by searching the existing GitHub `Issues <https://github.com/IMMM-SFA/tell/issues>`_. If you find a match, consider adding additional details to the existing ticket.

* Open a `new Issue <https://github.com/IMMM-SFA/tell/issues/new/choose>`_, being sure to include a clear title and
description along with as much detail as possible; code samples or log messages demonstrating the bug are quite helpful.
* Open a `new Issue <https://github.com/IMMM-SFA/tell/issues/new/choose>`_, being sure to include a clear title and description along with as much detail as possible; code samples or log messages demonstrating the bug are quite helpful.

2. I fixed a bug!

* Open a `new Pull Request <https://github.com/IMMM-SFA/tell/compare>`_ with the fix. Ensure the description clearly
outlines the bug and the solution. Include the Issue number if applicable.
* Open a `new Pull Request <https://github.com/IMMM-SFA/tell/compare>`_ with the fix. Ensure the description clearly outlines the bug and the solution. Include the Issue number if applicable.

3. I created a new feature!

* Consider opening a `new Issue <https://github.com/IMMM-SFA/tell/issues/new/choose>`_ to describe use cases for the
new feature. This will offer a platform for discussion and critique.
* Consider opening a `new Issue <https://github.com/IMMM-SFA/tell/issues/new/choose>`_ to describe use cases for the new feature. This will offer a platform for discussion and critique.

* Then, open a `new Pull Request <https://github.com/IMMM-SFA/tell/compare>`_ with clear documentation of the
methodology. Be sure to include new unit tests if appropriate.
* Then, open a `new Pull Request <https://github.com/IMMM-SFA/tell/compare>`_ with clear documentation of the methodology. Be sure to include new unit tests if appropriate.


Contribution workflow (pull request)
Expand All @@ -48,7 +42,15 @@ The following is the recommended workflow for contributing to **tell**:
git clone https://github.com/<your-user-name>/tell
2. Create a branch for your changes
2. Install **tell** in development mode and set up `pre-commit`.

.. code-block:: bash
pip install -e ".[dev]"
pre-commit install
3. Create a branch for your changes

.. code-block:: bash
Expand All @@ -58,19 +60,23 @@ The following is the recommended workflow for contributing to **tell**:
git checkout -b feature/some-feature
3. Add your recommended changes and ensure all tests pass, then commit your changes
1. Add your recommended changes and ensure all tests pass, then commit your changes

.. code-block:: bash
git commit -m '<my short message>'
git commit -m "<my short message>""
4. Push your changes to the remote
.. code-block:: bash
git push origin <my-branch-name>
5. Submit a pull request with the following information:
- **Purpose**: The reason for your pull request in short
- **Summary**: A description of the environment you are using (OS, Python version, etc.), logic, any caveats, and a summary of changes that were made.
- **Summary**: A description of the environment you are using (OS, Python version, etc.), logic, any caveats, and a summary of changes that were made.
-
15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ classifiers = [
]

[project.optional-dependencies]
test = [
"pytest>=6.2.4",
"pytest-cov>=2.12.1"
deploy = [
"twine>=3.4.1",
]
dev = [
"pre-commit>=4.0.1",
]
docs = [
"build>=0.5.1",
Expand All @@ -84,8 +86,9 @@ docs = [
"sphinx-design>=0.6.1",
"sphinx-rtd-theme>=2.0.0",
]
deploy = [
"twine>=3.4.1",
test = [
"pytest>=6.2.4",
"pytest-cov>=2.12.1",
]

[project.urls]
Expand All @@ -94,4 +97,4 @@ Documentation = "https://immm-sfa.github.io/tell"

[tool.hatch.build]
packages = ["tell"] # set importable package name to "tell"
include = ["tell"]
include = ["tell"]

0 comments on commit b1aee89

Please sign in to comment.