-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add pyproject.toml support (#99) Co-authored-by: kasium <15907922+kasium@users.noreply.github.com>
- Loading branch information
Showing
17 changed files
with
327 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,3 +70,7 @@ docs/_build | |
.python-version | ||
|
||
pip-wheel-metadata | ||
|
||
# vscode | ||
.vscode/ | ||
.history/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ Contents | |
usage | ||
contract_types | ||
custom_contract_types | ||
toml | ||
contributing | ||
authors | ||
changelog | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
TOML support | ||
------------ | ||
|
||
While all the examples are in INI format, Import Linter also supports TOML. | ||
|
||
The TOML configuration is very similar to the others with a few differences: | ||
|
||
- the sections must start with ``tool.`` | ||
- contracts are defined by ``[[tool.importlinter.contracts]]`` | ||
|
||
The basic configuration layout looks like: | ||
|
||
.. code-block:: toml | ||
[tool.importlinter] | ||
root_package = mypackage | ||
[[tool.importlinter.contracts]] | ||
name = Contract One | ||
[[tool.importlinter.contracts]] | ||
name = Contract Two | ||
Following, an example with a layered configuration: | ||
|
||
.. code-block:: toml | ||
[tool.importlinter] | ||
root_packages = [ | ||
"high", | ||
"medium", | ||
"low", | ||
] | ||
[[tool.importlinter.contracts]] | ||
name = "My three-tier layers contract (multiple root packages)" | ||
type = "layers" | ||
layers = [ | ||
"high", | ||
"medium", | ||
"low", | ||
] | ||
Please note, that in order to use TOML files, you need to install the extra require ``toml``:: | ||
|
||
pip install import-linter[toml] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[pytest] | ||
markers = | ||
toml_not_installed: marks tests as only to be run if toml is not installed | ||
toml_installed: marks tests as only to be run if toml is installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[tool.importlinter] | ||
root_package = "testpackage" | ||
contract_types = [ | ||
"forbidden_import: tests.helpers.contracts.ForbiddenImportContract" | ||
] | ||
|
||
|
||
[[tool.importlinter.contracts]] | ||
name = "Custom kept contract" | ||
type = "forbidden_import" | ||
importer = "testpackage.utils" | ||
imported = "testpackage.low" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.