From ca259d05e965004241bf8a16afd5c1f8576ab28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Wed, 18 Sep 2024 20:05:17 +0200 Subject: [PATCH] 2.1 --- CHANGELOG.md | 4 ++++ docs/utilities.rst | 7 +++++-- setup.cfg | 2 +- snakehouse/requirements.py | 8 ++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8709dc..7ed6663 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 df44886..986e875 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 c8e2955..d4c0e53 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 dd317fd..05a8049 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]: """ -- GitLab