Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit 192bfa5

Browse files
committed
optimize build
1 parent c414990 commit 192bfa5

16 files changed

+141
-124
lines changed

.coveragerc

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[run]
2+
cover_pylib = false
3+
omit =
4+
/home/travis/virtualenv/*
5+
*/site-packages/*
6+
7+
[report]
8+
exclude_lines =
9+
pragma: no cover
10+
def __repr__
11+
except RuntimeError
12+
except NotImplementedError
13+
except ImportError
14+
except FileNotFoundError
15+
except CalledProcessError
16+
logging.warning
17+
logging.error
18+
logging.critical
19+
if __name__ == .__main__.:

.flake8

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 132
3+
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/

.github/FUNDING.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: [scivision]
4+
ko_fi: scivision

.github/workflows/ci.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- "**/*.md"
7+
pull_request:
8+
paths-ignore:
9+
- "**/*.md"
10+
11+
jobs:
12+
13+
linux:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v1
17+
- uses: actions/setup-python@v1
18+
with:
19+
python-version: '3.x'
20+
- run: sudo apt install -yq --no-install-recommends gfortran ninja-build
21+
- run: pip install -e .[tests,lint]
22+
- run: flake8
23+
- run: mypy .
24+
- run: pytest -r a -v
25+
26+
macos:
27+
runs-on: macos-latest
28+
steps:
29+
- uses: actions/checkout@v1
30+
- uses: actions/setup-python@v1
31+
with:
32+
python-version: '3.x'
33+
- run: brew install gcc ninja
34+
- run: pip install -e .[tests]
35+
- run: pytest -r a -v
36+
37+
windows:
38+
runs-on: windows-latest
39+
steps:
40+
- uses: actions/checkout@v1
41+
- uses: actions/setup-python@v1
42+
with:
43+
python-version: '3.x'
44+
- run: cinst -y ninja
45+
- run: echo "[build]`ncompiler=mingw32" | Out-File -Encoding ASCII ~/pydistutils.cfg
46+
shell: powershell
47+
- run: pip install -e .[tests]
48+
- run: pytest -r a -v

.travis.yml

-32
This file was deleted.

CMakeLists.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cmake_minimum_required(VERSION 3.1)
2+
if(NOT CMAKE_BUILD_TYPE)
3+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release")
4+
endif()
5+
project(iri90 Fortran)
6+
7+
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
8+
set(FFLAGS -std=legacy)
9+
endif()
10+
11+
add_subdirectory(src)
12+
13+
# testiri90 is an interactive program, not for CI
14+
add_executable(testiri90 src/iritest.for)
15+
target_link_libraries(testiri90 iri90)
16+
17+
add_executable(iri90_driver src/iri90.f src/iri90_driver.F90)
18+
target_compile_definitions(iri90_driver PRIVATE
19+
BIN_DIR='${CMAKE_CURRENT_BINARY_DIR}')

LICENSE renamed to LICENSE.txt

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

README.md

