diff --git a/.github/workflows/test_pytest.yaml b/.github/workflows/test_pytest.yaml index b775a3dd3..d8bd00f70 100644 --- a/.github/workflows/test_pytest.yaml +++ b/.github/workflows/test_pytest.yaml @@ -22,11 +22,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt pip install -r requirements_test.txt - name: Build RocketPy run: | - python setup.py install + pip install -e . - name: Test with pytest run: | pytest diff --git a/docs/user/requirements.rst b/docs/user/requirements.rst index 63b419607..c24b73193 100644 --- a/docs/user/requirements.rst +++ b/docs/user/requirements.rst @@ -7,9 +7,10 @@ But read further if this is not your case! Python Version -------------- -RocketPy was made to run on Python 3.6+. +RocketPy supports Python 3.7 and above. +Support for Python 3.11 is still limited by some dependencies. Sorry, there are currently no plans to support earlier versions. -If you really need to run RocketPy on Python 3.5 or earlier, feel free to submit an issue and we will see what we can do! +If you really need to run RocketPy on Python 3.6 or earlier, feel free to submit an issue and we will see what we can do! Required Packages ----------------- @@ -20,17 +21,16 @@ The following packages are needed in order to run RocketPy: - Numpy >= 1.0 - Scipy >= 1.0 - Matplotlib >= 3.0 -- netCDF4 >= 1.4 (optional, requires Cython) +- netCDF4 >= 1.4 - windrose >= 1.6.8 - requests - pytz -- timezonefinder - simplekml - ipywidgets >= 7.6.3 - jsonpickle -All of these packages, with the exception of netCDF4, should be automatically installed when RocketPy is installed using either ``pip`` or ``conda``. +All of these packages, are automatically installed when RocketPy is installed using either ``pip`` or ``conda``. However, in case the user wants to install these packages manually, they can do so by following the instructions bellow. Installing Required Packages Using ``pip`` @@ -64,6 +64,20 @@ To update Scipy and install netCDF4 using Conda, the following code is used: conda install "scipy>=1.0" conda install -c anaconda "netcdf4>=1.4" + +Optional Packages +----------------- + +Optionally, you can install timezonefinder to allow for automatic timezone detection when performing Enviornment Analysis. +This can be done by running the following line of code in your preferred terminal: + +.. code-block:: shell + + pip install timezonefinder + +Keep in mind that this package is not required to run RocketPy, but it can be useful if you want to perform Environment Analysis. +Furthermore, timezonefinder can only be used with Python 3.8+. + Useful Packages --------------- diff --git a/rocketpy/EnvironmentAnalysis.py b/rocketpy/EnvironmentAnalysis.py index 8eeacbc0f..e318e043c 100644 --- a/rocketpy/EnvironmentAnalysis.py +++ b/rocketpy/EnvironmentAnalysis.py @@ -22,7 +22,6 @@ from matplotlib.animation import FuncAnimation from matplotlib.animation import PillowWriter as ImageWriter from scipy import stats -from timezonefinder import TimezoneFinder from windrose import WindroseAxes from rocketpy.Environment import Environment @@ -421,6 +420,16 @@ def __localize_input_dates(self): def __find_preferred_timezone(self): if self.preferred_timezone is None: + try: + import timezonefinder as TimezoneFinder + except ImportError: + raise ImportError( + "The timezonefinder package is required to automatically " + + "determine local timezone based on lat,lon coordinates. " + + "Please specify the desired timezone using the `timezone` " + + "argument when initializing the EnvironmentAnalysis class " + + "or install timezonefinder with `pip install timezonefinder`." + ) # Use local timezone based on lat lon pair tf = TimezoneFinder() self.preferred_timezone = pytz.timezone( diff --git a/setup.py b/setup.py index b94d4e669..326692187 100644 --- a/setup.py +++ b/setup.py @@ -15,10 +15,12 @@ "ipywidgets>=7.6.3", "requests", "pytz", - "timezonefinder", "simplekml", "jsonpickle", ], + extras_require={ + "timezonefinder": ["timezonefinder"], + }, maintainer="RocketPy Developers", author="Giovani Hidalgo Ceotto", author_email="ghceotto@gmail.com", @@ -32,5 +34,5 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], - python_requires=">=3.6", + python_requires=">=3.7", )