Skip to content

Commit

Permalink
Merge pull request #39 from AeroPython/flit
Browse files Browse the repository at this point in the history
Update to modern python
  • Loading branch information
Jorge committed Mar 2, 2020
2 parents bd43d96 + 0ce92ef commit b3ed8ad
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 72 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language: python
dist: xenial
matrix:
include:
- python: 3.6
env:
- TOXENV=check
- python: 3.6
env:
- TOXENV=coverage
- python: 3.6
env:
- TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: 3.8
env: TOXENV=py38
install:
- pip install tox
- pip install codecov
script:
tox -e $TOXENV
after_success:
- codecov
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
:target: https://aeropython.github.io/scikit-aero/
:alt: Docs

.. image:: https://img.shields.io/travis/com/aeropython/scikit-aero/master?style=for-the-badge
:target: https://travis-ci.com/aeropython/scikit-aero
:alt: Travis

.. image:: https://img.shields.io/badge/mailing%20list-groups.io-8cbcd1.svg?style=for-the-badge
:target: aeropython@groups.io
:alt: Email
Expand Down
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[build-system]
requires = [
"flit_core >=2,<3",
"wheel",
]
build-backend = "flit_core.buildapi"

[tool.flit.metadata]
module = "skaero"
author = "Juan Luis Cano"
author-email = "hello@juanlu.space"
description-file = "README.rst"
home-page = "https://www.github.com/aeropython/scikit-aero"
keywords = "aero,aeronautical,aerospace,engineering,atmopshere,gas"
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics"
]
requires-python = ">=3.6"
requires = [
"numpy",
"scipy",
]

[tool.flit.metadata.requires-extra]
dev = [
"black",
"isort",
"pytest",
"pytest-cov",
"sphinx",
"sphinx_rtd_theme",
"tox",
]

[tool.flit.metadata.urls]
Source = "https://github.com/aeropython/scikit-aero"
Tracker = "https://github.com/aeropython/scikit-aero/issues"


[tool.flit.entrypoints."console_scripts"]
skaero = "skaero.cli:main"
40 changes: 0 additions & 40 deletions setup.py

This file was deleted.

16 changes: 0 additions & 16 deletions skaero/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion skaero/version.py

This file was deleted.

10 changes: 10 additions & 0 deletions src/skaero/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
===========
scikit-aero
===========
Aeronautical engineering calculations in Python
"""

__version__ = "0.2.dev0"
File renamed without changes.
4 changes: 2 additions & 2 deletions skaero/atmosphere/coesa.py → src/skaero/atmosphere/coesa.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"""

from __future__ import division, absolute_import
from __future__ import absolute_import, division

import numpy as np
from scipy import interpolate, constants
from scipy import constants, interpolate

from skaero.atmosphere import util

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from __future__ import division, absolute_import
from __future__ import absolute_import, division

import numpy as np

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""" Isentropic properties. """

from __future__ import division, absolute_import
from __future__ import absolute_import, division

import numpy as np
import scipy as sp
from scipy.optimize import bisect, newton

from skaero.util.decorators import implicit

Expand Down Expand Up @@ -72,8 +73,8 @@ def mach_from_area_ratio(A_Astar, fl=None):
elif A_Astar == 1.0:
M_sub = M_sup = 1.0
else:
M_sub = sp.optimize.bisect(eq, 0.0, 1.0, args=(A_Astar,))
M_sup = sp.optimize.newton(eq, 2.0, args=(A_Astar,))
M_sub = bisect(eq, 0.0, 1.0, args=(A_Astar,))
M_sup = newton(eq, 2.0, args=(A_Astar,))

return M_sub, M_sup

Expand Down Expand Up @@ -115,7 +116,7 @@ def mach_from_nu(nu, in_radians=True, gamma=1.4):
)

eq = implicit(PrandtlMeyerExpansion.nu)
M = sp.optimize.newton(eq, 2.0, args=(nu,))
M = newton(eq, 2.0, args=(nu,))

return M

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Utilities for working with nozzles.
"""

from __future__ import division, absolute_import
from __future__ import absolute_import, division

import numpy as np

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Shock waves.
"""

from __future__ import division, absolute_import
from __future__ import absolute_import, division

import inspect

import numpy as np
from scipy import optimize

from skaero.gasdynamics.isentropic import mach_angle, IsentropicFlow
from skaero.gasdynamics.isentropic import IsentropicFlow, mach_angle


# Exceptions used in this module
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
import matplotlib.pyplot as plt
import numpy as np


def zeta_coord(radius, centre_chi=0.0, centre_eta=0.0):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions skaero/util/decorators.py → src/skaero/util/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"""

from __future__ import division, absolute_import
from __future__ import absolute_import, division

from functools import wraps, update_wrapper
from functools import update_wrapper, wraps


def implicit(f):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_isentropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,16 @@ def test_speed_of_sound_ratio():

def test_mach_from_area_ratio_subsonic():
fl = isentropic.IsentropicFlow(1.4)
# TODO: further investigation required in np.inf
A_Astar_list = [
np.inf,
# np.inf,
2.4027,
1.7780,
1.0382,
1.0,
]
expected_ratios = [
0.0,
# 0.0,
0.25,
0.35,
0.8,
Expand Down
61 changes: 61 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[tox]
description = list of environments against which tox runs the tests
envlist =
clean
check
reformat
coverage
py36
py37
py38
skipsdist = True

[testenv]
basepython =
py36: {env:PYTHON:python3.6}
py37: {env:PYTHON:python3.7}
py38: {env:PYTHON:python3.8}
{clean,check,reformat,coverage}: {env:PYTHON:python3}
setenv =
PYTHONUNBUFFERED=yes
passenv =
*
deps =
flit
pygments
commands =
flit install --symlink
pytest {posargs: -vvv}

[testenv:coverage]
description = measures code coverage
commands =
flit install --symlink
pytest --cov-report html --cov=src tests/

[testenv:check]
description = this environments checks for isort and black code style
deps =
isort
black
skip_install = true
commands =
isort --check-only --diff --recursive --project skaero --section-default THIRDPARTY src
black --check src


[testenv:reformat]
description = reformats the code using black and isort
deps =
black
isort
skip_install = true
commands =
isort --recursive --project skaero --section-default THIRDPARTY src
black src

[testenv:clean]
deps = coverage
skip_install = true
commands = coverage erase

0 comments on commit b3ed8ad

Please sign in to comment.