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 option to pip-compile for producing constraint compatible output #1404

Merged
merged 1 commit into from
Jun 11, 2021

Conversation

ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented May 27, 2021

Changelog-friendly one-liner: Add an option for producing constraint-compatible output

Contributor checklist
  • Provided the tests for the changes.
  • Gave a clear one-line description in the PR (that the maintainers can add to CHANGELOG.md on release).
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

Fixes: #1300

@ssbarnea ssbarnea added this to the 6.2.0 milestone May 27, 2021
piptools/writer.py Outdated Show resolved Hide resolved
piptools/writer.py Outdated Show resolved Hide resolved
piptools/writer.py Outdated Show resolved Hide resolved
@nicoa nicoa modified the milestones: 6.2.0, 6.1.1 Jun 4, 2021
@ssbarnea ssbarnea marked this pull request as ready for review June 9, 2021 16:17
@ssbarnea ssbarnea force-pushed the fix/1300 branch 2 times, most recently from b5b5c18 to e0b8a71 Compare June 10, 2021 12:50
@codecov

This comment has been minimized.

tests/test_cli_compile.py Outdated Show resolved Hide resolved
piptools/scripts/compile.py Show resolved Hide resolved
if install_requires is None:
install_requires = []

if extras_require is None:
extras_require = dict()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it's best to use a literal

Suggested change
extras_require = dict()
extras_require = {}

@ssbarnea ssbarnea merged commit f031f69 into jazzband:master Jun 11, 2021
@ssbarnea ssbarnea deleted the fix/1300 branch June 11, 2021 13:47
@atugushev atugushev changed the title Add option for producing constraint compatible output Add --strip-extras option to pip-compile for producing constraint compatible output Jun 21, 2021
@anotinelg
Copy link

h @atugushev

I have noticed that when i use pip-compile to create a requirements.txt from a requirements.in for some package it adds sometimes an extra part on the line like

s3fs==0.4.2; extra == "myextra"
    # via mypackage

I try to use the pip-compile with the --strip-extras, but i still have this extra part.
Questions:

  • In what case, does pip-compile add some extra
  • Is the stip-extra parameter not supposed to remove all extras part?

my requirements.in looks like

-e .[myextra]

and the package myextra has a setup.py which specifies the extra like the following:

# -*- coding: utf-8 -*-
from setuptools import setup

# Declare minimal set for installation
required_packages = []

extras = {
}

extras["myextra"] = [
        "opencv_python == 4.1.2.30",
        "sklearn",
        "s3fs==0.4.2",
        "joblib",
        "mxnet==1.7.0.post1",
         "pandas", "findspark", "joblib"
    ]

setup(use_scm_version=True, install_requires=required_packages, extras_require=extras)


the command i used to create the requirements.txt is:

pip-compile requirements.in --output-file  requirements.txt

i am running pip-compile v6.3.0, and pip version v12.2.2.

many thanks for your help!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Producing constraints.txt files
6 participants