Skip to content

Commit

Permalink
Merge eb0e12b into 2dab122
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Sep 18, 2023
2 parents 2dab122 + eb0e12b commit 58055ad
Show file tree
Hide file tree
Showing 24 changed files with 377 additions and 424 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Expand Up @@ -32,4 +32,4 @@

- [ ] The [release notes](https://terrapower.github.io/armi/release/index.html) (location `doc/release/0.X.rst`) are up-to-date with any important changes.
- [ ] The documentation is still up-to-date in the `doc` folder.
- [ ] The dependencies are still up-to-date in `setup.py`.
- [ ] The dependencies are still up-to-date in `pyproject.toml`.
39 changes: 22 additions & 17 deletions .github/workflows/validatemanifest.py
Expand Up @@ -13,39 +13,44 @@
# limitations under the License.

"""
Validating the MANIFEST.in.
Validating the package-data in the pyproject.toml.
Currently, the only validation we do of the MANIFEST.in file is to make sure
that we are trying to include files that don't exist.
Validate that we aren't trying to include files that don't exist.
"""

from glob import glob
import os

import toml

# CONSTANTS
INCLUDE_STR = "include "
MANIFEST_PATH = "MANIFEST.in"
ARMI_DIR = "armi/"
PRPROJECT = "pyproject.toml"


def main():
# loop through each line in the manifest file and find all the file paths
errors = []
lines = open(MANIFEST_PATH, "r", encoding="utf-8")
for i, line in enumerate(lines):
# if this is anything but an include line, move on
if not line.startswith(INCLUDE_STR):
continue
# parse the data files out of the pyproject.toml
txt = open(PRPROJECT, "r").read()
data = toml.loads(txt)
fileChunks = data["tool"]["setuptools"]["package-data"]["armi"]

# loop through each line in the package-data and find all the file paths
errors = []
for i, line in enumerate(fileChunks):
# make sure the file exists
path = line.strip()[len(INCLUDE_STR) :]
if not os.path.exists(path):
errors.append((i, path))
path = ARMI_DIR + line.strip()
if "*" in path:
paths = [f for f in glob(path) if len(f) > 3]
if not len(paths):
errors.append((i, path))
else:
if not os.path.exists(path):
errors.append((i, path))

# If there were any missing files, raise an Error.
if errors:
for (i, line) in errors:
print("Nonexistant file on line {}: {}".format(i, line))
raise ValueError("MANIFEST file is incorrect: includes non-existant files.")
raise ValueError("Package-data file is incorrect: includes non-existant files.")


if __name__ == "__main__":
Expand Down
70 changes: 0 additions & 70 deletions MANIFEST.in

This file was deleted.

11 changes: 4 additions & 7 deletions README.rst
Expand Up @@ -72,22 +72,21 @@ dependencies could conflict with your system dependencies.

$ git clone https://github.com/terrapower/armi
$ cd armi
$ pip3 install -r requirements.txt
$ python3 setup.py install
$ pip install -e .
$ armi

The easiest way to run the tests is to install `tox <https://tox.readthedocs.io/en/latest/>`_
and then run::

$ pip3 install -r requirements-testing.txt
$ pip install -e .[test]
$ tox -- -n 6

This runs the unit tests in parallel on 6 processes. Omit the ``-n 6`` argument
to run on a single process.

The tests can also be run directly, using ``pytest``::

$ pip3 install -r requirements-testing.txt
$ pip install -e .[test]
$ pytest -n 4 armi

From here, we recommend going through a few of our `gallery examples
Expand Down Expand Up @@ -313,7 +312,6 @@ see if their idea has wings, and if it does, they can then find a way to bring
it to engineering and commercial reality.



History of ARMI
---------------
ARMI was originally created by TerraPower, LLC near Seattle WA starting in 2009. Its
Expand Down Expand Up @@ -397,7 +395,6 @@ Most of our code is in the ``camelCase`` style, which is not the normal style fo
Python. This started in 2009 and we have stuck with the convention.



License
-------
TerraPower and ARMI are registered trademarks of TerraPower, LLC.
Expand All @@ -422,7 +419,7 @@ The ARMI system is licensed as follows:
See the License for the specific language governing permissions and
limitations under the License.
Be careful when including any dependency in ARMI (say in a requirements.txt file) not
Be careful when including any dependency in ARMI (say in the ``pyproject.toml`` file) not
to include anything with a license that superceeds our Apache license. For instance,
any third-party Python library included in ARMI with a GPL license will make the whole
project fall under the GPL license. But a lot of potential users of ARMI will want to
Expand Down
8 changes: 7 additions & 1 deletion armi/meta.py
Expand Up @@ -13,5 +13,11 @@
# limitations under the License.

"""Metadata describing an ARMI distribution."""
try:
# Python 3.x < 3.8
from importlib import metadata
except ImportError:
# Python >= 3.8
import importlib_metadata as metadata

__version__ = "0.2.8"
__version__ = metadata.version("armi")
1 change: 0 additions & 1 deletion armi/reactor/blueprints/reactorBlueprint.py
Expand Up @@ -126,7 +126,6 @@ def construct(self, cs, bp, reactor, geom=None, loadAssems=True):

runLog.info("Constructing the `{}`".format(self.name))

# TODO: We should consider removing automatic geom file migration.
if geom is not None and self.name == "core":
gridDesign = geom.toGridBlueprints("core")[0]
else:
Expand Down
18 changes: 6 additions & 12 deletions armi/reactor/reactors.py
Expand Up @@ -801,7 +801,6 @@ def getNumAssembliesWithAllRingsFilledOut(self, nRings):
nAssmWithBlanks: int
The number of assemblies that WOULD exist in this core if
all outer assembly hex rings were "filled out".
"""
if self.powerMultiplier == 1:
return 3 * nRings * (nRings - 1) + 1
Expand Down Expand Up @@ -846,9 +845,8 @@ def countBlocksWithFlags(self, blockTypeSpec, assemTypeSpec=None):
return 0

def countFuelAxialBlocks(self):
r"""
return the maximum number of fuel type blocks in any assembly in
the reactor.
"""
Return the maximum number of fuel type blocks in any assembly in the core.
See Also
--------
Expand Down Expand Up @@ -945,7 +943,6 @@ def getMaxAssembliesInHexRing(self, ring, fullCore=False):
-----
Assumes that odd rings do not have an edge assembly in third core geometry.
These should be removed in: self._modifyGeometryAfterLoad during importGeom
"""
numAssemsUpToOuterRing = self.getNumAssembliesWithAllRingsFilledOut(ring)
numAssemsUpToInnerRing = self.getNumAssembliesWithAllRingsFilledOut(ring - 1)
Expand Down Expand Up @@ -1033,7 +1030,6 @@ def getAssembliesInCircularRing(
-------
assems : list of assemblies
A list of assemblies that match the criteria within the ring
"""
if self.geomType == geometry.GeomType.CARTESIAN:
# a ring in cartesian is basically a square.
Expand Down Expand Up @@ -2177,7 +2173,7 @@ def getMinimumPercentFluxInFuel(self, target=0.005):
return targetRing, fluxFraction

def getAvgTemp(self, typeSpec, blockList=None, flux2Weight=False):
r"""
"""
get the volume-average fuel, cladding, coolant temperature in core.
Parameters
Expand All @@ -2197,7 +2193,6 @@ def getAvgTemp(self, typeSpec, blockList=None, flux2Weight=False):
-------
avgTemp : float
The average temperature in C.
"""
num = 0.0
denom = 0.0
Expand Down Expand Up @@ -2255,7 +2250,7 @@ def getAllNuclidesIn(self, mats):
return list(allNucNames)

def growToFullCore(self, cs):
r"""Copies symmetric assemblies to build a full core model out of a 1/3 core model.
"""Copies symmetric assemblies to build a full core model out of a 1/3 core model.
Returns
-------
Expand All @@ -2280,7 +2275,7 @@ def setPitchUniform(self, pitchInCm):
self.spatialGrid.changePitch(pitchInCm)

def calcBlockMaxes(self):
r"""
"""
Searches all blocks for maximum values of key params.
See Also
Expand Down Expand Up @@ -2320,7 +2315,7 @@ def calcBlockMaxes(self):
)

def getFuelBottomHeight(self):
r"""
"""
Obtain the height of the lowest fuel in the core.
This is the "axial coordinate shift" between ARMI and SASSYS.
Expand All @@ -2331,7 +2326,6 @@ def getFuelBottomHeight(self):
-------
lowestFuelHeightInCm : float
The height (cm) of the lowest fuel in this core model.
"""
lowestFuelHeightInCm = self[0].getHeight()
fuelBottoms = []
Expand Down
6 changes: 3 additions & 3 deletions armi/runLog.py
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

r"""
"""
This module handles logging of console during a simulation.
The default way of calling and the global armi logger is to just import it:
Expand Down Expand Up @@ -44,7 +44,6 @@
runLog.setVerbosity('debug')
"""
from __future__ import print_function
from glob import glob
import collections
import logging
Expand All @@ -70,7 +69,8 @@

class _RunLog:
"""
Handles all the logging
Handles all the logging.
For the parent process, things are allowed to print to stdout and stderr,
but the stdout prints are formatted like log statements.
For the child processes, everything is piped to log files.
Expand Down
6 changes: 3 additions & 3 deletions armi/utils/dochelpers.py
Expand Up @@ -31,7 +31,7 @@


def create_figure(path, caption=None, align=None, alt=None, width=None):
r"""
"""
This method is available within ``.. exec::``. It allows someone to create a figure with a
caption.
"""
Expand All @@ -50,7 +50,7 @@ def create_figure(path, caption=None, align=None, alt=None, width=None):


def create_table(rst_table, caption=None, align=None, widths=None, width=None):
r"""
"""
This method is available within ``.. exec::``. It allows someone to create a table with a
caption.
Expand Down Expand Up @@ -119,7 +119,7 @@ def usermethod():


class PyReverse(Directive):
r"""Runs pyreverse to generate UML for specified module name and options.
"""Runs pyreverse to generate UML for specified module name and options.
The directive accepts the same arguments as pyreverse, except you should not specify
``--project`` or ``-o`` (output format). These are automatically specified.
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Expand Up @@ -91,7 +91,7 @@ def autodoc_skip_member_handler(app, what, name, obj, skip, options):


def setup(app):
"""Method to make `python setup.py build_sphinx` generate api documentation."""
"""Method to make `make html` generate api documentation."""
app.connect("autodoc-skip-member", autodoc_skip_member_handler)

app.add_domain(PatchedPythonDomain, override=True)
Expand Down
2 changes: 1 addition & 1 deletion doc/developer/documenting.rst
Expand Up @@ -21,7 +21,7 @@ Building the documentation
Before building documentation, ensure that you have installed the test requirements into
your ARMI virtual environment with::

pip3 install -r requirements-testing.txt
pip install -e .[test]

You also need to have the following utilities available in your PATH:

Expand Down
6 changes: 3 additions & 3 deletions doc/developer/first_time_contributors.rst
Expand Up @@ -30,15 +30,15 @@ new your code does.

The standard way to run the tests is to install and use `tox <https://tox.readthedocs.io/en/latest/>`_::

$ pip3 install tox
$ pip install tox
$ tox -- -n 6

This runs the unit tests in parallel on 6 processes. Omit the ``-n 6`` argument
to run on a single process.

Or the tests can also be run using ``pytest`` directly::

$ pip3 install -r requirements-testing.txt
$ pip intall -e .[test]
$ pytest -n 4 armi

Submitting Changes
Expand Down Expand Up @@ -66,7 +66,7 @@ Also, please check out our (quick) synopsis on :doc:`good commit messages </deve
Licensing of Tools
==================

Be careful when including any dependency in ARMI (say in a ``requirements.txt`` file) not
Be careful when including any dependency in ARMI (say in the ``pyproject.toml`` file) not
to include anything with a license that superceeds our Apache license. For instance,
any third-party Python library included in ARMI with a GPL license will make the whole
project fall under the GPL license. But a lot of potential users of ARMI will want to
Expand Down

0 comments on commit 58055ad

Please sign in to comment.