diff --git a/CHANGELOG.md b/CHANGELOG.md index b8709dca5e386453f1b0497a6c49b6259d8047d7..7ed6663a2292bf9072a9f8dcb099ad55e67b11a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v2.1 + +* added read_dependency_links + # v2.0 * got rid of the Mako dependency diff --git a/docs/utilities.rst b/docs/utilities.rst index df44886a4b1d6fd6a403ef24e2936fa4762e8776..986e87586ee77d27f4f5bbaf17e8d48dd72b2a15 100644 --- a/docs/utilities.rst +++ b/docs/utilities.rst @@ -29,9 +29,12 @@ Then you can write the following in your setup.py: .. code-block:: python - from snakehouse import read_requirements_txt + from snakehouse import read_requirements_txt, read_dependency_links - setup(install_requires=read_requirements_txt()) + setup(install_requires=read_requirements_txt(), + dependency_links=read_dependency_links()) .. autofunction:: snakehouse.read_requirements_txt + + diff --git a/setup.cfg b/setup.cfg index c8e295566dc772f2aa14d052ba00ababa151f452..d4c0e538e288f1ecbda3c1a4a49dd9120fbf7442 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ [metadata] name = snakehouse keywords = cython, extension, multiple, pyx -version = 2.0 +version = 2.1 long_description = file: README.md long_description_content_type = text/markdown; charset=UTF-8 license_files = LICENSE diff --git a/snakehouse/requirements.py b/snakehouse/requirements.py index dd317fd23e80f9911212a3f6c584cd4223cbd1f3..05a80490d8eeeea9e09b4aeca352bc66c850b2bc 100644 --- a/snakehouse/requirements.py +++ b/snakehouse/requirements.py @@ -58,8 +58,16 @@ def read_requirements_txt(path: str = 'requirements.txt'): lines = (line for line in lines if not line.startswith('git+')) lines = (line for line in lines if not line.startswith('http')) lines = (line for line in lines if line) + lines = (line for line in lines if not line.startwith('--')) return list(lines) + +def read_dependency_links(path: str = 'requirements.txt'): + lines = read_lines(path) + lines = (line for line in lines if line.startwith('--extra')) + return list(lines) + + def read_lines(path: str, delete_empty_lines: bool = True, encoding: str = 'utf-8') -> tp.List[str]: """