diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/openmc_source_plotter/__init__.py b/openmc_source_plotter/__init__.py index 50c4954..91d707e 100644 --- a/openmc_source_plotter/__init__.py +++ b/openmc_source_plotter/__init__.py @@ -1,3 +1,18 @@ +try: + # this works for python 3.7 and lower + from importlib.metadata import version, PackageNotFoundError +except (ModuleNotFoundError, ImportError): + # this works for python 3.8 and higher + from importlib_metadata import version, PackageNotFoundError +try: + __version__ = version("openmc_source_plotter") +except PackageNotFoundError: + from setuptools_scm import get_version + + __version__ = get_version(root="..", relative_to=__file__) + +__all__ = ["__version__"] + from .utils import get_particle_data from .utils import create_initial_particles from .core import plot_source_direction diff --git a/openmc_source_plotter/_version.py b/openmc_source_plotter/_version.py new file mode 100644 index 0000000..5787b28 --- /dev/null +++ b/openmc_source_plotter/_version.py @@ -0,0 +1,5 @@ +# coding: utf-8 +# file generated by setuptools_scm +# don't change, don't track in version control +__version__ = version = "0.2.1.dev1+g15fa018" +__version_tuple__ = version_tuple = (0, 2, 1, "dev1", "g15fa018") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f4e5dcc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,10 @@ +[build-system] +requires = [ + "setuptools >= 46.4.0", + "wheel", + "setuptools_scm[toml] >= 6.3.1", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "openmc_source_plotter/_version.py" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..8a46d61 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,36 @@ +[metadata] +name = openmc_source_plotter +version = attr: openmc_source_plotter.__version__ +author = The openmc_source_plotter Development Team +author_email = mail@jshimwell.com +description = Extract data and create plots of OpenMC particle sources +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/fusion-energy/openmc_source_plotter +license = MIT +license_file = LICENSE.txt +classifiers = + Natural Language :: English + Topic :: Scientific/Engineering + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + License :: OSI Approved :: MIT License + Operating System :: OS Independent +project_urls = + Source = https://github.com/fusion-energy/openmc_source_plotter + Tracker = https://github.com/fusion-energy/openmc_source_plotter/issues + +[options] +packages = find: +python_requires= >=3.6 +install_requires= + numpy >= 1.21.1 + plotly >= 5.1.0 + h5py + # openmc is also required but can't yet be installed by pip + +[flake8] +per-file-ignores = __init__.py:F401 diff --git a/setup.py b/setup.py index e8010f4..1abbd06 100644 --- a/setup.py +++ b/setup.py @@ -1,29 +1,4 @@ import setuptools -with open("README.md", "r") as fh: - long_description = fh.read() - -setuptools.setup( - name="openmc_source_plotter", - version="develop", - author="The Fusion Energy Development Team", - author_email="mail@jshimwell.com", - description="Extract data and create plots of OpenMC particle sources", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/fusion-energy/openmc_source_plotter", - packages=setuptools.find_packages(), - classifiers=[ - "Natural Language :: English", - "Topic :: Scientific/Engineering", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - python_requires=">=3.6", - install_requires=["plotly>=5.1.0", "numpy>=1.21.1", "h5py"], -) +if __name__ == "__main__": + setuptools.setup()