Skip to content

Commit

Permalink
Merge pull request #176 from ClearCalcs/swapToPoetry
Browse files Browse the repository at this point in the history
Swap to Poetry for dependency & package mgmt
  • Loading branch information
smith120bh authored Jul 20, 2024
2 parents 032195c + 8fa7508 commit 264b271
Show file tree
Hide file tree
Showing 12 changed files with 1,867 additions and 94 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev,test]
python -m pip install --upgrade poetry
poetry install
- name: Run linting check with pylint
run: |
pylint ./pycufsm
poetry run pylint ./pycufsm
- name: Run formatting checks with black
run: |
black --check .
poetry run black --check .
- name: Run type checks with mypy
run: |
mypy
poetry run mypy
- name: Run FEM tests with pytest
run: |
python -m pytest --pspec tests/
poetry run pytest --pspec tests/
- name: Install pypa/build
run: |
pip install build
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev,test]
python -m pip install --upgrade poetry
poetry install
- name: Run linting check with pylint
run: |
pylint ./pycufsm
poetry run pylint ./pycufsm
- name: Run formatting checks with black
run: |
black --check .
poetry run black --check .
- name: Run type checks with mypy
run: |
mypy
poetry run mypy
- name: Run FEM tests with pytest
run: |
python -m pytest --pspec tests/
poetry run pytest --pspec tests/
build:
name: Run FEM Testing Suite with Most Recent Dependencies
runs-on: ubuntu-latest
Expand All @@ -47,9 +47,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev,test]
python -m pip install --upgrade poetry
poetry install
- name: Run FEM tests with pytest
run: |
python -m pytest --pspec tests/
poetry run pytest --pspec tests/
25 changes: 0 additions & 25 deletions _custom_build.py

This file was deleted.

31 changes: 31 additions & 0 deletions build_cython_ext.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import numpy
from Cython.Distutils import build_ext

# from Cython.Build import cythonize
from setuptools import Extension

define_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]

ext_modules = [
Extension(
"pycufsm.analysis_c",
sources=["pycufsm/analysis_c.pyx"],
define_macros=define_macros,
include_dirs=[numpy.get_include()],
),
]


class BuildExt(build_ext):
def build_extensions(self) -> None:
for ext in ext_modules:
self.build_extension(ext)


def build(setup_kwargs: dict) -> None:
setup_kwargs.update(
{
"ext_modules": ext_modules,
"cmdclass": {"build_ext": BuildExt},
}
)
9 changes: 0 additions & 9 deletions dev_requirements.txt

This file was deleted.

5 changes: 0 additions & 5 deletions doc_requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion jupyter_requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion plot_requirements.txt

This file was deleted.

1,770 changes: 1,770 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

79 changes: 51 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
[build-system]
requires = ["setuptools>=61.0", "cython", "numpy>=2.0.0rc1"]
build-backend = "setuptools.build_meta"
requires = [
"poetry-core>=1.2.0",
"setuptools>=61.0",
"cython>=3.0",
"numpy>=2.0.0rc1",
]
build-backend = "poetry.core.masonry.api"

[project]
[tool.poetry]
name = "pycufsm"
authors = [{ name = "Brooks Smith", email = "[email protected]" }]
version = "0.1.4"
authors = ["Brooks Smith <[email protected]>"]
description = "Python CUFSM (Constrained and Unconstrained Finite Strip Method)"
requires-python = ">=3.10"
keywords = [
"FSM",
"finite strip",
"CUFSM",
"CFS",
"thin-walled",
Expand All @@ -16,7 +23,7 @@ keywords = [
"structural engineering",
"structural analysis",
]
license = { text = "AFL-3.0" }
license = "AFL-3.0"
classifiers = [
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
Expand All @@ -27,33 +34,50 @@ classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: Academic Free License (AFL)",
]
dynamic = ["version", "readme", "dependencies", "optional-dependencies"]
readme = "README.md"
homepage = "https://github.com/ClearCalcs/pyCUFSM"
repository = "https://github.com/ClearCalcs/pyCUFSM"
documentation = "https://pycufsm.readthedocs.io"
packages = [{ include = "pycufsm" }]
include = ["py.typed", "*.pyx"]

[tool.poetry.dependencies]
python = ">=3.10"
numpy = ">=1.23.5"
scipy = ">=1.10.0"
ipywidgets = { version = ">=8.0.0", optional = true }
matplotlib = { version = ">=3.2", optional = true }

[tool.setuptools.dynamic]
version = { attr = "pycufsm._version.__version__" }
readme = { file = ["README.md"] }
dependencies = { file = "requirements.txt" }
[tool.poetry.group.dev.dependencies]
numpy = "==2.0.0"
scipy = "==1.14.0"
matplotlib = "==3.9.0"
typing_extensions = "==4.12.2"
ipywidgets = "==8.1.3"

[tool.setuptools.dynamic.optional-dependencies]
plot = { file = "plot_requirements.txt" }
test = { file = "test_requirements.txt" }
dev = { file = "dev_requirements.txt" }
jupyter = { file = "jupyter_requirements.txt" }
doc = { file = "doc_requirements.txt" }
[tool.poetry.group.test.dependencies]
pylint = "==3.2.5"
mypy = "==1.10.1"
black = { version = "==24.4.2", extras = ["jupyter"] }
pytest = "==8.2.2"
pytest-describe = "==2.2.0"
pytest-pspec = "==0.0.4"
pytest-raises = "==0.11"

[project.urls]
"Homepage" = "https://github.com/ClearCalcs/pyCUFSM"
"Documentation" = "https://pycufsm.readthedocs.io"
[tool.poetry.group.docs]
optional = true

[tool.setuptools]
packages = ["pycufsm"]
py-modules = ["_custom_build"]
[tool.poetry.group.docs.dependencies]
sphinx = "==7.3.7"
sphinx_autoapi = "==3.1.2"

[tool.setuptools.package-data]
pycufsm = ["py.typed"]
[tool.poetry.extras]
plot = ["matplotlib"]
jupyter = ["ipywidgets", "matplotlib"]

[tool.setuptools.cmdclass]
build_py = "_custom_build.build_py"
[tool.poetry.build]
script = "build_cython_ext.py"
generate-setup-file = true

[tool.pylint]
disable = [
Expand Down Expand Up @@ -81,7 +105,6 @@ allow_any_generics = true
implicit_reexport = true
exclude = ['gui_widgets\.py']


[tool.black]
line-length = 120
target-version = ['py310', 'py311', 'py312']
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

7 changes: 0 additions & 7 deletions test_requirements.txt

This file was deleted.

0 comments on commit 264b271

Please sign in to comment.