Skip to content

Commit

Permalink
Fix 'pip install' for pip>=23.1 (#23)
Browse files Browse the repository at this point in the history
* Fix 'pip install' for pip>=23.1

* adding ci

* requirements updated

* Activate py3.6 as a reference

* Revert the addition. Sorry...

* don't use editable mode in pip

* Don't use editable mode

* Forgot a space

* Run test first

* Renaming  source directory

* adding package_dir

---------

Co-authored-by: Keisuke Fujii <[email protected]>
  • Loading branch information
kalekundert and fujiisoup authored Aug 23, 2023
1 parent 2833398 commit 9f16d03
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 37 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
workflow_dispatch: # allows you to trigger manually

jobs:
detect-ci-trigger:
name: detect ci trigger
runs-on: ubuntu-latest
if: |
github.repository == 'fujiisoup/py3nj'
&& (github.event_name == 'push' || github.event_name == 'pull_request')
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
test:
name: Set up python
runs-on: ubuntu-latest
needs: detect-ci-trigger
strategy:
matrix:
os: ["ubuntu-latest"]
# Bookend python versions
python-version: ["3.8", "3.10"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set environment variables
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "CONDA_ENV_FILE=ci/requirements/py${{ matrix.python-version }}.yml" >> $GITHUB_ENV
- name: Setup miniconda and install py3nj
run: |
conda env create -n test_env --file $CONDA_ENV_FILE;
source /usr/share/miniconda/etc/profile.d/conda.sh;
conda activate test_env;
conda list;
pip install --no-deps .;
python -m pip install --no-deps .
- name: Import py3nj
run: |
source /usr/share/miniconda/etc/profile.d/conda.sh;
conda activate test_env;
python -c "import py3nj"
- name: Run tests
run: |
source /usr/share/miniconda/etc/profile.d/conda.sh;
conda activate test_env;
python -m pytest
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test results for ${{ runner.os }}-${{ matrix.python-version }}
path: pytest.xml
File renamed without changes.
2 changes: 1 addition & 1 deletion ci/requirements-py37.yml → ci/requirements/py3.10.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test_env
dependencies:
- python=3.7
- python=3.10
- pytest
- numpy
File renamed without changes.
2 changes: 1 addition & 1 deletion ci/requirements-py27.yml → ci/requirements/py3.8.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test_env
dependencies:
- python=2.7
- python=3.8
- pytest
- numpy
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[build-system]
requires = [
"setuptools",
"setuptools-scm",
"numpy",
]
build-backend = "setuptools.build_meta"

[project]
name = "py3nj"
authors = [
{name = "Keisuke Fujii", email = "[email protected]"},
]
description = "numpy compatible wigner 3n-J symbols"
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["atomic physics", "quantum physics"]
dependencies = [
"numpy",
]
classifiers = [
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.6",
"Topic :: Scientific/Engineering :: Physics",
]
dynamic = ["version"]

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

[tool.setuptools.dynamic]
version = {attr = "py3nj._version.__version__"}
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

34 changes: 1 addition & 33 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import re
from numpy.distutils.core import setup, Extension

# load version form _version.py
VERSIONFILE = "py3nj/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr = mo.group(1)
else:
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))

# fortran extension
ext = Extension(
name="py3nj._wigner",
sources=[
Expand All @@ -28,27 +15,8 @@
extra_compile_args=["-fopenmp"],
)

# module
setup(
name="py3nj",
version=verstr,
author="Keisuke Fujii",
author_email="[email protected]",
description=("numpy compatible wigner 3n-J symbols"),
license="BSD 3-clause",
keywords="atomic physics, quantum physics",
url="http:/fujiisoup/py3nj",
packages=["py3nj"],
package_dir={"py3nj": "py3nj"},
py_modules=["py3nj.__init__"],
package_dir = {'py3nj': 'src'},
ext_modules=[ext],
classifiers=[
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.6",
"Topic :: Scientific/Engineering :: Physics",
],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9f16d03

Please sign in to comment.