Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saullocastro committed Nov 3, 2023
0 parents commit e75e999
Show file tree
Hide file tree
Showing 11 changed files with 342 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/auto_doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: doc

on:
push:
tags:
- '*.*.*'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade -r requirements_doc.txt
- name: Install module
run: |
python setup.py install
- name: Building documentation
run: |
cd doc
make html
- name: Deploying documentation
uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./doc/build/html # The folder the action should deploy.
17 changes: 17 additions & 0 deletions .github/workflows/auto_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: auto-release

on:
push:
tags:
- '*.*.*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: pytest

on: [push]

jobs:
build:

strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, '3.10', '3.11']
runs-on: ${{ matrix.runs-on }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade -r requirements.txt
- name: Install module
run: |
python setup.py install
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 ./birdpressure --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./birdpressure --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and coverage report
run: |
#coverage run -m py.test tests
coverage run --source birdpressure -m pytest
coverage lcov
coverage report
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
files: ./.coverage
fail_ci_if_error: true
verbose: true

- name: "Coveralls GitHub Action"
uses: coverallsapp/github-action@master
env:
COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.lcov
31 changes: 31 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Upload Python Package

on:
push:
tags:
- '*.*.*'

jobs:
deploy:
strategy:
matrix:
python-version: ['3.11']
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install setuptools wheel twine
pip3 install -r requirements.txt
- name: Build and publish python wheels
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*.whl
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version.py
# Build related
build
dist
.coverage
.pytest_cache
*.egg-info

# Temp files
.ipynb_checkpoints
tmp*
temp*
tmp*.*
temp*.*
.cache
.DS_Store

# Output files
*.png
*.pdf
*.mp4

# Python compiled files
*.pyc
*.pyo
*.pyd

28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2023, Jonas Bertholdt, Saullo G P Castro

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include tests *.py
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TU Delft, CrashProofLab, Pressure due to Bird Strike
---

Github Actions status:


Coverage status:



Urban Air Mobility


License
-------
Distrubuted under the 3-Clause BSD license
(https://raw.github.com/saullocastro/birdpressure/master/LICENSE).

Contact: jonas.bertholdt@gmail.com
Contact: S.G.P.Castro@tudelft.nl

8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
numpy
sympy
matplotlib
pytest
pytest-cov
coverage
coveralls

2 changes: 2 additions & 0 deletions requirements_doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx
numpydoc
120 changes: 120 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import os
import inspect
import subprocess
from setuptools import setup, find_packages


is_released = False
version = '0.0.1'


def git_version():
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ['SYSTEMROOT', 'PATH']:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out

try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
git_revision = out.strip().decode('ascii')
except OSError:
git_revision = "Unknown"

return git_revision


def get_version_info(version, is_released):
fullversion = version
if not is_released:
git_revision = git_version()
fullversion += '.dev0+' + git_revision[:7]
return fullversion


def write_version_py(version, is_released, filename='birdpressure/version.py'):
fullversion = get_version_info(version, is_released)
with open("./birdpressure/version.py", "wb") as f:
f.write(b'__version__ = "%s"\n' % fullversion.encode())
return fullversion


# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
setupdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
return open(os.path.join(setupdir, fname)).read()


#_____________________________________________________________________________

install_requires = [
"numpy",
"sympy",
"matplotlib",
]

#Trove classifiers
CLASSIFIERS = """\
Development Status :: 1 - Planning
Intended Audience :: Education
Intended Audience :: Science/Research
Intended Audience :: Developers
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Mathematics
Topic :: Education
Topic :: Software Development
Topic :: Software Development :: Libraries :: Python Modules
Operating System :: Microsoft :: Windows
Operating System :: Unix
Operating System :: POSIX :: BSD
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
License :: OSI Approved :: BSD License
"""

fullversion = write_version_py(version, is_released)

data_files = [('', [
'README.md',
'LICENSE',
])]

keywords = [
'crashworthiness',
'bird strike',
'pressure',
'preliminary design',
]

s = setup(
name = "birdpressure",
version = fullversion,
author = "Jonas Bertholdt, Saullo G. P. Castro",
author_email = "jonas.bertholdt@gmail.com, S.G.P.Castro@tudelft.nl",
description = ("Calculate peak pressure due to bird impact"),
license = "3-Clause BSD",
keywords = keywords,
url = "https://github.com/saullocastro/birdpressure",
packages=find_packages(),
data_files=data_files,
long_description=read('README.md'),
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
install_requires=install_requires,
include_package_data=True,
)

0 comments on commit e75e999

Please sign in to comment.