Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kbonney committed Oct 9, 2023
2 parents f506a7f + 3665a53 commit 91f0e5d
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 17 deletions.
14 changes: 12 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

@nox.session
def tests(session):
"""Run tests."""
session.install(".")
session.install("pytest")
session.run("pytest")

@nox.session
def lint(session):
"""Lint."""
session.install("flake8")
session.run("flake8", "--import-order-style", "google")

@nox.session
def docs(session):
"""Generate documentation."""
session.install(".")
session.install("sphinx")
session.install("sphinx_rtd_theme")
Expand All @@ -22,14 +25,21 @@ def docs(session):

@nox.session
def serve(session):
session.run("python", "-m", "http.server", "-b", "localhost", "-d", "docs/_build/html", "8085")
"""Serve documentation. Port can be specified as a positional argument."""
try:
port = session.posargs[0]
except IndexError:
port = "8085"
session.run("python", "-m", "http.server", "-b", "localhost", "-d", "docs/_build/html", port)

@nox.session
def check_style(session):
"""Check if code follows black style."""
session.install("black")
session.run("black", "--check")
session.run("black", "--check", "src")

@nox.session
def enforce_style(session):
"""Apply black style to code base."""
session.install("black")
session.run("black", "src")
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ test = [
# "matplotlib >=2.0",
# ]

[tool.black]
line-length = 140

[project.urls]
Homepage = "https://github.com/sandialabs/pynumad"
# Documentation = "https://package.readthedocs.io/"
Expand Down
2 changes: 1 addition & 1 deletion src/pynumad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pynumad import analysis
from pynumad import graphics

from pynumad.paths import SOFTWARE_PATHS, DATA_PATH
from pynumad.paths import SOFTWARE_PATHS, DATA_PATH, set_path


__version__ = "0.0.1"
Expand Down
10 changes: 8 additions & 2 deletions src/pynumad/analysis/cubit/connect_cross_sections.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
from cubit import *
from PyCubed_Main import *
import warnings

try:
from cubit import *
from PyCubed_Main import *
except ModuleNotFoundError:
warnings.warn("Cubit not configured, so cubit functionality will not be available.")

from pynumad.analysis.cubit.make_cross_sections import print_sine_curve_between_two_verts
import numpy as np
import re
Expand Down
10 changes: 8 additions & 2 deletions src/pynumad/analysis/cubit/make_cross_sections.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
from cubit import *
from PyCubed_Main import *
import warnings

try:
from cubit import *
from PyCubed_Main import *
except ModuleNotFoundError:
warnings.warn("Cubit not configured, so cubit functionality will not be available.")

import numpy as np
import os

Expand Down
19 changes: 18 additions & 1 deletion src/pynumad/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,21 @@
DATA_PATH = join(package_dir, "..", "data")

with open(join(package_dir, "software_paths.json"), "rt") as f:
SOFTWARE_PATHS = json.load(f)
SOFTWARE_PATHS = json.load(f)

def set_path(path_label, path):
"""_summary_
Parameters
----------
path_label : str
Label of the path to be set.
- "cubit"
- "cubit_enhancements"
- "ansys"
path : str
Value to set label as
"""
SOFTWARE_PATHS[path_label] = path
with open(join(package_dir, "software_paths.json"), "wt") as f:
json.dump(SOFTWARE_PATHS, f, indent=4)
14 changes: 5 additions & 9 deletions src/pynumad/software_paths.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{"numad_path" : "",
"ansys_path" : "",
"cubit" : "",
"cubitEnhancements" : "",
"openFast" : "",
"crunchPath" : "",
"turbsimPath" :"",
"iecwindPath" :"",
"mbcPath" :""
{
"numad": "",
"ansys": "",
"cubit": "",
"cubit_enhancements": ""
}

0 comments on commit 91f0e5d

Please sign in to comment.