Skip to content

Commit

Permalink
Merge pull request #455 from vergenzt/add-strip-extras
Browse files Browse the repository at this point in the history
Add --strip-extras feature to wrap pip-compile flag
  • Loading branch information
peterdemin authored Jun 6, 2024
2 parents 4356675 + 909d92a commit d96d6c7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Features

.. automodule:: pipcompilemulti.features.skip_constraint_comments

.. automodule:: pipcompilemulti.features.strip_extras

.. automodule:: pipcompilemulti.features.live_output

.. automodule:: pipcompilemulti.verify
4 changes: 4 additions & 0 deletions pipcompilemulti/features/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .limit_in_paths import LimitInPaths
from .live_output import LiveOutput
from .skip_constraint_comments import SkipConstraintComments
from .strip_extras import StripExtras
from .unsafe import AllowUnsafe
from .upgrade import UpgradeAll, UpgradeSelected
from .use_cache import UseCache
Expand Down Expand Up @@ -47,6 +48,7 @@ def __init__(self):
self.live_output = LiveOutput()
self.output_extension = OutputExtension()
self.skip_constraint_comments = SkipConstraintComments()
self.strip_extras = StripExtras()
self.upgrade_all = UpgradeAll(self)
self.upgrade_selected = UpgradeSelected(self)
self.use_cache = UseCache()
Expand All @@ -69,6 +71,7 @@ def __init__(self):
self.live_output,
self.output_extension,
self.skip_constraint_comments,
self.strip_extras,
self.upgrade_all,
self.upgrade_selected,
self.use_cache,
Expand Down Expand Up @@ -100,6 +103,7 @@ def pin_options(self, in_path):
options.extend(self.upgrade_all.pin_options())
options.extend(self.upgrade_selected.pin_options())
options.extend(self.use_cache.pin_options())
options.extend(self.strip_extras.pin_options())
return options

def compose_input_file_path(self, basename):
Expand Down
26 changes: 26 additions & 0 deletions pipcompilemulti/features/strip_extras.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
Strip extras
============
Instructs ``pip-compile`` to attempt to omit extras in transient dependencies,
while assuring the constraints compatibility.
.. code-block:: text
--strip-extras Try avoiding use of extras.
"""
from .base import ClickOption
from .forward import ForwardOption


class StripExtras(ForwardOption):
"""Attempt to drop extras"""

OPTION_NAME = 'strip_extras'
CLICK_OPTION = ClickOption(
long_option='--strip-extras',
is_flag=True,
default=False,
help_text='Try avoiding use of extras.'
)
enabled_pin_options = ['--strip-extras']

0 comments on commit d96d6c7

Please sign in to comment.