Skip to content

Commit

Permalink
Ci for windows and macos (#27)
Browse files Browse the repository at this point in the history
* ci_windows

* adding path

* using conda-incubator

* Added CONDA_ENV_FILE

* using shell...?

* Using mamba

* using correct yml

* a

* b

* c

* d

* e

* ignore macos

* ignore windows and macos. Adding more python

* duplicate  python versions

* c

* For PR

* Setting fail-fast false

* Install compilers and openmp in the conda environments

* Remove --no-deps flag

* Fix ci (#28)

* Install compilers and openmp in the conda environments

* Remove --no-deps flag

---------

Co-authored-by: Kale Kundert <kale@thekunderts.net>

* Don't specify a bash shell

* Add a custom windows workflow

* Enable tmate session

* Enable tmate session

* Explicitly request powershell

* Prepare the MSVC development environment

* Add separate workflows for each OS

* Upgrade pip

* Use python 3

* Consolidate into one workflow

* disable fail-fast behavior

* Python 3.7 is EOL

* Try preparing a MSVC dev environment again

* Enable tmate session

* Ugly workaround to add dlls

* subprocess.run instead of check_output

* Static linking

* Use long floats

* Is '-lquadmath' necessary?

* Is '-mlong-double-64' necessary?

* Is 'cd ..' necessary?

* Remove unused CI files

* Require python>=3.8

* Is MSVC necessary?

* Mention the ninja build dependency

* Remove DLL search path munging

---------

Co-authored-by: Kale Kundert <kale@thekunderts.net>
  • Loading branch information
fujiisoup and kalekundert committed Aug 27, 2023
1 parent 93c064b commit a25c573
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 100 deletions.
68 changes: 0 additions & 68 deletions .github/workflows/ci.yaml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Test

on:
push:
pull_request:
workflow_dispatch:

jobs:
test:
name: Test

strategy:
matrix:
python-version: ['3.8', '3.x']
os:
- ubuntu-latest
- macos-latest
- windows-latest
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: awvwgk/setup-fortran@v1

- name: Install build dependencies
run: |
pip install --upgrade pip
- name: Install build dependencies (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get install -y ninja-build
- name: Install build dependencies (Mac OS)
if: startsWith(matrix.os, 'macos')
run: |
brew install ninja
- name: Install build dependencies (Windows)
if: startsWith(matrix.os, 'windows')
run: |
choco install ninja
- name: Install py3nj
run: |
pip install .
- name: Install test dependencies
run: |
pip install pytest
- name: Run test suite
run: |
pytest
14 changes: 14 additions & 0 deletions HOW_TO_PUBLISH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Publish to Pypi

## Build a wheel
```
python -m build . --sdist
```
(requires `build` library. To install it, do `pip install build`)

## Upload to pypi
```
twine upload --repository pypi .\dist\* --verbose
```
(requires `twine` library. To install it, do `pip install twine`)

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ array([ 0.70710678, -0.70710678])

## Install

`py3nj` can be installed through either `pip` or github repository.
`py3nj` can be installed through either `pip` or github repository. You'll
likely need to have [ninja](https://ninja-build.org/) installed.

### Install by pip
```
Expand Down
6 changes: 0 additions & 6 deletions ci/requirements/py3.10.yml

This file was deleted.

5 changes: 0 additions & 5 deletions ci/requirements/py3.6.yml

This file was deleted.

5 changes: 0 additions & 5 deletions ci/requirements/py3.8.yml

This file was deleted.

13 changes: 11 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,27 @@ project(
default_options : ['warning_level=2'],
)

# https://github.com/mesonbuild/meson-python/issues/178
# https://github.com/scipy/scipy/blob/a082eb415192f3075921fbf3e539f2b82a53811e/scipy/meson.build#L5-L35
if host_machine.system() == 'windows'
add_project_link_arguments(
['-lucrt', '-lquadmath', '-static'],
language: ['c', 'fortran'],
)
endif

py_mod = import('python')
py = py_mod.find_installation(pure: false)

incdir_numpy = run_command(
py,
['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'],
['-c', 'import numpy; print(numpy.get_include())'],
check : true,
).stdout().strip()

incdir_f2py = run_command(
py,
['-c', 'import os; os.chdir(".."); import numpy.f2py; print(numpy.f2py.get_include())'],
['-c', 'import numpy.f2py; print(numpy.f2py.get_include())'],
check : true,
).stdout().strip()

Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description = "numpy compatible wigner 3n-J symbols"
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["atomic physics", "quantum physics"]
requires-python = '~=3.8'
dependencies = [
"numpy",
]
Expand All @@ -20,11 +21,16 @@ classifiers = [
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering :: Physics",
]
dynamic = ["version"]

[project.optional-dependencies]
test = [
"pytest",
]

[project.urls]
"Source Code" = "http://github.com/fujiisoup/py3nj"

12 changes: 0 additions & 12 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# https://github.com/fujiisoup/py3nj/issues/6
import os
import sys

extra_dll_dir = os.path.join(os.path.dirname(__file__), ".libs")

if sys.platform == "win32" and os.path.isdir(extra_dll_dir):
os.environ.setdefault("PATH", "")
os.environ["PATH"] += os.pathsep + extra_dll_dir
os.add_dll_directory(extra_dll_dir)

from ._version import __version__

from .wigner import wigner3j, wigner6j, wigner9j, clebsch_gordan
from . import wigner

0 comments on commit a25c573

Please sign in to comment.