From 023ce3f902ea870b76a708b2ac4f18bb09fd82a2 Mon Sep 17 00:00:00 2001 From: Chris Mackey Date: Wed, 24 Jul 2024 14:16:54 -0700 Subject: [PATCH] style(release): Add an extra for installing mapping dependencies --- .github/workflows/ci.yaml | 1 + Dockerfile | 3 ++- README.md | 4 ++++ docs/index.rst | 6 ++++++ ladybug_comfort/collection/adaptive.py | 10 +++++----- mapping-requirements.txt | 1 + setup.py | 6 ++++++ 7 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 mapping-requirements.txt diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1e2e7d5c..c91c7929 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,6 +24,7 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install -r dev-requirements.txt + pip install -r mapping-requirements.txt - name: run tests run: python -m pytest --cov=. tests/ - name: run test coverage diff --git a/Dockerfile b/Dockerfile index 22d42789..00e46cb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,12 +24,13 @@ COPY .git ${LIBRARYDIR}/.git COPY setup.py ${LIBRARYDIR} COPY setup.cfg ${LIBRARYDIR} COPY requirements.txt ${LIBRARYDIR} +COPY mapping-requirements.txt ${LIBRARY_PATH} COPY README.md ${LIBRARYDIR} COPY LICENSE ${LIBRARYDIR} USER root RUN pip3 install --no-cache-dir setuptools wheel\ - && pip3 install --no-cache-dir ${LIBRARYDIR} \ + && pip3 install --no-cache-dir ${LIBRARYDIR}[mapping] \ && apt-get -y --purge remove git \ && apt-get -y clean \ && apt-get -y autoremove \ diff --git a/README.md b/README.md index ddf7cd9a..be60ea35 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ Ladybug-comfort is a Python library that adds thermal comfort functionalities to `pip install ladybug-comfort` +If you want to also include the dependencies needed for thermal mapping use: + +`pip install -U honeybee-energy[mapping]` + To check if the Ladybug-comfort command line interface is installed correctly, use `ladybug-comfort --help`. diff --git a/docs/index.rst b/docs/index.rst index 0ac530c8..2b21aa29 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,6 +11,12 @@ Installation ``pip install -U ladybug-comfort`` +If you want to also include the dependencies needed for thermal mapping use. + +``pip install -U honeybee-energy[mapping]`` + +To check if the command line interface is installed correctly use ``ladybug-comfort --help`` + CLI Docs ============= diff --git a/ladybug_comfort/collection/adaptive.py b/ladybug_comfort/collection/adaptive.py index ab65dc96..cc9e74e1 100644 --- a/ladybug_comfort/collection/adaptive.py +++ b/ladybug_comfort/collection/adaptive.py @@ -76,7 +76,7 @@ class Adaptive(ComfortCollection): '_cooling_effect_coll') def __init__(self, outdoor_temperature, operative_temperature, air_speed=None, - comfort_parameter=None): + comfort_parameter=None): """Initialize an Adaptive comfort object from DataCollections of inputs. """ # set up the object using operative temperature as a base @@ -133,7 +133,7 @@ def from_air_and_rad_temp(cls, outdoor_temperature, air_temperature, return cls(outdoor_temperature, to, air_speed, comfort_parameter) def _calculate_adaptive(self): - """Compute Adaptive comfort for each step of the Data Collection.""" + """Compute Adaptive comfort for each step of the Data Collection.""" # empty properties to be calculated self._neutral_temperature = [] self._degrees_from_neutral = [] @@ -307,9 +307,9 @@ def __init__(self, outdoor_temperature, avg_month=True): self._head = self._t_out.header self._avg_month = avg_month - assert isinstance(self._head.data_type, Temperature) and self._head.unit == 'C',\ - 'outdoor_temperature must be Temperature in C. Got {} in {}'.format( - self._head.data_type, self._head.unit) + assert isinstance(self._head.data_type, Temperature) and \ + self._head.unit == 'C', 'outdoor_temperature must be Temperature in C. ' \ + 'Got {} in {}'.format(self._head.data_type, self._head.unit) assert self._t_out.is_continuous, 'outdoor_temperature must be continuous.' assert self._head.analysis_period.is_annual, 'outdoor_temperature must be annual' assert isinstance(self._avg_month, bool), 'avg_month' \ diff --git a/mapping-requirements.txt b/mapping-requirements.txt new file mode 100644 index 00000000..aaf43cf0 --- /dev/null +++ b/mapping-requirements.txt @@ -0,0 +1 @@ +numpy<2.0.0 diff --git a/setup.py b/setup.py index 4e9b24ee..60d5a4cc 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,9 @@ with open('requirements.txt') as f: requirements = f.read().splitlines() +with open('mapping-requirements.txt') as f: + mapping_requirements = f.read().splitlines() + setuptools.setup( name="ladybug-comfort", use_scm_version=True, @@ -20,6 +23,9 @@ packages=setuptools.find_packages(exclude=['tests']), include_package_data=True, install_requires=requirements, + extras_require={ + 'mapping': mapping_requirements + }, entry_points={ "console_scripts": ["ladybug-comfort = ladybug_comfort.cli:comfort"] },