Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:fusion-energy/paramak into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Aug 11, 2021
2 parents e49940a + a2516f8 commit 7ad70b5
Show file tree
Hide file tree
Showing 45 changed files with 249 additions and 297 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
- run:
name: run shape tests
command:
pytest tests/test_Shape.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
pytest tests/test_shape.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml

- run:
name: run Reactor tests
command:
pytest tests/test_Reactor.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
pytest tests/test_reactor.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml

- run:
name: run parametric_shapes tests
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci_with_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ jobs:
- name: run tests
run: |
bash run_tests.sh
curl -s https://codecov.io/bash
29 changes: 0 additions & 29 deletions azure-pipelines.yml

This file was deleted.

27 changes: 19 additions & 8 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% set name = "paramak" %}
{% set version = "0.2.3" %}
{% set data = load_setup_py_data() %}

package:
name: "{{ name|lower }}"
version: "{{ version }}"
version: {{ data.get('version') }}

source:
path: ..
Expand All @@ -14,7 +14,7 @@ build:

requirements:
build:
- python 3.8
- python {{ python }}
- setuptools
run:
- cadquery
Expand All @@ -27,10 +27,12 @@ requirements:
- python
- scipy
- sympy
- remove_dagmc_tags
- nbformat
- nbconvert
# - jupyter-cadquery
- ipywidgets
- remove_dagmc_tags
- moab
# - jupyter-cadquery not avaialbe on conda

test:
imports:
Expand All @@ -46,16 +48,25 @@ test:
- tests/
- examples/
commands:
- pytest -v
- pytest -v tests/test_example_components.py
- pytest -v tests/test_example_reactors.py
- pytest -v tests/test_example_shapes.py
- pytest -v tests/test_parametric_components
- pytest -v tests/test_parametric_reactors
- pytest -v tests/test_parametric_shapes
- pytest -v tests/test_reactor.py
- pytest -v tests/test_shape.py
- pytest -v tests/test_utils.py


about:
home: "https://github.com/ukaea/paramak"
home: "https://github.com/fusion-energy/paramak"
license: MIT
license_family: MIT
license_file: LICENSE.txt
summary: "Create 3D fusion reactor CAD models based on input parameters"
doc_url: https://paramak.readthedocs.io/
dev_url: https://github.com/ukaea/paramak
dev_url: https://github.com/fusion-energy/paramak
summary: Paramak - parameter driven fusion reactor model creation

extra:
Expand Down
62 changes: 32 additions & 30 deletions conda_build.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@

#assumes anaconda-client and conda-build have been installed
# conda install anaconda-client
# conda install conda-build
# conda install -y anaconda-client
# conda install -y conda-build
# anaconda login

pkg='paramak'
array=( 3.6 3.7 3.8 )

rm -rf /tmp/conda-build
mkdir -p /tmp/conda-build
rm -rf /tmp/conda-build

for i in "${array[@]}"
do
conda-build conda/ -c cadquery -c conda-forge --croot /tmp/conda-build --python $i
# conda build conda/meta.yaml -c cadquery -c conda-forge --croot /tmp/cbld
done


# # convert package to other platforms
platforms=( osx-64 linux-32 linux-64 win-32 win-64 )
platforms=( linux-64 )
find /tmp/conda-build/linux-64/ -name *.tar.bz2 | while read file
do
echo $file
#conda convert --platform all $file -o $HOME/conda-bld/
for platform in "${platforms[@]}"
do
conda convert --platform $platform $file -o /tmp/conda-build/
done
done


find /tmp/conda-build/ -name *.tar.bz2 | while read file
do
echo $file
anaconda upload $file
done

# VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
VERSION=0.3.2
PLACEHOLDER='version="develop"'
VERSION_FILE='setup.py'
# Grep checks that the placeholder is in the file. If grep doesn't find
# the placeholder then it exits with exit code 1 and github actions fails.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE"

conda-build conda/ -c cadquery -c conda-forge --croot /tmp/conda-build

# converting using all includes quite a few oxs and linux versions (arm arch etc)
# conda convert /tmp/conda-build/linux-64/*.tar.bz2 --platform all -o /tmp/conda-build

# option for converting package to specified platforms
# platforms=( osx-64 linux-32 linux-64 win-32 win-64 )
# find /tmp/conda-build/linux-64/ -name *.tar.bz2 | while read file
# do
# echo $file
# for platform in "${platforms[@]}"
# do
# conda convert --platform $platform $file -o /tmp/conda-build/
# done
# done

