Skip to content

Commit 2ed5719

Browse files
authored
Adds release action and rename package to RATpy (#40)
1 parent a7842e6 commit 2ed5719

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+471
-418
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
9+
jobs:
10+
build_wheels:
11+
uses: RascalSoftware/python-RAT/.github/workflows/build_wheel.yml@main
12+
13+
build_sdist:
14+
name: Build source distribution
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Build sdist
19+
run: |
20+
pip install pybind11
21+
python setup.py sdist
22+
- uses: actions/upload-artifact@v4
23+
with:
24+
name: sdist
25+
path: dist/*.tar.gz
26+
27+
upload_pypi:
28+
needs: [build_wheels, build_sdist]
29+
runs-on: ubuntu-latest
30+
environment: release
31+
permissions:
32+
id-token: write
33+
steps:
34+
- uses: actions/download-artifact@v4
35+
with:
36+
path: dist
37+
merge-multiple: true
38+
- name: Publish to TestPyPi
39+
if: github.event_name == 'workflow_dispatch'
40+
uses: pypa/gh-action-pypi-publish@release/v1
41+
with:
42+
repository-url: https://test.pypi.org/legacy/
43+
- name: Publish
44+
if: github.event_name == 'release'
45+
uses: pypa/gh-action-pypi-publish@release/v1

RAT/__init__.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

RATpy/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from RATpy import events, models
2+
from RATpy.classlist import ClassList
3+
from RATpy.controls import set_controls
4+
from RATpy.project import Project
5+
from RATpy.run import run
6+
from RATpy.utils import plotting
7+
8+
__all__ = ["ClassList", "Project", "run", "set_controls", "models", "events", "plotting"]
File renamed without changes.

RAT/controls.py renamed to RATpy/controls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import prettytable
55
from pydantic import BaseModel, Field, ValidationError, field_validator
66

7-
from RAT.utils.custom_errors import custom_pydantic_validation_error
8-
from RAT.utils.enums import BoundHandling, Display, Parallel, Procedures, Strategies
7+
from RATpy.utils.custom_errors import custom_pydantic_validation_error
8+
from RATpy.utils.enums import BoundHandling, Display, Parallel, Procedures, Strategies
99

1010

1111
@dataclass(frozen=True)

RAT/events.py renamed to RATpy/events.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import os
12
from typing import Callable, List, Union
23

3-
from RAT.rat_core import EventBridge, EventTypes, PlotEventData, ProgressEventData
4+
from RATpy.rat_core import EventBridge, EventTypes, PlotEventData, ProgressEventData
45

56

67
def notify(event_type: EventTypes, data: Union[str, PlotEventData, ProgressEventData]) -> None:
@@ -63,5 +64,7 @@ def clear() -> None:
6364
__event_callbacks[key] = set()
6465

6566

67+
dir_path = os.path.dirname(os.path.realpath(__file__))
68+
os.environ["RAT_PATH"] = os.path.join(dir_path, "")
6669
__event_impl = EventBridge(notify)
6770
__event_callbacks = {EventTypes.Message: set(), EventTypes.Plot: set(), EventTypes.Progress: set()}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
import numpy as np
77

8-
import RAT
9-
import RAT.utils.plotting
8+
import RATpy as RAT
109

1110
problem = RAT.Project(
1211
name="Absorption example",
@@ -146,4 +145,4 @@
146145

147146
# Run the code and plot the results
148147
problem, results = RAT.run(problem, controls)
149-
RAT.utils.plotting.plot_ref_sld(problem, results, True)
148+
RAT.plotting.plot_ref_sld(problem, results, True)
File renamed without changes.

0 commit comments

Comments
 (0)