Skip to content

Commit

Permalink
Merge pull request #82 from ken-lauer/cleanup
Browse files Browse the repository at this point in the history
REF/CLN: switch to pyproject.toml, setuptools-scm and clean codebase
  • Loading branch information
ChristopherMayes authored Jul 1, 2024
2 parents 0392a48 + df97021 commit 571ffb4
Show file tree
Hide file tree
Showing 74 changed files with 8,392 additions and 9,118 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pytao/_version.py export-subst
.git_archival.txt export-subst
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint
on:
pull_request:
workflow_dispatch:
push:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install pre-commit
run: python -m pip install pre-commit

- name: List Python package versions
run: python -m pip freeze --local

- name: Run pre-commit on all files
shell: bash -l {0}
env:
RUFF_OUTPUT_FORMAT: github
run: |
pre-commit run \
--show-diff-on-failure \
--color=always \
--all-files
22 changes: 9 additions & 13 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,21 @@ jobs:
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: "3.9"
- name: Update pip
run: >-
python -m pip install --upgrade pip
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
python -m pip install --upgrade build
- name: Build a source tarball
run: >-
python -m
build
--sdist
--outdir dist/
.
python -m build --sdist --outdir dist/ .
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ ENV/

# vim
*.swp

pytao/_version.py
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ repos:
args: ["--maxkb=100000"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.8
rev: v0.5.0
hooks:
- id: ruff
args: ["--config", "python/pyproject.toml"]
args: ["--config", "pyproject.toml"]
types_or: [python]
exclude: "^(pytao/_version.py)$"
- id: ruff-format
args: ["--config", "pyproject.toml"]
types_or: [python]
exclude: "^(pytao/_version.py)$"
3 changes: 0 additions & 3 deletions Copyright

This file was deleted.

3 changes: 0 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
include requirements.txt
include LICENSE
include versioneer.py
include pytao/_version.py
44 changes: 30 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
# PyTao

[PyTao]((https://bmad-sim.github.io/pytao/index.html)) is Python interface for [Tao](https://www.classe.cornell.edu/bmad/tao.html), which is based on the Bmad subroutine library for relativistic charged–particle and X-ray simulations in accelerators and storage rings.
[PyTao](<(https://bmad-sim.github.io/pytao/index.html)>) is Python interface for [Tao](https://www.classe.cornell.edu/bmad/tao.html), which is based on the Bmad subroutine library for relativistic charged–particle and X-ray simulations in accelerators and storage rings.

Documentation for Bmad and Tao, as well as information for downloading the code if needed is given on the [Bmad website](https://www.classe.cornell.edu/bmad).


**`Documentation`** |
------------------- |
[![Documentation](https://img.shields.io/badge/pytao-examples-green.svg)](https://bmad-sim.github.io/pytao/examples/basic.html#) |
[![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://bmad-sim.github.io/pytao/dev_docs/api/index.html) |


| **`Documentation`** |
| --------------------------------------------------------------------------------------------------------------------------- |
| [![Documentation](https://img.shields.io/badge/pytao-examples-green.svg)](https://bmad-sim.github.io/pytao/examples/basic/) |
| [![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://bmad-sim.github.io/pytao/api/pytao/) |

## Installation

See the [PyTao installation instructions](https://bmad-sim.github.io/pytao/user_docs/index.html) for details. The preferred installation method is using conda:

```
$ conda install -c conda-forge pytao
conda install -c conda-forge pytao
```

Currently PyTao requires an installed Bmad distribution compiled with the `ACC_ENABLE_SHARED="Y"` flag. This can be set in the `bmad_dist/util/dist_prefs` file.

Currently PyTao requires an installed Bmad distribution compiled with the `ACC_ENABLE_SHARED="Y"` flag. This can be set in the `bmad_dist/util/dist_prefs` file.

## Current Build status and Release Info

Expand All @@ -34,18 +30,38 @@ Currently PyTao requires an installed Bmad distribution compiled with the `ACC_E
</tr>
</table>


| Name | Downloads | Version | Platforms |
| --- | --- | --- | --- |
| Name | Downloads | Version | Platforms |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| [![Conda Recipe](https://img.shields.io/badge/recipe-pytao-green.svg)](https://anaconda.org/conda-forge/pytao) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pytao.svg)](https://anaconda.org/conda-forge/pytao) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/pytao.svg)](https://anaconda.org/conda-forge/pytao) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/pytao.svg)](https://anaconda.org/conda-forge/pytao) |

## Resources

[Bmad website](https://www.classe.cornell.edu/bmad)

## Quickstart

Start a quick pytao session with IPython using:

```
$ pytao -init tao.init
------------------------------------------------------------
Initializing `tao` object with the following: -init tao.init
Type`tao.` and hit tab to see available commands.
------------------------------------------------------------
Python 3.12.0 | packaged by conda-forge | (main, Oct 3 2023, 08:36:57) [Clang 15.0.7 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.18.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: tao
Out[1]: <pytao.interface_commands.Tao at 0x13c43d4f0>
```

Start pytao's GUI from the command-line with:

```
pytao-gui -init tao.init
```

## License

Expand Down
2 changes: 1 addition & 1 deletion dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- python >=3.9
- openPMD-beamphysics
- numpydoc
- bmad >=20240626
- bmad >=20240628.2
- bokeh
- jupyterlab>3
- ipywidgets
Expand Down
9 changes: 0 additions & 9 deletions docs-requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions overrides/main.html → docs/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

{% block content %}
{% if page.nb_url %}
<a href="{{ page.nb_url }}" title="Download Notebook" class="md-content__button md-icon">
<a href="{{ page.nb_url }}" title="Download Notebook" class="md-content__button md-icon" style="float: inherit;">
<img src="https://img.shields.io/badge/download-notebook-blue.svg" alt="Download Notebook"/>
</a>
{% endif %}

{{ super() }}
{% endblock content %}
{% endblock content %}
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- ipykernel
- ipywidgets
- jupyterlab
- bmad >=20240626
- bmad >=20240628.2
- openPMD-beamphysics
- numpy
- h5py
Expand Down
Loading

0 comments on commit 571ffb4

Please sign in to comment.