diff options
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | poetry_restrict_plugin/plugin.py | 7 |
2 files changed, 14 insertions, 0 deletions
@@ -39,6 +39,13 @@ For other installation methods, see the [Poetry plugin documentation](https://python-poetry.org/docs/plugins/#using-plugins). +## Usage + +The plugin will automatically run whenever you invoke poetry. If you run into an +error with it and need an escape hatch, you can re-run your command with the +environment variable `POETRY_NO_RESTRICT=1` set. + + ## Disclaimer `poetry-restrict-plugin` is not a perfect sandbox, and probably never will be. diff --git a/poetry_restrict_plugin/plugin.py b/poetry_restrict_plugin/plugin.py index 4c59bbc..652f7a2 100644 --- a/poetry_restrict_plugin/plugin.py +++ b/poetry_restrict_plugin/plugin.py @@ -92,6 +92,13 @@ class RestrictPlugin(Plugin): ruleset.apply() def activate(self, poetry: Poetry, io: IO): + if os.getenv("POETRY_NO_RESTRICT") == "1": + io.write_line( + "<info>poetry-restrict-plugin</info>: " + "<comment>Disabled via POETRY_NO_RESTRICT environment variable!</comment>" + ) + return + try: self.landlock(poetry) io.write_line("<info>poetry-restrict-plugin</info>: Landlock engaged.") |