Skip to content

Commit

Permalink
Merge pull request #384 from Living-with-machines/dev_dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
rwood-97 authored Apr 10, 2024
2 parents a9705d3 + f42b1c0 commit f3b151c
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 42 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/dependapot-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
2 changes: 1 addition & 1 deletion .github/workflows/mr_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.8]
python-version: [3.9, 3.12]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mr_pip_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.8]
python-version: [3.9, 3.12]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
rev: "23.9.1"
hooks:
- id: black-jupyter
language_version: python3.8
language_version: python3.9

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.290"
Expand Down
4 changes: 2 additions & 2 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ unfixable = [
flake8-unused-arguments.ignore-variadic-names = true
isort.required-imports = ["from __future__ import annotations"]

# Assume Python 3.8
target-version = "py38"
# Assume Python 3.9
target-version = "py39"
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

# Python versions

The following table shows which versions of MapReader are compatible with which versions of python:

+----------+------------+
| Python | MapReader |
+==========+============+
| 3.9+ | v1.2.0 |
| 3.8-3.11 | <= v.1.1.5 |
+----------+------------+


## v1.2.0 (2024-04-08)

- Remove support for python 3.8
- Update dependencies and add cartopy as required dependency
22 changes: 4 additions & 18 deletions docs/source/Install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You should choose one method within each step and follow the instructions for th
Step 1: Set up a virtual python environment
----------------------------------------------

MapReader supports python versions 3.8 to 3.10.
The most recent version of MapReader supports python versions 3.9+.

Method 1: Using conda (recommended)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -31,9 +31,9 @@ Once you have installed either Ananconda or miniconda, open your terminal and us

.. code-block:: bash
conda create -n mapreader python=3.8
conda create -n mapreader
This will create a conda enviroment which uses python version 3.8.
This will create a conda enviroment for you to install MapReader and its dependencies into.

- Activate your conda environment:

Expand All @@ -54,7 +54,7 @@ For example, if you would like to use venv, open your terminal and use the follo
python3 --version
If this returns a version below 3.7, you will need download an updated python version.
If this returns a version below 3.9, you will need download an updated python version.
You can do this by downloading from `here <https://www.python.org/downloads/>`__ (make sure you download the right one for your operating system).

You should then run the above command again to check your python version has updated.
Expand All @@ -74,16 +74,6 @@ For example, if you would like to use venv, open your terminal and use the follo
Step 2: Install MapReader
--------------------------

Cartopy
~~~~~~~~

`Cartopy <https://scitools.org.uk/cartopy/docs/latest/>`__ is used by MapReader's download subpackage to plot maps and geospatial data.
It is not essential to the functioning of MapReader and so is not listed as a required dependancy.

If you would like to use MapReader's plotting functions, you will need to ensure you have installed the `required dependencies <https://scitools.org.uk/cartopy/docs/latest/installing.html#required-dependencies>`__ for cartopy.

Then, to install cartopy with your mapreader installation, you should install mapreader with the `geo` optional dependencies (see notes below).

Method 1: Install from `PyPI <https://pypi.org/project/mapreader/>`_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -97,8 +87,6 @@ This is probably the easiest way to install MapReader.
pip install mapreader
.. note:: Replace ``pip install mapreader`` with ``pip install "mapreader[geo]"`` if you would like to install cartopy with your mapreader installation.

Method 2: Install from source
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -121,8 +109,6 @@ This method will create a ``MapReader`` directory on your machine which will con
pip install -v -e .
.. note:: Replace ``pip install -v -e .`` with ``pip install -v -e ".[geo]"`` if you would like to install cartopy with your mapreader installation.

..
Method 3: Install via conda (**EXPERIMENTAL**)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion mapreader/annotate/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def prepare_data(
).values
if random_state in ["random"]:
df = df.groupby("pixel_groups").sample(
n=10, random_state=random.randint(0, 1e6)
n=10, random_state=random.randint(0, int(1e6))
)
else:
df = df.groupby("pixel_groups").sample(n=10, random_state=random_state)
Expand Down
5 changes: 3 additions & 2 deletions mapreader/classify/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import socket
import sys
import time
from collections.abc import Hashable, Iterable
from datetime import datetime
from typing import Any, Hashable, Iterable
from typing import Any

import joblib
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -167,7 +168,7 @@ def __init__(
if not os.path.exists("./tmp_checkpoints"):
os.makedirs("./tmp_checkpoints")
self.tmp_save_filename = (
f"./tmp_checkpoints/tmp_{random.randint(0, 1e10)}_checkpoint.pkl"
f"./tmp_checkpoints/tmp_{random.randint(0, int(1e10))}_checkpoint.pkl"
)

# add colors for printing/logging
Expand Down
21 changes: 9 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
packages=setuptools.find_packages(),
include_package_data=True,
platforms="OS Independent",
python_requires=">=3.8, <3.11",
python_requires=">=3.9",
install_requires=[
"matplotlib>=3.5.0,<4.0.0",
"numpy>=1.21.5,<2.0.0",
Expand All @@ -38,14 +38,13 @@
"nest-asyncio>=1.5.1,<2.0.0",
"scikit-image>=0.18.3",
"scikit-learn>=1.0.1,<2.0.0",
"torch>=1.10.0,<2.0.0",
"torchvision>=0.11.1,<0.12.1",
"torch>=1.10.0",
"torchvision>=0.11.1,<0.17.3",
"jupyter>=1.0.0,<2.0.0",
"ipykernel>=6.5.1,<7.0.0",
"ipywidgets>=8.0.0,<9.0.0",
"ipyannotate==0.1.0-beta.0",
"Cython>=0.29.24,<0.30.0",
# "proj>=0.2.0,<0.3.0",
"PyYAML>=6.0,<7.0",
"tensorboard>=2.7.0,<3.0.0",
"parhugin>=0.0.3,<0.0.4",
Expand All @@ -58,20 +57,18 @@
"openpyxl<4.0.0",
"geopandas<1.0.0",
"pyogrio>=0.7.2",
"cartopy>=0.22.0",
],
extras_require={
"dev": [
"pytest<8.0.0",
"pytest-cov>=4.1.0,<5.0.0",
"pytest<9.0.0",
"pytest-cov>=4.1.0,<6.0.0",
"timm<1.0.0",
"transformers<5.0.0",
"black>=23.7.0,<24.0.0",
"flake8>=6.0.0,<7.0.0",
"black>=23.7.0,<25.0.0",
"flake8>=6.0.0,<8.0.0",
],
"geo": [
"cartopy>=0.20.0"
],
},
},
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
Expand Down

0 comments on commit f3b151c

Please sign in to comment.