diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..df51270 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst index 9146c72..bb1705a 100644 --- a/docs/source/contributing.rst +++ b/docs/source/contributing.rst @@ -15,25 +15,19 @@ ______________________________________ 1. I found a bug! - * Check if the bug has already been reported by searching the existing GitHub -`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 `_. If you find a match, consider adding additional details to the existing ticket. - * Open a `new Issue `_, 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 `_, 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 `_ with the fix. Ensure the description clearly -outlines the bug and the solution. Include the Issue number if applicable. + * Open a `new Pull Request `_ 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 `_ to describe use cases for the -new feature. This will offer a platform for discussion and critique. + * Consider opening a `new Issue `_ to describe use cases for the new feature. This will offer a platform for discussion and critique. - * Then, open a `new Pull Request `_ with clear documentation of the -methodology. Be sure to include new unit tests if appropriate. + * Then, open a `new Pull Request `_ with clear documentation of the methodology. Be sure to include new unit tests if appropriate. Contribution workflow (pull request) @@ -48,7 +42,15 @@ The following is the recommended workflow for contributing to **tell**: git clone https://github.com//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 @@ -58,11 +60,13 @@ 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 '' + git commit -m """ + 4. Push your changes to the remote @@ -70,7 +74,9 @@ The following is the recommended workflow for contributing to **tell**: git push origin + 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. \ No newline at end of file + - **Summary**: A description of the environment you are using (OS, Python version, etc.), logic, any caveats, and a summary of changes that were made. + - diff --git a/pyproject.toml b/pyproject.toml index f0c6a1b..a27bcb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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] @@ -94,4 +97,4 @@ Documentation = "https://immm-sfa.github.io/tell" [tool.hatch.build] packages = ["tell"] # set importable package name to "tell" -include = ["tell"] \ No newline at end of file +include = ["tell"]