Skip to content

Commit

Permalink
Merge pull request #595 from GitGuardian/agateau/make-hmsl-optional
Browse files Browse the repository at this point in the history
Make HMSL optional
  • Loading branch information
agateau-gg authored Jun 28, 2023
2 parents 7040795 + eeca9e3 commit 80e013d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ repos:
stages: [push]

- repo: https://github.com/gitguardian/ggshield
rev: v1.16.0
rev: v1.17.1
hooks:
- id: ggshield
language_version: python3
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ verify_ssl = true

[packages]
# Do not add dependencies here, but list them in the setup.py instead
ggshield = { editable = true, path = "." }
ggshield = { editable = true, extras = ["all"], path = "." }

[dev-packages]
black = "==22.3.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- Fixed ggshield not installing properly when installing with Brew on macOS.
15 changes: 13 additions & 2 deletions ggshield/cmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
from ggshield.cmd.common_options import add_common_options
from ggshield.cmd.config import config_group
from ggshield.cmd.debug_logs import disable_logs, setup_debug_logs
from ggshield.cmd.hmsl import hmsl_group


try:
from ggshield.cmd.hmsl import hmsl_group
except ImportError:
hmsl_group = None

from ggshield.cmd.honeytoken import honeytoken_group
from ggshield.cmd.iac import iac_group
from ggshield.cmd.install import install_cmd
Expand Down Expand Up @@ -57,6 +63,11 @@ def config_path_callback(
return value


extra_groups = {}
if hmsl_group:
extra_groups["hmsl"] = hmsl_group


@click.group(
context_settings={"help_option_names": ["-h", "--help"]},
commands={
Expand All @@ -68,7 +79,7 @@ def config_path_callback(
"api-status": status_cmd,
"iac": iac_group,
"honeytoken": honeytoken_group,
"hmsl": hmsl_group,
**extra_groups,
},
)
@click.option(
Expand Down
12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ def get_version() -> str:
return VERSION_RE.search(init).group(1) # type: ignore


extras_require = {
"hmsl": [
"cryptography>=41.0.0,<42.0.0",
]
}
extras_require["all"] = list(
{value for values in extras_require.values() for value in values}
)


setup(
name="ggshield",
version=get_version(),
Expand All @@ -36,7 +46,6 @@ def get_version() -> str:
"appdirs>=1.4.4,<1.5.0",
"charset-normalizer>=3.1.0,<3.2.0",
"click>=8.1,<8.2",
"cryptography>=41.0.0,<42.0.0",
"marshmallow>=3.18.0,<3.19.0",
"marshmallow-dataclass>=8.5.8,<8.6.0",
"oauthlib>=3.2.1,<3.3.0",
Expand All @@ -47,6 +56,7 @@ def get_version() -> str:
"requests>=2.31.0,<2.32.0",
"rich>=12.5.1,<12.6.0",
],
extras_require=extras_require,
include_package_data=True,
zip_safe=True,
license="MIT",
Expand Down

0 comments on commit 80e013d

Please sign in to comment.