Skip to content

Commit 2d20677

Browse files
Make agent package optional based on installation type
1 parent a668f89 commit 2d20677

File tree

14 files changed

+16
-2
lines changed

14 files changed

+16
-2
lines changed

build.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
2+
3+
class CustomBuildHook(BuildHookInterface):
4+
def initialize(self, version, build_data):
5+
"""Add agent package if not installing core-only."""
6+
target = build_data['wheel']['targets'][0]
7+
extras = target.get('options', {}).get('extras', [])
8+
9+
if 'core' not in extras:
10+
target['packages'].append('commit0.optional.agent')

commit0/optional/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Optional packages for commit0."""
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ classifiers = [
3030

3131
[project.scripts]
3232
commit0 = "commit0.__main__:main"
33-
agent = "agent.__main__:main"
33+
agent = "commit0.optional.agent.__main__:main"
3434

3535
[tool.hatch.build.targets.wheel]
36-
packages = ["commit0", "agent"]
36+
packages = ["commit0"]
37+
38+
[tool.hatch.build.targets.wheel.hooks.custom]
39+
path = "build.py"
3740

3841
[project.optional-dependencies]
3942
core = [

0 commit comments

Comments
 (0)