Repository: CORE-GATECH-GROUP/serpent-tools (language: python)

Issue:
CI Auto-deploy wheel and source distribution to pypi on release
When we make a tag or a release, we need to then upload something to [pypi](https://pypi.org/project/serpentTools/) so people can install with `pip install --upgrade serpentTools`

It would be beneficial and more efficient if github could perform this automatically for us for new tags. There are a few things to consider
1. Running specific github actions for tags, not pushes to main / pull requests - [github docs might be helpful](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore)
2. Build wheel with `pip wheel --no-deps .` to create `serpentTools-TAG-py3-none-any.whl`
3. Upload that to `pypi` using twine

Some caveats / things to look out for

## setuptools_scm
I'm not sure  how the tag will get propagated into the action, and we need the tag to work with `setuptools_scm` version setting - #500. There's the ability to force a version with environment variables `SETUPTOOLS_SCM_PRETEND_VERSION` or `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_serpentTools`. If one of these environment variables are present in the job, and set to the tag name (maybe exposed from github?) the wheel should have the correct version

## pypi authentication

It's recommended to use api tokens to upload to pypi with twine. But, we *must not* expose this token in any file tracked in this repository. Otherwise, someone could pull the token and upload a fake version to pypi.

I think there's a way to do this with [github actions secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets), where the api token for pypi could be added to the project (maybe via settings or security?) and then exposed to the action. Then, we could do something like
```shell
twine upload --username __token__ --password ${SERPENT_TOOLS_TWINE_API_TOKEN} serpentTools-0.11.0.whl
```
the `.whl` wheel file is a made up name, and same with the environment variable `SERPENT_TOOLS_TWINE_API_TOKEN`. But something like that could be exposed to the workflow.

We'd also want to make sure that that token *is not* exposed to any other jobs, nor printed in any jobs, so that it doesn't leak out.

- https://pypi.org/help/#publishing
- https://pypi.org/help/#apitoken
- https://docs.github.com/en/actions/security-guides/encrypted-secrets
- https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
DEV Move to a src-style layout
              Bingo, https://github.com/CORE-GATECH-GROUP/serpent-tools/actions/runs/5790729681/job/15694326728?pr=493 shows that we're not _really_ installing the package in CI when we do `pip install .`

When we force the CI to do e.g., `cd /tmp` and then import serpent-tools, we get an error that the module isn't found. The usual fix for this is to move source files from `serpentTools` to `src/serpentTools`, but there has to be a better fix.

_Originally posted by @drewejohnson in https://github.com/CORE-GATECH-GROUP/serpent-tools/issues/493#issuecomment-1668700092_
            


Discussion / hints:
This could complicate conda installs #385 because we don't have a `setup.py` file with `setuptools` to do `python setup.py sdist` and create and upload a source dist to `pypi`. This is what was used in some preliminary `conda` build tests, where the builder would pull a source distribution from pypi. It might work with a wheel file though, since we just need _something_ to pass to `pip` for building, and pip can build from wheels too
Helpful links - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#src-layout

Fix patch:
diff --git a/MANIFEST.in b/MANIFEST.in
index 334ac1c8..4bbe4332 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,3 @@
-include versioneer.py
-include serpentTools/_version.py
-include serpentTools/variables.yaml
-include serpentTools/data/*.m
-include serpentTools/data/*.coe
+include src/serpentTools/variables.yaml
+include src/serpentTools/data/*.m
+include src/serpentTools/data/*.coe
diff --git a/docs/examples/nodal_writer.py b/docs/examples/nodal_writer.py
deleted file mode 120000
index b9bf8ca4..00000000
--- a/docs/examples/nodal_writer.py
+++ /dev/null
@@ -1,1 +0,0 @@
-../examples/nodal_writer.py
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 9afedd63..49f5b2f0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -50,7 +50,7 @@ serpentTools = ["variables.yaml"]
 "serpentTools.data" = ["*.m", "*.coe"]
 
 [tool.setuptools.packages.find]
-where = ["serpentTools"]
+where = ["src"]
 
 # This is okay to be empty, but we need a section here
 # in order to trigger it's usage when setting version data
diff --git a/serpentTools/__init__.py b/src/serpentTools/__init__.py
similarity index 100%
rename from serpentTools/__init__.py
rename to src/serpentTools/__init__.py
diff --git a/serpentTools/__main__.py b/src/serpentTools/__main__.py
similarity index 100%
rename from serpentTools/__main__.py
rename to src/serpentTools/__main__.py
diff --git a/serpentTools/data/InnerAssembly_res.m b/src/serpentTools/data/InnerAssembly_res.m
similarity index 100%
rename from serpentTools/data/InnerAssembly_res.m
rename to src/serpentTools/data/InnerAssembly_res.m
diff --git a/serpentTools/data/__init__.py b/src/serpentTools/data/__init__.py
similarity index 100%
rename from serpentTools/data/__init__.py
rename to src/serpentTools/data/__init__.py
diff --git a/serpentTools/data/bwr_0_dep.m b/src/serpentTools/data/bwr_0_dep.m
similarity index 100%
rename from serpentTools/data/bwr_0_dep.m
rename to src/serpentTools/data/bwr_0_dep.m
diff --git a/serpentTools/data/bwr_0_det0.m b/src/serpentTools/data/bwr_0_det0.m
similarity index 100%
rename from serpentTools/data/bwr_0_det0.m
rename to src/serpentTools/data/bwr_0_det0.m
diff --git a/serpentTools/data/bwr_1_dep.m b/src/serpentTools/data/bwr_1_dep.m
similarity index 100%
rename from serpentTools/data/bwr_1_dep.m
rename to src/serpentTools/data/bwr_1_dep.m
diff --git a/serpentTools/data/bwr_1_det0.m b/src/serpentTools/data/bwr_1_det0.m
similarity index 100%
rename from serpentTools/data/bwr_1_det0.m
rename to src/serpentTools/data/bwr_1_det0.m
diff --git a/serpentTools/data/bwr_badInventory_dep.m b/src/serpentTools/data/bwr_badInventory_dep.m
similarity index 100%
rename from serpentTools/data/bwr_badInventory_dep.m
rename to src/serpentTools/data/bwr_badInventory_dep.m
diff --git a/serpentTools/data/bwr_det0.m b/src/serpentTools/data/bwr_det0.m
similarity index 100%
rename from serpentTools/data/bwr_det0.m
rename to src/serpentTools/data/bwr_det0.m
diff --git a/serpentTools/data/bwr_his0.m b/src/serpentTools/data/bwr_his0.m
similarity index 100%
rename from serpentTools/data/bwr_his0.m
rename to src/serpentTools/data/bwr_his0.m
diff --git a/serpentTools/data/bwr_longT_dep.m b/src/serpentTools/data/bwr_longT_dep.m
similarity index 100%
rename from serpentTools/data/bwr_longT_dep.m
rename to src/serpentTools/data/bwr_longT_dep.m
diff --git a/serpentTools/data/bwr_missingT_dep.m b/src/serpentTools/data/bwr_missingT_dep.m
similarity index 100%
rename from serpentTools/data/bwr_missingT_dep.m
rename to src/serpentTools/data/bwr_missingT_dep.m
diff --git a/serpentTools/data/bwr_noxy_det0.m b/src/serpentTools/data/bwr_noxy_det0.m
similarity index 100%
rename from serpentTools/data/bwr_noxy_det0.m
rename to src/serpentTools/data/bwr_noxy_det0.m
diff --git a/serpentTools/data/bwr_sens0.m b/src/serpentTools/data/bwr_sens0.m
similarity index 100%
rename from serpentTools/data/bwr_sens0.m
rename to src/serpentTools/data/bwr_sens0.m
diff --git a/serpentTools/data/bwr_smallxy_det0.m b/src/serpentTools/data/bwr_smallxy_det0.m
similarity index 100%
rename from serpentTools/data/bwr_smallxy_det0.m
rename to src/serpentTools/data/bwr_smallxy_det0.m
diff --git a/serpentTools/data/demo.coe b/src/serpentTools/data/demo.coe
similarity index 100%
rename from serpentTools/data/demo.coe
rename to src/serpentTools/data/demo.coe
diff --git a/serpentTools/data/demo_dep.m b/src/serpentTools/data/demo_dep.m
similarity index 100%
rename from serpentTools/data/demo_dep.m
rename to src/serpentTools/data/demo_dep.m
diff --git a/serpentTools/data/demo_uncs.coe b/src/serpentTools/data/demo_uncs.coe
similarity index 100%
rename from serpentTools/data/demo_uncs.coe
rename to src/serpentTools/data/demo_uncs.coe
diff --git a/serpentTools/data/depmtx_ref.m b/src/serpentTools/data/depmtx_ref.m
similarity index 100%
rename from serpentTools/data/depmtx_ref.m
rename to src/serpentTools/data/depmtx_ref.m
diff --git a/serpentTools/data/flattop_sens.m b/src/serpentTools/data/flattop_sens.m
similarity index 100%
rename from serpentTools/data/flattop_sens.m
rename to src/serpentTools/data/flattop_sens.m
diff --git a/serpentTools/data/fuelPin_det0.m b/src/serpentTools/data/fuelPin_det0.m
similarity index 100%
rename from serpentTools/data/fuelPin_det0.m
rename to src/serpentTools/data/fuelPin_det0.m
diff --git a/serpentTools/data/hexplot_det0.m b/src/serpentTools/data/hexplot_det0.m
similarity index 100%
rename from serpentTools/data/hexplot_det0.m
rename to src/serpentTools/data/hexplot_det0.m
diff --git a/serpentTools/data/plut_xs0.m b/src/serpentTools/data/plut_xs0.m
similarity index 100%
rename from serpentTools/data/plut_xs0.m
rename to src/serpentTools/data/plut_xs0.m
diff --git a/serpentTools/data/pwr_emptyAttributes_res.m b/src/serpentTools/data/pwr_emptyAttributes_res.m
similarity index 100%
rename from serpentTools/data/pwr_emptyAttributes_res.m
rename to src/serpentTools/data/pwr_emptyAttributes_res.m
diff --git a/serpentTools/data/pwr_filter_res.m b/src/serpentTools/data/pwr_filter_res.m
similarity index 100%
rename from serpentTools/data/pwr_filter_res.m
rename to src/serpentTools/data/pwr_filter_res.m
diff --git a/serpentTools/data/pwr_noBU_res.m b/src/serpentTools/data/pwr_noBU_res.m
similarity index 100%
rename from serpentTools/data/pwr_noBU_res.m
rename to src/serpentTools/data/pwr_noBU_res.m
diff --git a/serpentTools/data/pwr_noUniv_res.m b/src/serpentTools/data/pwr_noUniv_res.m
similarity index 100%
rename from serpentTools/data/pwr_noUniv_res.m
rename to src/serpentTools/data/pwr_noUniv_res.m
diff --git a/serpentTools/data/pwr_res.m b/src/serpentTools/data/pwr_res.m
similarity index 100%
rename from serpentTools/data/pwr_res.m
rename to src/serpentTools/data/pwr_res.m
diff --git a/serpentTools/data/radplot_det0.m b/src/serpentTools/data/radplot_det0.m
similarity index 100%
rename from serpentTools/data/radplot_det0.m
rename to src/serpentTools/data/radplot_det0.m
diff --git a/serpentTools/data/ref_branch.coe b/src/serpentTools/data/ref_branch.coe
similarity index 100%
rename from serpentTools/data/ref_branch.coe
rename to src/serpentTools/data/ref_branch.coe
diff --git a/serpentTools/data/ref_dep.m b/src/serpentTools/data/ref_dep.m
similarity index 100%
rename from serpentTools/data/ref_dep.m
rename to src/serpentTools/data/ref_dep.m
diff --git a/serpentTools/data/ref_det0.m b/src/serpentTools/data/ref_det0.m
similarity index 100%
rename from serpentTools/data/ref_det0.m
rename to src/serpentTools/data/ref_det0.m
diff --git a/serpentTools/data/ref_mdx0.m b/src/serpentTools/data/ref_mdx0.m
similarity index 100%
rename from serpentTools/data/ref_mdx0.m
rename to src/serpentTools/data/ref_mdx0.m
diff --git a/serpentTools/data/ref_noXS_mdx0.m b/src/serpentTools/data/ref_noXS_mdx0.m
similarity index 100%
rename from serpentTools/data/ref_noXS_mdx0.m
rename to src/serpentTools/data/ref_noXS_mdx0.m
diff --git a/serpentTools/data/time_det0.m b/src/serpentTools/data/time_det0.m
similarity index 100%
rename from serpentTools/data/time_det0.m
rename to src/serpentTools/data/time_det0.m
diff --git a/serpentTools/detectors.py b/src/serpentTools/detectors.py
similarity index 100%
rename from serpentTools/detectors.py
rename to src/serpentTools/detectors.py
diff --git a/serpentTools/engines.py b/src/serpentTools/engines.py
similarity index 100%
rename from serpentTools/engines.py
rename to src/serpentTools/engines.py
diff --git a/serpentTools/io/__init__.py b/src/serpentTools/io/__init__.py
similarity index 100%
rename from serpentTools/io/__init__.py
rename to src/serpentTools/io/__init__.py
diff --git a/serpentTools/io/base.py b/src/serpentTools/io/base.py
similarity index 100%
rename from serpentTools/io/base.py
rename to src/serpentTools/io/base.py
diff --git a/serpentTools/io/hooks.py b/src/serpentTools/io/hooks.py
similarity index 100%
rename from serpentTools/io/hooks.py
rename to src/serpentTools/io/hooks.py
diff --git a/serpentTools/messages.py b/src/serpentTools/messages.py
similarity index 100%
rename from serpentTools/messages.py
rename to src/serpentTools/messages.py
diff --git a/serpentTools/objects/__init__.py b/src/serpentTools/objects/__init__.py
similarity index 100%
rename from serpentTools/objects/__init__.py
rename to src/serpentTools/objects/__init__.py
diff --git a/serpentTools/objects/base.py b/src/serpentTools/objects/base.py
similarity index 100%
rename from serpentTools/objects/base.py
rename to src/serpentTools/objects/base.py
diff --git a/serpentTools/objects/containers.py b/src/serpentTools/objects/containers.py
similarity index 100%
rename from serpentTools/objects/containers.py
rename to src/serpentTools/objects/containers.py
diff --git a/serpentTools/objects/detectors.py b/src/serpentTools/objects/detectors.py
similarity index 100%
rename from serpentTools/objects/detectors.py
rename to src/serpentTools/objects/detectors.py
diff --git a/serpentTools/objects/materials.py b/src/serpentTools/objects/materials.py
similarity index 100%
rename from serpentTools/objects/materials.py
rename to src/serpentTools/objects/materials.py
diff --git a/serpentTools/objects/xsdata.py b/src/serpentTools/objects/xsdata.py
similarity index 100%
rename from serpentTools/objects/xsdata.py
rename to src/serpentTools/objects/xsdata.py
diff --git a/serpentTools/parsers/__init__.py b/src/serpentTools/parsers/__init__.py
similarity index 100%
rename from serpentTools/parsers/__init__.py
rename to src/serpentTools/parsers/__init__.py
diff --git a/serpentTools/parsers/_collections.py b/src/serpentTools/parsers/_collections.py
similarity index 100%
rename from serpentTools/parsers/_collections.py
rename to src/serpentTools/parsers/_collections.py
diff --git a/serpentTools/parsers/base.py b/src/serpentTools/parsers/base.py
similarity index 100%
rename from serpentTools/parsers/base.py
rename to src/serpentTools/parsers/base.py
diff --git a/serpentTools/parsers/branching.py b/src/serpentTools/parsers/branching.py
similarity index 100%
rename from serpentTools/parsers/branching.py
rename to src/serpentTools/parsers/branching.py
diff --git a/serpentTools/parsers/bumat.py b/src/serpentTools/parsers/bumat.py
similarity index 100%
rename from serpentTools/parsers/bumat.py
rename to src/serpentTools/parsers/bumat.py
diff --git a/serpentTools/parsers/depletion.py b/src/serpentTools/parsers/depletion.py
similarity index 100%
rename from serpentTools/parsers/depletion.py
rename to src/serpentTools/parsers/depletion.py
diff --git a/serpentTools/parsers/depmatrix.py b/src/serpentTools/parsers/depmatrix.py
similarity index 100%
rename from serpentTools/parsers/depmatrix.py
rename to src/serpentTools/parsers/depmatrix.py
diff --git a/serpentTools/parsers/detector.py b/src/serpentTools/parsers/detector.py
similarity index 100%
rename from serpentTools/parsers/detector.py
rename to src/serpentTools/parsers/detector.py
diff --git a/serpentTools/parsers/fissionMatrix.py b/src/serpentTools/parsers/fissionMatrix.py
similarity index 100%
rename from serpentTools/parsers/fissionMatrix.py
rename to src/serpentTools/parsers/fissionMatrix.py
diff --git a/serpentTools/parsers/history.py b/src/serpentTools/parsers/history.py
similarity index 100%
rename from serpentTools/parsers/history.py
rename to src/serpentTools/parsers/history.py
diff --git a/serpentTools/parsers/microxs.py b/src/serpentTools/parsers/microxs.py
similarity index 100%
rename from serpentTools/parsers/microxs.py
rename to src/serpentTools/parsers/microxs.py
diff --git a/serpentTools/parsers/results.py b/src/serpentTools/parsers/results.py
similarity index 100%
rename from serpentTools/parsers/results.py
rename to src/serpentTools/parsers/results.py
diff --git a/serpentTools/parsers/sensitivity.py b/src/serpentTools/parsers/sensitivity.py
similarity index 100%
rename from serpentTools/parsers/sensitivity.py
rename to src/serpentTools/parsers/sensitivity.py
diff --git a/serpentTools/parsers/xsplot.py b/src/serpentTools/parsers/xsplot.py
similarity index 100%
rename from serpentTools/parsers/xsplot.py
rename to src/serpentTools/parsers/xsplot.py
diff --git a/serpentTools/plot.py b/src/serpentTools/plot.py
similarity index 100%
rename from serpentTools/plot.py
rename to src/serpentTools/plot.py
diff --git a/serpentTools/samplers/__init__.py b/src/serpentTools/samplers/__init__.py
similarity index 100%
rename from serpentTools/samplers/__init__.py
rename to src/serpentTools/samplers/__init__.py
diff --git a/serpentTools/samplers/base.py b/src/serpentTools/samplers/base.py
similarity index 100%
rename from serpentTools/samplers/base.py
rename to src/serpentTools/samplers/base.py
diff --git a/serpentTools/samplers/depletion.py b/src/serpentTools/samplers/depletion.py
similarity index 100%
rename from serpentTools/samplers/depletion.py
rename to src/serpentTools/samplers/depletion.py
diff --git a/serpentTools/samplers/detector.py b/src/serpentTools/samplers/detector.py
similarity index 100%
rename from serpentTools/samplers/detector.py
rename to src/serpentTools/samplers/detector.py
diff --git a/serpentTools/seed.py b/src/serpentTools/seed.py
similarity index 100%
rename from serpentTools/seed.py
rename to src/serpentTools/seed.py
diff --git a/serpentTools/settings.py b/src/serpentTools/settings.py
similarity index 100%
rename from serpentTools/settings.py
rename to src/serpentTools/settings.py
diff --git a/serpentTools/utils/__init__.py b/src/serpentTools/utils/__init__.py
similarity index 100%
rename from serpentTools/utils/__init__.py
rename to src/serpentTools/utils/__init__.py
diff --git a/serpentTools/utils/compare.py b/src/serpentTools/utils/compare.py
similarity index 100%
rename from serpentTools/utils/compare.py
rename to src/serpentTools/utils/compare.py
diff --git a/serpentTools/utils/core.py b/src/serpentTools/utils/core.py
similarity index 100%
rename from serpentTools/utils/core.py
rename to src/serpentTools/utils/core.py
diff --git a/serpentTools/utils/docstrings.py b/src/serpentTools/utils/docstrings.py
similarity index 100%
rename from serpentTools/utils/docstrings.py
rename to src/serpentTools/utils/docstrings.py
diff --git a/serpentTools/utils/plot.py b/src/serpentTools/utils/plot.py
similarity index 100%
rename from serpentTools/utils/plot.py
rename to src/serpentTools/utils/plot.py
diff --git a/serpentTools/variables.yaml b/src/serpentTools/variables.yaml
similarity index 100%
rename from serpentTools/variables.yaml
rename to src/serpentTools/variables.yaml
diff --git a/serpentTools/xs.py b/src/serpentTools/xs.py
similarity index 100%
rename from serpentTools/xs.py
rename to src/serpentTools/xs.py


Test patch:
diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml
index 5810f0bf..bcd78c3d 100644
--- a/.github/workflows/testing.yaml
+++ b/.github/workflows/testing.yaml
@@ -49,7 +49,6 @@ jobs:
         # installing. Should be removed with a src-layout
         # https://github.com/CORE-GATECH-GROUP/serpent-tools/issues/499
         run: |
-          export PYTHONPATH=${GITHUB_WORKSPACE}:${PYTHONPATH}
           cd examples
           jupyter execute *ipynb