Skip to content

Commit 8992e05

Browse files
authored
Merge pull request #36 from openmc-data-storage/develop
moving to src layout
2 parents ae4c378 + b461b76 commit 8992e05

File tree

14 files changed

+116
-150
lines changed

14 files changed

+116
-150
lines changed

.github/workflows/anaconda-publish.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ jobs:
1818
apt-get --allow-releaseinfo-change update
1919
conda install -y anaconda-client conda-build
2020
conda config --set anaconda_upload no
21-
conda install -y boa -c conda-forge
2221
- name: Build and publish to conda
2322
env:
2423
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
2524
run: |
26-
conda mambabuild conda -c conda-forge --config-file conda/conda_build_config.yaml
25+
conda build conda -c conda-forge --config-file conda/conda_build_config.yaml
2726
conda convert /opt/conda/conda-bld/linux-64/*.tar.bz2 --platform osx-64 --platform win-64 -o /opt/conda/conda-bld/
2827
anaconda upload -f /opt/conda/conda-bld/*/*.tar.bz2

.github/workflows/conda-build-test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ jobs:
2020
apt-get --allow-releaseinfo-change update
2121
conda install -y anaconda-client conda-build
2222
conda config --set anaconda_upload no
23-
conda install -y boa -c conda-forge
2423
- name: Build and test
2524
env:
2625
GIT_DESCRIBE_TAG: 0.1
2726
run: |
28-
conda mambabuild conda -c conda-forge --config-file conda/conda_build_config.yaml
27+
conda build conda -c conda-forge --config-file conda/conda_build_config.yaml

.github/workflows/docker_ci_main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ jobs:
2323
run: |
2424
pip install .
2525
26-
- name: test test_command_line_usage.py
26+
- name: test_command_line_usage.py
2727
run: |
28-
pytest tests/test_command_line_usage.py -v --cov=openmc_data_downloader --cov-report term --cov-report xml
28+
pytest tests/test_command_line_usage.py -v --cov=src --cov-report term --cov-report xml
2929
30-
- name: test test_functions.py
30+
- name: test_functions.py
3131
run: |
32-
pytest tests/test_functions.py -v --cov=openmc_data_downloader --cov-report term --cov-report xml
32+
pytest tests/test_functions.py -v --cov=src --cov-report term --cov-report xml
3333
34-
- name: test test_use_in_openmc.py
34+
- name: test_use_in_openmc.py
3535
run: |
36-
pytest tests/test_use_in_openmc.py -v --cov=openmc_data_downloader --cov-report term --cov-report xml
36+
pytest tests/test_use_in_openmc.py -v --cov=src --cov-report term --cov-report xml
3737
3838
- name: upload test results
3939
run: |

conda/meta.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ source:
1010

1111
build:
1212
number: 0
13-
script: python setup.py install --single-version-externally-managed --record=record.txt
14-
15-
# could be changed to use pip install in the future
16-
# script: python -m pip install --no-deps --ignore-installed .
13+
script: python -m pip install --no-deps --ignore-installed .
1714

1815
requirements:
1916
build:
2017
- python {{ python }}
21-
- setuptools>=46.4.0
22-
- setuptools_scm>=6.3.1
18+
- setuptools>=65.4.0
19+
- setuptools_scm[toml]>=7.0.5
2320
run:
2421
- python
2522
- pandas

pyproject.toml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,47 @@
11
[build-system]
22
requires = [
3-
"setuptools >= 46.4.0",
4-
"wheel",
5-
"setuptools_scm[toml] >= 6.3.1",
3+
"setuptools >= 65.5.0",
4+
"setuptools_scm[toml] >= 7.0.5",
65
]
76
build-backend = "setuptools.build_meta"
87

8+
9+
[project]
10+
name = "openmc_data_downloader"
11+
authors = [
12+
{ name="Jonathan Shimwell", email="[email protected]" },
13+
]
14+
license = {file = "LICENSE"}
15+
description = "A tool for selectively downloading h5 files for specified isotopes / elements from your libraries of choice"
16+
readme = "README.md"
17+
requires-python = ">=3.8"
18+
keywords = ["openmc", "nuclear", "data", "download", "process", "cross", "section"]
19+
classifiers = [
20+
"Programming Language :: Python :: 3",
21+
"License :: OSI Approved :: MIT License",
22+
"Operating System :: OS Independent",
23+
]
24+
dependencies = [
25+
"pandas",
26+
"retry"
27+
]
28+
dynamic = ["version"]
29+
930
[tool.setuptools_scm]
10-
write_to = "openmc_data_downloader/_version.py"
31+
write_to = "src/_version.py"
32+
33+
34+
[project.optional-dependencies]
35+
tests = [
36+
"pytest"
37+
]
38+
39+
[project.urls]
40+
"Homepage" = "https://github.com/fusion-energy/openmc_data_downloader"
41+
"Bug Tracker" = "https://github.com/fusion-energy/openmc_data_downloader/issues"
42+
43+
[tool.setuptools]
44+
package-dir = {"" = "src"}
45+
46+
[project.scripts]
47+
openmc_data_downloader = "openmc_data_downloader.terminal_cmd:main"