+11-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
[![Build Status](https://travis-ci.org/scivision/iri90.svg?branch=master)](https://travis-ci.org/scivision/iri90)
2-
[![Coverage Status](https://coveralls.io/repos/github/scivision/iri90/badge.svg?branch=master)](https://coveralls.io/github/scivision/iri90?branch=master)
3-
[![Build status](https://ci.appveyor.com/api/projects/status/4h8pm345hscdpyf7?svg=true)](https://ci.appveyor.com/project/scivision/iri90)
1+
[![Actions Status](https://github.com/space-physics/iri90/workflows/ci/badge.svg)](https://github.com/space-physics/iri90/actions)
2+
43
[![PyPi version](https://img.shields.io/pypi/pyversions/iri90.svg)](https://pypi.python.org/pypi/iri90)
54
[![PyPi Download stats](http://pepy.tech/badge/iri90)](http://pepy.tech/project/iri90)
65

@@ -26,22 +25,19 @@ If you don't have one, here is how to install Gfortran:
2625
* Mac: `brew install gcc`
2726
* [Windows](https://www.scivision.dev/windows-gcc-gfortran-cmake-make-install/)
2827

29-
```sh
30-
pip install iri90
31-
```
32-
or for the latest development version:
28+
```posh
29+
echo "[build]`ncompiler=mingw32" | Out-File -Encoding ASCII ~/pydistutils.cfg
30+
```
31+
32+
Then
3333

3434
```sh
35-
python -m pip install -e .
36-
```
35+
git clone https://github.com/space-physics/iri90
3736

38-
### Windows
39-
If you get ImportError on Windows for the Fortran module, try:
40-
```posh
41-
del *.pyd
42-
python setup.py build_ext --inplace --compiler=mingw32
37+
python -m pip install -e iri90
4338
```
4439

40+
4541
## Usage
4642

4743
This IRI90 Python module is as small and clean as possible to enable your custom IRI90 applications.
@@ -61,15 +57,6 @@ density and temperature:
6157
python AltitudeProfile.py
6258
```
6359

64-
## Notes
65-
66-
Optional: If you want to work with just the original Fortran code:
67-
```sh
68-
cd bin
69-
cmake ../src
70-
cmake --build .
71-
```
72-
73-
### References
60+
## References
7461

7562
[Fortran Code](http://download.hao.ucar.edu/pub/stans/iri/iri90.f)

.appveyor.yml renamed to archive/.appveyor.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ init:
1919
install:
2020
- pip install -e .[tests]
2121

22-
test_script: pytest -rsv
23-
22+
test_script: pytest -r a -v

archive/.travis.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: python
2+
group: travis_latest
3+
4+
git:
5+
depth: 25
6+
quiet: true
7+
8+
addons:
9+
apt:
10+
packages: gfortran
11+
12+
install: pip install -e .[tests]
13+
14+
script:
15+
- flake8
16+
- mypy .
17+
- pytest -r a -v

bin/.ignore

Whitespace-only changes.

mypy.ini

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[mypy]
2+
ignore_missing_imports = True
3+
strict_optional = False
4+
allow_redefinition = True
5+
show_error_context = False
6+
show_column_numbers = True
7+
warn_unreachable = False
8+
9+
[mypy-xarray]
10+
follow_imports = skip

setup.cfg

+4-40
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = iri90
33
version = 1.1.1
44
description = IRI90 from Python, clean and flexible ionospheric model.
55
author = Michael Hirsch, Ph.D.
6-
url = https://github.com/scivision/iri90
6+
url = https://github.com/space-physics/iri90
77
keywords =
88
ionosphere
99
thermosphere
@@ -13,17 +13,15 @@ classifiers =
1313
Intended Audience :: Science/Research
1414
Programming Language :: Python :: 3.6
1515
Programming Language :: Python :: 3.7
16+
Programming Language :: Python :: 3.8
1617
Topic :: Scientific/Engineering :: Atmospheric Science
17-
license_file = LICENSE
18+
license_files =
19+
LICENSE.txt
1820
long_description = file: README.md
1921
long_description_content_type = text/markdown
2022

2123
[options]
2224
python_requires = >= 3.6
23-
setup_requires =
24-
setuptools >= 38.6
25-
pip >= 10
26-
twine >= 1.11
2725
include_package_data = True
2826
packages = find:
2927
install_requires =
@@ -39,37 +37,3 @@ tests =
3937
mypy
4038
plot =
4139
matplotlib
42-
43-
44-
[options.entry_points]
45-
console_scripts =
46-
47-
48-
[tool:pytest]
49-
filterwarnings =
50-
ignore::DeprecationWarning
51-
52-
[flake8]
53-
max-line-length = 132
54-
exclude = .git,__pycache__,.eggs/,doc/,docs/,build/,dist/,archive/
55-
56-
[coverage:run]
57-
cover_pylib = false
58-
omit =
59-
/home/travis/virtualenv/*
60-
*/site-packages/*
61-
*/bin/*
62-
63-
[coverage:report]
64-
exclude_lines =
65-
pragma: no cover
66-
def __repr__
67-
except RuntimeError
68-
except NotImplementedError
69-
except ImportError
70-
except FileNotFoundError
71-
except CalledProcessError
72-
logging.warning
73-
logging.error
74-
logging.critical
75-
if __name__ == .__main__.:

setup.py

-9
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,8 @@
33
from numpy.distutils.core import setup, Extension
44
from glob import glob
55
from os.path import join
6-
from pathlib import Path
7-
import os
86

97

10-
if os.name == 'nt':
11-
sfn = Path(__file__).parent / 'setup.cfg'
12-
stxt = sfn.read_text()
13-
if '[build_ext]' not in stxt:
14-
with sfn.open('a') as f:
15-
f.write("[build_ext]\ncompiler = mingw32")
16-
178
# %% fortran data files
189
iridata = glob(join('data', '*.asc'))
1910

src/CMakeLists.txt

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
1-
cmake_minimum_required(VERSION 3.1)
2-
project(iri90 Fortran)
3-
4-
add_compile_options(-mtune=native -g -O0)
5-
6-
71
add_library(iri90 iridreg.for iritec.for igrf.for cira.for irifun.for iriflip.for irisub.for)
8-
9-
add_executable(testiri90 iritest.for)
10-
target_link_libraries(testiri90 iri90)
11-
12-
add_executable(iri90_driver iri90.f iri90_driver.F90)
13-
target_compile_definitions(iri90_driver PRIVATE
14-
BIN_DIR='${CMAKE_CURRENT_BINARY_DIR}')
2+
target_compile_options(iri90 PRIVATE ${FFLAGS})

tests/test_all.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import numpy as np
44
from pytest import approx
55
from datetime import datetime
6-
from iri90 import runiri
6+
7+
import iri90
78

89

910
def test_altitude():
@@ -13,7 +14,7 @@ def test_altitude():
1314
f107 = f107a = 200.
1415
ap = 4.
1516

16-
iono = runiri(dtime, altkm, latlon, f107, f107a, ap)
17+
iono = iri90.runiri(dtime, altkm, latlon, f107, f107a, ap)
1718

1819
Isim = iono.loc[235, :]
1920
It = [2.12232176e+11, 1.13743994e+03, 1.13743994e+03,
@@ -23,4 +24,4 @@ def test_altitude():
2324

2425

2526
if __name__ == '__main__':
26-
pytest.main(['-x', __file__])
27+
pytest.main(['-v', __file__])

0 commit comments

Comments
 (0)