diff --git a/.coveragerc b/.coveragerc index a120715..9da615c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,4 +3,4 @@ fail_under = 97 [run] branch = true -omit=*dist-packages*,*site-packages*,gitlint/tests/*,.venv/*,*virtualenv* +omit=*dist-packages*,*site-packages*,gitlint-core/gitlint/tests/*,.venv/*,*virtualenv* diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8fbda21..1ca2a9c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -109,13 +109,13 @@ jobs: run: gitlint --version - name: Tests (sanity) - run: tools\windows\run_tests.bat "gitlint\tests\cli\test_cli.py::CLITests::test_lint" + run: tools\windows\run_tests.bat "gitlint-core\gitlint\tests\cli\test_cli.py::CLITests::test_lint" - name: Tests (ignore cli\*) - run: pytest --ignore gitlint\tests\cli -rw -s gitlint + run: pytest --ignore gitlint-core\gitlint\tests\cli -rw -s gitlint-core - name: Tests (test_cli.py only - continue-on-error:true) - run: tools\windows\run_tests.bat "gitlint\tests\cli\test_cli.py" + run: tools\windows\run_tests.bat "gitlint-core\gitlint\tests\cli\test_cli.py" continue-on-error: true # Known to fail at this point - name: Tests (all - continue-on-error:true) @@ -127,10 +127,10 @@ jobs: continue-on-error: true # Known to fail at this point - name: PEP8 - run: flake8 gitlint qa examples + run: flake8 gitlint-core qa examples - name: PyLint - run: pylint gitlint qa --rcfile=".pylintrc" -r n + run: pylint gitlint-core\gitlint qa --rcfile=".pylintrc" -r n # Re-add git version control so we can run gitlint on itself. - name: Re-add git version control to code diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 4b15bfd..f2ccc7f 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,6 +1,7 @@ - id: gitlint name: gitlint language: python + additional_dependencies: ["./gitlint-core[trusted-deps]"] entry: gitlint args: [--staged, --msg-filename] stages: [commit-msg] diff --git a/CHANGELOG.md b/CHANGELOG.md index dd224e3..2546579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog # +## v0.17.0 (2021-11-28) ## +Contributors: +Special thanks to all contributors for this release, in particular [andersk](https://github.com/andersk) and [sigmavirus24](https://github.com/sigmavirus24). + +- Gitlint is now split in 2 packages: `gitlint` and `gitlint-core`. This allows users to install gitlint without pinned dependencies (which is the default) ([#162](https://github.com/jorisroovers/gitlint/issues/162)) +- Under-the-hood: dependencies updated ## v0.16.0 (2021-10-08) ## Contributors: diff --git a/MANIFEST.in b/MANIFEST.in index 51a5598..ad3da8a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,5 +3,5 @@ include LICENSE exclude Vagrantfile exclude *.yml *.sh *.txt recursive-exclude examples * -recursive-exclude gitlint/tests * -recursive-exclude qa * \ No newline at end of file +recursive-exclude gitlint-core * +recursive-exclude qa * diff --git a/doc-requirements.txt b/doc-requirements.txt index becd4f4..33ce51e 100644 --- a/doc-requirements.txt +++ b/doc-requirements.txt @@ -1 +1 @@ -mkdocs==1.2.2 \ No newline at end of file +mkdocs==1.2.3 \ No newline at end of file diff --git a/docs/configuration.md b/docs/configuration.md index 226ba8a..addf0c0 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -108,7 +108,7 @@ ignore-merge-commits=false # This is useful for when developers often erroneously edit certain files or git submodules. # By specifying this rule, developers can only change the file when they explicitly # reference it in the commit message. -files=gitlint/rules.py,README.md +files=gitlint-core/gitlint/rules.py,README.md [body-match-regex] # python-style regex that the commit-msg body must match. diff --git a/docs/contributing.md b/docs/contributing.md index d39f9e1..1002676 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -13,7 +13,7 @@ that's open to a lot of change and input. When contributing code, please consider all the parts that are typically required: -- [Unit tests](https://github.com/jorisroovers/gitlint/tree/main/gitlint/tests) (automatically +- [Unit tests](https://github.com/jorisroovers/gitlint/tree/main/gitlint-core/gitlint/tests) (automatically [enforced by CI](https://github.com/jorisroovers/gitlint/actions)). Please consider writing new ones for your functionality, not only updating existing ones to make the build pass. - [Integration tests](https://github.com/jorisroovers/gitlint/tree/main/qa) (also automatically @@ -118,8 +118,8 @@ Then, we suggest taking the following approach to add a Contrib rule: 1. **Write your rule as a [user-defined rule](../user_defined_rules)**. In terms of code, Contrib rules are identical to user-defined rules, they just happen to have their code sit within the gitlint codebase itself. -2. **Add your user-defined rule to gitlint**. You should put your file(s) in the [gitlint/contrib/rules](https://github.com/jorisroovers/gitlint/tree/main/gitlint/contrib/rules) directory. -3. **Write unit tests**. The gitlint codebase contains [Contrib rule test files you can copy and modify](https://github.com/jorisroovers/gitlint/tree/main/gitlint/tests/contrib/rules). +2. **Add your user-defined rule to gitlint**. You should put your file(s) in the [gitlint/contrib/rules](https://github.com/jorisroovers/gitlint/tree/main/gitlint-core/gitlint/contrib/rules) directory. +3. **Write unit tests**. The gitlint codebase contains [Contrib rule test files you can copy and modify](https://github.com/jorisroovers/gitlint/tree/main/gitlint-core/gitlint/tests/contrib/rules). 4. **Write documentation**. In particular, you should update the [gitlint/docs/contrib_rules.md](https://github.com/jorisroovers/gitlint/blob/main/docs/contrib_rules.md) file with details on your Contrib rule. 5. **Create a Pull Request**: code review typically requires a bit of back and forth. Thanks for your contribution! diff --git a/docs/index.md b/docs/index.md index 98b72de..398b4e5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -315,7 +315,7 @@ general `ignore-merge-commits`, `ignore-revert-commits`, `ignore-fixup-commits` You can configure gitlint to ignore specific commits or parts of a commit. -One way to do this, is to by [adding a gitline-ignore line to your commit message](configuration.md#commit-specific-config). +One way to do this, is by [adding a gitlint-ignore line to your commit message](configuration.md#commit-specific-config). If you have a case where you want to ignore a certain type of commits all-together, you can use gitlint's *ignore* rules. diff --git a/docs/user_defined_rules.md b/docs/user_defined_rules.md index 3b9f5e7..f58dcc7 100644 --- a/docs/user_defined_rules.md +++ b/docs/user_defined_rules.md @@ -374,7 +374,7 @@ class ReleaseConfigurationRule(ConfigurationRule): ``` For all available properties and methods on the `config` object, have a look at the -[LintConfig class](https://github.com/jorisroovers/gitlint/blob/main/gitlint/config.py). Please do not use any +[LintConfig class](https://github.com/jorisroovers/gitlint/blob/main/gitlint-core/gitlint/config.py). Please do not use any properties or methods starting with an underscore, as those are subject to change. @@ -385,7 +385,7 @@ As long as you stick with simple rules that are similar to the sample user-defin should be able to discover and execute them. While clearly you can run any python code you want in your rules, you might run into some issues if you don't follow the conventions that gitlint requires. -While the [rule finding source-code](https://github.com/jorisroovers/gitlint/blob/main/gitlint/rule_finder.py) is the +While the [rule finding source-code](https://github.com/jorisroovers/gitlint/blob/main/gitlint-core/gitlint/rule_finder.py) is the ultimate source of truth, here are some of the requirements that gitlint enforces. ### Rule class requirements diff --git a/examples/gitlint b/examples/gitlint index b722023..0261752 100644 --- a/examples/gitlint +++ b/examples/gitlint @@ -55,4 +55,4 @@ ignore-merge-commits=false # This is useful for when developers often erroneously edit certain files or git submodules. # By specifying this rule, developers can only change the file when they explicitly reference # it in the commit message. -files=gitlint/rules.py,README.md +files=gitlint-core/gitlint/rules.py,README.md diff --git a/gitlint-core/LICENSE b/gitlint-core/LICENSE new file mode 120000 index 0000000..ea5b606 --- /dev/null +++ b/gitlint-core/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/gitlint-core/MANIFEST.in b/gitlint-core/MANIFEST.in new file mode 100644 index 0000000..375cec1 --- /dev/null +++ b/gitlint-core/MANIFEST.in @@ -0,0 +1,3 @@ +include README.md +include LICENSE +recursive-exclude gitlint/tests * diff --git a/gitlint-core/README.md b/gitlint-core/README.md new file mode 120000 index 0000000..32d46ee --- /dev/null +++ b/gitlint-core/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/gitlint-core/gitlint/__init__.py b/gitlint-core/gitlint/__init__.py new file mode 100644 index 0000000..fd86b3e --- /dev/null +++ b/gitlint-core/gitlint/__init__.py @@ -0,0 +1 @@ +__version__ = "0.17.0" diff --git a/gitlint/cache.py b/gitlint-core/gitlint/cache.py similarity index 100% rename from gitlint/cache.py rename to gitlint-core/gitlint/cache.py diff --git a/gitlint/cli.py b/gitlint-core/gitlint/cli.py similarity index 100% rename from gitlint/cli.py rename to gitlint-core/gitlint/cli.py diff --git a/gitlint/config.py b/gitlint-core/gitlint/config.py similarity index 99% rename from gitlint/config.py rename to gitlint-core/gitlint/config.py index 6d2ead2..49c380a 100644 --- a/gitlint/config.py +++ b/gitlint-core/gitlint/config.py @@ -428,7 +428,7 @@ class LintConfigBuilder: f"'{config_option}' is an invalid configuration option. Use '.