Skip to content

Commit

Permalink
Moving most of setup.py to pyproject.toml (openmc-dev#3074)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Shimwell <[email protected]>
Co-authored-by: Paul Romano <[email protected]>
  • Loading branch information
3 people authored Jul 12, 2024
1 parent cbec1ab commit 2107af5
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 82 deletions.
7 changes: 5 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ version: 2
build:
os: "ubuntu-20.04"
tools:
python: "3.9"
python: "3.10"

sphinx:
configuration: docs/source/conf.py

python:
install:
- requirements: docs/requirements-rtd.txt
- method: pip
path: .
extra_requirements:
- docs
13 changes: 0 additions & 13 deletions docs/requirements-rtd.txt

This file was deleted.

3 changes: 2 additions & 1 deletion openmc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib.metadata
from openmc.arithmetic import *
from openmc.bounding_box import *
from openmc.cell import *
Expand Down Expand Up @@ -40,4 +41,4 @@
from . import examples


__version__ = '0.15.1-dev'
__version__ = importlib.metadata.version("openmc")
72 changes: 72 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,74 @@
[build-system]
requires = ["setuptools", "wheel", "numpy", "cython"]

[project]
name = "openmc"
authors = [
{name = "The OpenMC Development Team", email = "[email protected]"},
]
description = "OpenMC"
version = "0.15.1-dev"
requires-python = ">=3.10"
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Topic :: Scientific/Engineering",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"numpy",
"h5py",
"scipy",
"ipython",
"matplotlib",
"pandas",
"lxml",
"uncertainties",
"setuptools",
]

[project.optional-dependencies]
depletion-mpi = ["mpi4py"]
docs = [
"sphinx==5.0.2",
"sphinxcontrib-katex",
"sphinx-numfig",
"jupyter",
"sphinxcontrib-svg2pdfconverter",
"sphinx-rtd-theme==1.0.0"
]
test = ["pytest", "pytest-cov", "colorama", "openpyxl"]
vtk = ["vtk"]

[project.urls]
Homepage = "https://openmc.org"
Documentation = "https://docs.openmc.org"
Repository = "https://github.com/openmc-dev/openmc"
Issues = "https://github.com/openmc-dev/openmc/issues"

[tool.setuptools.packages.find]
include = ['openmc*', 'scripts*']
exclude = ['tests*']

[tool.setuptools.package-data]
"openmc.data.effective_dose" = ["*.txt"]
"openmc.data" = ["*.txt", "*.DAT", "*.json", "*.h5"]
"openmc.lib" = ["libopenmc.dylib", "libopenmc.so"]

[project.scripts]
openmc-ace-to-hdf5 = "scripts.openmc_ace_to_hdf5:main"
openmc-plot-mesh-tally = "scripts.openmc_plot_mesh_tally:main"
openmc-track-combine = "scripts.openmc_track_combine:main"
openmc-track-to-vtk = "scripts.openmc_track_to_vtk:main"
openmc-update-inputs = "scripts.openmc_update_inputs:main"
openmc-update-mgxs = "scripts.openmc_update_mgxs:main"
openmc-voxel-to-vtk = "scripts.openmc_voxel_to_vtk:main"
67 changes: 1 addition & 66 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,76 +1,11 @@
#!/usr/bin/env python

import glob
import sys
import numpy as np

from setuptools import setup, find_packages
from setuptools import setup
from Cython.Build import cythonize


# Determine shared library suffix
if sys.platform == 'darwin':
suffix = 'dylib'
else:
suffix = 'so'

# Get version information from __init__.py. This is ugly, but more reliable than
# using an import.
with open('openmc/__init__.py', 'r') as f:
version = f.readlines()[-1].split()[-1].strip("'")

kwargs = {
'name': 'openmc',
'version': version,
'packages': find_packages(exclude=['tests*']),
'scripts': glob.glob('scripts/openmc-*'),

# Data files and libraries
'package_data': {
'openmc.lib': ['libopenmc.{}'.format(suffix)],
'openmc.data': ['mass_1.mas20.txt', 'BREMX.DAT', 'half_life.json', '*.h5'],
'openmc.data.effective_dose': ['*.txt']
},

# Metadata
'author': 'The OpenMC Development Team',
'author_email': '[email protected]',
'description': 'OpenMC',
'url': 'https://openmc.org',
'download_url': 'https://github.com/openmc-dev/openmc/releases',
'project_urls': {
'Issue Tracker': 'https://github.com/openmc-dev/openmc/issues',
'Documentation': 'https://docs.openmc.org',
'Source Code': 'https://github.com/openmc-dev/openmc',
},
'classifiers': [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Topic :: Scientific/Engineering'
'Programming Language :: C++',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],

# Dependencies
'python_requires': '>=3.10',
'install_requires': [
'numpy>=1.9', 'h5py', 'scipy', 'ipython', 'matplotlib',
'pandas', 'lxml', 'uncertainties', 'setuptools'
],
'extras_require': {
'depletion-mpi': ['mpi4py'],
'docs': ['sphinx', 'sphinxcontrib-katex', 'sphinx-numfig', 'jupyter',
'sphinxcontrib-svg2pdfconverter', 'sphinx-rtd-theme'],
'test': ['pytest', 'pytest-cov', 'colorama', 'openpyxl'],
'vtk': ['vtk'],
},
# Cython is used to add resonance reconstruction and fast float_endf
'ext_modules': cythonize('openmc/data/*.pyx'),
'include_dirs': [np.get_include()]
Expand Down

0 comments on commit 2107af5

Please sign in to comment.