Skip to content

Commit

Permalink
Release version:
Browse files Browse the repository at this point in the history
 - Added a workflow to package and publish on PyPi.
 - Changed ':' to '.' in structure snapshot save names to fix compatability with windows.
 - Added requirements.txt
  • Loading branch information
MrCheatak committed Feb 28, 2023
1 parent 9ad6977 commit 13aeed9
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 57 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Build febid for win and mac

on:
push:
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]
workflow_dispatch:

jobs:
build:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
include:
- arch: arm64
os: macos-latest
pypthon-version: "3.7-3.11"

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 setuptools wheel
pip install build twine
# - name: Build package for linux
# if: ${{ matrix.os == 'ubuntu-latest' }}
# uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64
# with:
# python-versions: ${{ matrix.python-version }}
# build-requirements: 'setuptools cython numpy'
# pre-build-command: python -m pip install --upgrade pip setuptools wheel
- name: Build package for mac and windows
if: ${{ matrix.os == 'windows-latest' }} || ${{ matrix.os == 'macos-latest' }}
run: |
python -m build --outdir dist
- name: Save wheels as artifacts
uses: actions/upload-artifact@v3
with:
path: dist/*
- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
twine upload dist/*
3 changes: 3 additions & 0 deletions febid/libraries/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Extension modules. Contains electron ray-tracing, stencil and visualisation modules
"""
3 changes: 3 additions & 0 deletions febid/libraries/ray_traversal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Ray-tracing utilities
"""
26 changes: 0 additions & 26 deletions febid/libraries/ray_traversal/setup.py

This file was deleted.

3 changes: 3 additions & 0 deletions febid/libraries/rolling/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Stencil-based utilities
"""
22 changes: 0 additions & 22 deletions febid/libraries/rolling/setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion febid/libraries/vtk_rendering/VTK_Rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def save_deposited_structure(structure, sim_t=None, t=None, beam_position=None,
vtk_obj.field_data['beam_position'] = [beam_position]
if filename == None:
filename = "Structure"
vtk_obj.save(f'{filename}_{time.strftime("%H:%M:%S", time.localtime())}.vtk')
vtk_obj.save(f'{filename}_{time.strftime("%H.%M.%S", time.localtime())}.vtk')


def export_obj(structure, filename=None):
Expand Down
12 changes: 12 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
matplotlib
numpy
numpy<1.23.0
pyvista
pandas
ruamel.yaml
cython
openpyxl
tqdm
pyqt5
pyaml
numexpr_mod
16 changes: 8 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
platform = sys.platform
libraries = []
if 'darwin' in platform: # darwin == OSX
os.environ["CC"] = "/usr/local/opt/llvm/bin/clang"
os.environ["CXX"] = "/usr/local/opt/llvm/bin/clang++"
# os.environ["CC"] = "/usr/local/opt/llvm/bin/clang"
# os.environ["CXX"] = "/usr/local/opt/llvm/bin/clang++"
openMP_arg = '-lomp'
if 'linux' in platform:
openMP_arg = '-fopenmp'
Expand Down Expand Up @@ -44,16 +44,16 @@
Extension("febid.libraries.rolling.roll", ['febid/libraries/rolling/roll.pyx'],
include_dirs=["/usr/local/opt/llvm/include"],
library_dirs=["/usr/local/opt/llvm/lib"],
extra_compile_args=["-w", '-fopenmp'],
libraries=libraries,
extra_link_args=[openMP_arg]
# extra_compile_args=["-w", '-fopenmp'],
# libraries=libraries,
# extra_link_args=[openMP_arg]
),
Extension("febid.libraries.pde.tridiag", ['febid/libraries/pde/tridiag.pyx'],
include_dirs=["/usr/local/opt/llvm/include"],
library_dirs=["/usr/local/opt/llvm/lib"],
extra_compile_args=["-w", "-fopenmp"],
libraries=libraries,
extra_link_args=[openMP_arg]
# extra_compile_args=["-w", "-fopenmp"],
# libraries=libraries,
# extra_link_args=[openMP_arg]
),
]

Expand Down

0 comments on commit 13aeed9

Please sign in to comment.