anaconda upload -f /tmp/conda-build/*/*.tar.bz2

sed -i "s/version=\"${VERSION}\"/$PLACEHOLDER/g" "$VERSION_FILE"
2 changes: 2 additions & 0 deletions conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
python:
- 3.8
- 3.7
- 3.6
cadquery:
- 2.1
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

# If your documentation needs a minimal Sphinx version, state it here.
#
needs_sphinx = '3.5.4'
needs_sphinx = '4.1.2'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand Down Expand Up @@ -188,3 +188,5 @@


# -- Extension configuration -------------------------------------------------

html_favicon = 'favicon.ico'
Binary file added docs/source/favicon.ico
Binary file not shown.
72 changes: 38 additions & 34 deletions docs/source/paramak.install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,80 @@ Installation
Prerequisites
-------------

To use the paramak tool you will need Python 3 installed using Anaconda or
Miniconda
To use the paramak tool you will need Python 3 installed using Miniconda or
Anaconda

* `Anaconda <https://www.anaconda.com/>`_
* `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`_

Once you have Anaconda or MiniConda installed then CadQuery can be installed
into a new enviroment. A more detailed description of installing Cadquery 2 can
be found here:

* `Cadquery 2 installation <https://cadquery.readthedocs.io/en/latest/installation.html>`_
* `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`_
* `Anaconda <https://www.anaconda.com/>`_

Once you have Anaconda or MiniConda installed then create a new enviroment
(Python 3.6, 3.7 or 3.8 are supported).

First create a new enviroment.

.. code-block:: python
.. code-block:: bash
conda create --name paramak_env python=3.8
Then activate the new enviroment.

.. code-block:: python
.. code-block:: bash
conda activate paramak_env
Then install CadQuery.
Then install the Paramak.

.. code-block:: python
.. code-block:: bash
conda install -c conda-forge -c cadquery cadquery=2.1
conda install -c fusion-energy -c cadquery -c conda-forge paramak
Now you are ready to install the Paramak
Now you should be ready to import paramak from your new python enviroment.

Optional neutronics install
---------------------------

System Installation
-------------------
You can also install optional dependencies that add neutronics capabilities to
the paramak. This will install neutronics_material_maker, OpenMC and DAGMC.
`More details <https://paramak-neutronics.readthedocs.io>`_

The quickest way to install the Paramak is to use pip. In the terminal type...
Developer Installation
----------------------

.. code-block:: bash
If you want to contribute to the paramak or then you might want to install the
package using setup tools.

pip install paramak
Download and install MiniConda, create a new python enviroment and activate the
enviroment as covered in the installation procedure above.

Alternatively you can download the repository using the `download link <https://github.com/fusion-energy/paramak/archive/develop.zip>`_ or clone the repository using:
Then install CadQuery.

.. code-block:: bash
git clone https://github.com/fusion-energy/paramak.git
conda install -c conda-forge -c cadquery cadquery=2.1
Navigate to the paramak repository and within the terminal install the paramak
package and the dependencies using pip3.
Then install moab.

.. code-block:: bash
cd paramak
pip install .
conda install -c conda-forge moab
Alternatively you can install the paramak with the following command.
Then clone the repository

.. code-block:: bash
python setup.py install
git clone https://github.com/fusion-energy/paramak.git
You can also install optional dependencies that add some neutronics
capabilities to the paramak. This will install neutronics_material_maker and
parametric_plasma_source. In addition to this you would need DAGMC, OpenMC,
MOAB and Trelis / Cubit.
`More details <https://paramak-neutronics.readthedocs.io>`_
Navigate to the paramak repository and within the terminal install the paramak
package and the dependencies using pip with e -e (developer option).

.. code-block:: bash
cd paramak
pip install -e .
Docker Image Installation
Expand Down
8 changes: 4 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: docs-environment

channels:
- cadquery
- conda-forge
- cadquery

dependencies:
- cadquery=2.1
Expand All @@ -12,12 +12,12 @@ dependencies:
- numpy
- matplotlib
- pillow
- moab
- moab=5.3.0
- remove_dagmc_tags
- pip:
- remove_dagmc_tags
- sympy
- plasmaboundaries
- sphinx-autodoc-typehints
- sphinxcadquery
- defusedxml

- jupyter-cadquery
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"from matplotlib.pyplot import plasma\n",
Expand Down Expand Up @@ -50,18 +48,23 @@
" filename=filename,\n",
" projectionDir=(5,-5,0),\n",
" showHidden=True,\n",
" )\n",
"\n",
"subprocess.check_call(\n",
" [\"convert\", \"-delay\", \"40\", \"random_offset_*.svg\", \"random_offsets.gif\"])\n"
]
" )\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"source": [
"# The following command requres imagemagick installed to convert the svg files into a gif animation\n",
"# further details https://imagemagick.org/index.php\n",
"\n",
"# subprocess.check_call(\n",
"# [\"convert\", \"-delay\", \"40\", \"random_offset_*.svg\", \"random_offsets.gif\"])\n"
],
"outputs": [],
"source": []
"metadata": {}
}
],
"metadata": {
Expand All @@ -85,4 +88,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Loading

0 comments on commit 7ad70b5

Please sign in to comment.