Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --strip-extras feature to wrap pip-compile flag #455

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']
Loading