Skip to content

Commit

Permalink
refactor: use single version and fix dependency. (#32)
Browse files Browse the repository at this point in the history
* refactor: use single version and fix dependency.

* fix: wrong version path

* chore: remove cartopy and fiona in requirements.

* fix ci

* fix ci

* fix ci
  • Loading branch information
Clarmy authored Jul 26, 2022
1 parent 3c93b6e commit bdbf56a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/python-package-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: Install dependencies
run: |
conda env update --file environment.yml --name base
conda init bash
source ~/.bashrc
conda activate base
python -m pip install --upgrade pip
python -m pip install flake8 pytest
pip install -r requirements.txt
Expand All @@ -43,5 +46,6 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
conda activate base
pytest -p no:warnings --verbose tests/test_map_simple.py
pytest -p no:warnings --verbose tests/test_drawing_simple.py
2 changes: 1 addition & 1 deletion cnmaps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .maps import * # noqa: F403, F401
from .drawing import * # noqa: F403, F401

__version__ = "1.0.1"
__version__ = "1.0.2"

CARTOPY_DIGIT_VERSION = re.match(r"(\d*\.\d*\.\d*)", cartopy.__version__).group(1)
if CARTOPY_DIGIT_VERSION < "0.19.0":
Expand Down
11 changes: 6 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
channels:
- conda-forge
dependencies:
- matplotlib==3.4.2
- matplotlib>=3.4.2
- Cartopy>=0.19.0
- Shapely==1.8.0
- numpy==1.21.5
- netCDF4==1.5.8
- geopandas==0.10.2
- Shapely>=1.8.0
- numpy>=1.21.5
- netCDF4>=1.5.8
- geopandas>=0.10.2
- Fiona>=1.8.21
14 changes: 6 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
matplotlib==3.4.2
numpy==1.21.5
Cartopy>=0.19.0
Shapely==1.8.0
netCDF4==1.5.8
geopandas==0.10.2
Fiona==1.8.21
geojson==2.5.0
matplotlib>=3.4.2
numpy>=1.21.5
Shapely>=1.8.0
netCDF4>=1.5.8
geopandas>=0.10.2
geojson>=2.5.0
19 changes: 18 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import setuptools
import os
import codecs


def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), "r", encoding="utf-8") as fp:
return fp.read()


def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")


FILE_PATH = os.path.dirname(os.path.realpath(__file__))

Expand All @@ -15,7 +32,7 @@

setuptools.setup(
name="cnmaps",
version="1.0.1",
version=get_version("cnmaps/__init__.py"),
author="Wentao Li",
author_email="[email protected]",
description="A python package to draw china maps more easily",
Expand Down

0 comments on commit bdbf56a

Please sign in to comment.