Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Build release distributions
run: |
# NOTE: put your own distribution build steps here.
python -m pip install build
python -m build

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
url: https://pypi.org/p/mesa-reader
#
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
# ALTERNATIVE: exactly, uncomment the following line instead:
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: dist/
40 changes: 40 additions & 0 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .
- name: Lint with ruff
run: |
cd ${{ github.workspace }}
ruff format --check
ruff check
- name: Test with pytest
run: |
pytest
231 changes: 231 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

58 changes: 47 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,64 @@
mesa_reader
===========
[![Repo Status][status-badge]][status-link]
[![PyPI Version Status][pypi-badge]][pypi-link]
[![Test Status][workflow-test-badge]][workflow-test-link]
[![Readthedocs Status][docs-badge]][docs-link]
[![License][license-badge]][license-link]

[status-link]: https://www.repostatus.org/#active
[status-badge]: https://www.repostatus.org/badges/latest/active.svg
[pypi-link]: https://pypi.org/project/mesa-reader
[pypi-badge]: https://img.shields.io/pypi/v/mesa-reader?label=PyPI&logo=pypi
[workflow-test-link]: https://github.com/wmwolf/py_mesa_reader/actions/workflows/test-package.yml
[workflow-test-badge]: https://github.com/wmwolf/py_mesa_reader/actions/workflows/test-package.yml/badge.svg?event=push
[docs-link]: https://wmwolf.github.io/py_mesa_reader
[docs-badge]: https://github.com/wmwolf/py_mesa_reader/actions/workflows/pages/pages-build-deployment/badge.svg
[license-link]: https://opensource.org/license/gpl-3-0
[license-badge]: https://img.shields.io/badge/license-GPLv3-blue.svg

# mesa_reader

A Python package for easily accessing and manipulating output of the [Modules for Experiments in Stellar Astrophysics (MESA)](https://mesastar.org/) code.

Tools for easily accessing and manipulating data from `MESA star` and `MESA binary` in python.

## Installation
The easiest way to install is via `pip`:

pip install mesa_reader
The easiest way to install the package is via `pip`:

You can also install by cloning or downloading the repository at github.com/wmwolf/py_mesa_reader, `cd` into it and then execute
```console
pip install mesa_reader
```

python setup.py install
You can also install by cloning or downloading this repository, `cd` into it and then execute

```console
python setup.py install
```

or

pip install .
```console
pip install .
```

to install the package on your system.


## Uninstallation
Uninstall by executing

pip uninstall mesa_reader
Uninstall the package by executing

```console
pip uninstall mesa_reader
```


## Usage

Start using the package in your Python scripts by first importing it:

```python
import mesa_reader as mr
```

Complete documentation on the `mesa_reader` module found
[here](https://wmwolf.github.io/py_mesa_reader).
[here](https://wmwolf.github.io/py_mesa_reader).
76 changes: 41 additions & 35 deletions docs_source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
from os.path import join
import sys
import sphinx_rtd_theme
sys.path.insert(0, os.path.abspath(join('..')))

sys.path.insert(0, os.path.abspath(".."))

# -- General configuration ------------------------------------------------

Expand All @@ -33,37 +31,40 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.napoleon']
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"sphinx.ext.napoleon",
"sphinx_copybutton",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'PyMesaReader'
copyright = '2017, William Wolf and Josiah Schwab'
author = 'William Wolf and Josiah Schwab'
project = "PyMesaReader"
copyright = "2017, William Wolf and Josiah Schwab"
author = "William Wolf and Josiah Schwab"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '3.1'
version = "3.5"
# The full version, including alpha/beta/rc tags.
release = '3.1.0'
release = "3.5.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -78,7 +79,7 @@
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -89,28 +90,28 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
html_theme_options = {
'collapse_navigation': False,
'display_version': False,
'navigation_depth': 3,
"collapse_navigation": False,
"display_version": False,
"navigation_depth": 3,
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'PyMesaReaderdoc'
htmlhelp_basename = "PyMesaReaderdoc"


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -119,15 +120,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -137,19 +135,21 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'PyMesaReader.tex', 'PyMesaReader Documentation',
'William Wolf and Josiah Schwab', 'manual'),
(
master_doc,
"PyMesaReader.tex",
"PyMesaReader Documentation",
"William Wolf and Josiah Schwab",
"manual",
),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pymesareader', 'PyMesaReader Documentation',
[author], 1)
]
man_pages = [(master_doc, "pymesareader", "PyMesaReader Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -158,7 +158,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'PyMesaReader', 'PyMesaReader Documentation',
author, 'PyMesaReader', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"PyMesaReader",
"PyMesaReader Documentation",
author,
"PyMesaReader",
"One line description of project.",
"Miscellaneous",
),
]
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ruff
pytest
Loading