setup.cfg

Lines changed: 0 additions & 41 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 4 deletions
This file was deleted.
File renamed without changes.

openmc_data_downloader/openmc_data_downloader renamed to src/openmc_data_downloader/terminal_cmd.py

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,82 @@
1111
import argparse
1212
from pathlib import Path
1313

14-
from openmc_data_downloader import just_in_time_library_generator, LIB_OPTIONS, SAB_OPTIONS
14+
from openmc_data_downloader import (
15+
just_in_time_library_generator,
16+
LIB_OPTIONS,
17+
SAB_OPTIONS,
18+
)
1519

1620

17-
if __name__ == '__main__':
18-
21+
def main():
1922
parser = argparse.ArgumentParser()
2023

2124
parser.add_argument(
22-
'-l', '--libraries',
23-
choices=LIB_OPTIONS, nargs='*',
25+
"-l",
26+
"--libraries",
27+
choices=LIB_OPTIONS,
28+
nargs="*",
2429
help="The nuclear data libraries to search through when searching for \
2530
cross sections. Multiple libaries are acceptable and will be \
2631
preferentially utilized in the order provided",
2732
default=[],
28-
required=True
33+
required=True,
2934
)
3035
parser.add_argument(
31-
'-i', '--isotopes',
32-
nargs='*',
36+
"-i",
37+
"--isotopes",
38+
nargs="*",
3339
default=[],
34-
help="The isotope or isotopes to download, name of isotope e.g. 'Al27' or keyword 'all' or 'stable'"
40+
help="The isotope or isotopes to download, name of isotope e.g. 'Al27' or keyword 'all' or 'stable'",
3541
)
3642
parser.add_argument(
37-
'-s',
38-
'--sab',
39-
nargs='*',
43+
"-s",
44+
"--sab",
45+
nargs="*",
4046
default=[],
41-
help="The SaB cross sections to download. Options include " +
42-
" ".join(SAB_OPTIONS))
47+
help="The SaB cross sections to download. Options include "
48+
+ " ".join(SAB_OPTIONS),
49+
)
4350

4451
parser.add_argument(
45-
'-e', '--elements', nargs='*',
52+
"-e",
53+
"--elements",
54+
nargs="*",
4655
default=[],
47-
help="The element or elements to download, name of element e.g. 'Al' or keyword 'all' or 'stable'"
56+
help="The element or elements to download, name of element e.g. 'Al' or keyword 'all' or 'stable'",
4857
)
4958
parser.add_argument(
50-
'-p', '--particles', nargs='*',
51-
default=['neutron'],
52-
choices=['neutron', 'photon'],
59+
"-p",
60+
"--particles",
61+
nargs="*",
62+
default=["neutron"],
63+
choices=["neutron", "photon"],
5364
help="The particle to download",
5465
)
5566
parser.add_argument(
56-
'-m', '--materials_xml',
57-
nargs='*',
67+
"-m",
68+
"--materials_xml",
69+
nargs="*",
5870
default=[],
5971
help="The filename of the materials.xml file to \
60-
provide cross sections for"
72+
provide cross sections for",
6173
)
6274
parser.add_argument(
63-
'-d', '--destination',
64-
type=Path, default=None,
65-
help='Directory to create new library in'
75+
"-d",
76+
"--destination",
77+
type=Path,
78+
default=None,
79+
help="Directory to create new library in",
6680
)
6781

6882
parser.add_argument(
69-
'--overwrite',
70-
action='store_true',
71-
help='Exiting files will be overwritten'
83+
"--overwrite", action="store_true", help="Exiting files will be overwritten"
7284
)
7385

7486
parser.add_argument(
75-
'--no-overwrite',
76-
action='store_false',
77-
help='Exiting files will not be overwritten'
87+
"--no-overwrite",
88+
action="store_false",
89+
help="Exiting files will not be overwritten",
7890
)
7991

8092
parser.set_defaults(overwrite=False)
@@ -89,5 +101,9 @@
89101
materials_xml=args.materials_xml,
90102
particles=args.particles,
91103
set_OPENMC_CROSS_SECTIONS=False,
92-
overwrite=args.overwrite
104+
overwrite=args.overwrite,
93105
)
106+
107+
108+
if __name__ == "__main__":
109+
main()

0 commit comments

Comments
 (0)