Skip to content

Commit

Permalink
feat: ⚡ Add complete poetry (#26)
Browse files Browse the repository at this point in the history
* feat: ⚡ Add complete `poetry`

* fix: 🔥 `__main__`

* fix: 🐛 Wrong call of `class`

* fix: 💚 Removed `python -m`

* docs: 📝 Update command
  • Loading branch information
Anselmoo authored Jan 13, 2023
1 parent f1d7362 commit 918007e
Show file tree
Hide file tree
Showing 10 changed files with 745 additions and 621 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ jobs:
fail-fast: false
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- 3.10
# - 3.11
os:
- ubuntu-latest
# - macOS-latest
Expand All @@ -34,7 +35,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
poetry install --with dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -45,7 +46,6 @@ jobs:
run: |
poetry run pytest -vv --diff-symbols
deploy:

runs-on: ubuntu-latest
needs: build
steps:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
poetry install --with dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -46,4 +46,3 @@ jobs:
- name: Test with pytest
run: |
poetry run pytest -vv --diff-symbols --cov test
poetry run python -m tanabesugano
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ The **TanabeSugano**-application can be installed and run:

#locally
python setup.py install
python -m tanabesugano
tanabesugano
```


The options of the **TanabeSugano**-application are:

```console
python -m tanabesugano --help
tanabesugano --help

usage: __main__.py [-h] [-d D] [-Dq DQ] [-cut CUT] [-B B B] [-C C C] [-n N]
[-ndisp] [-ntxt] [-slater]
Expand Down
1,274 changes: 694 additions & 580 deletions poetry.lock

Large diffs are not rendered by default.

42 changes: 23 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[tool.poetry]
name = "tanabesugano"
version = "1.2.0"
version = "1.3.0"
description = "A python-solver for Tanabe-Sugano and Energy-Correlation diagrams"
authors = ["Anselm Hahn <Anselm.Hahn@gmail.com>"]
maintainers = ["Anselm Hahn <Anselm.Hahn@gmail.com>"]
authors = ["Anselm Hahn <anselm.hahn@gmail.com>"]
maintainers = ["Anselm Hahn <anselm.hahn@gmail.com>"]
readme = "README.md"
license = "MIT"
keywords = [
"terminal",
"data-visualization",
"tanabe-sugano",
"energy-correlation",
"complex-ions"
"complex-ions",
]
repository = "https://github.com/Anselmoo/TanabeSugano"
homepage = "https://pypi.org/project/TanabeSugano"
Expand All @@ -25,34 +25,38 @@ classifiers = [
"Operating System :: Unix",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: System :: Shells",
"Topic :: Scientific/Engineering :: Visualization",
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Utilities"
"Topic :: Utilities",
]
include = ["LICENSE", "example/**"]
exclude = ["test/**/*.py"]

[tool.poetry.dependencies]
python = ">=3.7.1,<4.0"
pandas = "^1.2.4"
numpy = "^1.20.3"
matplotlib = "^3.4.2"
prettytable = "^2.1.0"
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
pandas = "^1.2.4"
numpy = "^1.20.3"
matplotlib = "^3.4.2"
prettytable = "^2.1.0"

[tool.poetry.dev-dependencies]
pytest = "^6.2.4"
pytest-clarity = "^1.0.1"
pytest-cov = "^2.12.1"
flake8 = "^3.9.2"
black = "^21.6b0"
isort = "^5.8.0"
[tool.poetry.group.dev.dependencies]
pytest = "^7.2.0"
pytest-clarity = "^1.0.1"
pytest-cov = "^4.0.0"
flake8 = "^6.0.0"
black = "^22.12.0"
isort = "^5.11.4"
pytest-console-scripts = "^1.3.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
tanabesugano = "tanabesugano.cmd:cmd_line"
2 changes: 1 addition & 1 deletion tanabesugano/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.0"
__version__ = "1.3.0"
3 changes: 2 additions & 1 deletion tanabesugano/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,6 @@ def return_result(self) -> List[dict]:


if __name__ == "__main__":
res = Batch().calculation()
res = Batch()
res.calculation()
print(res.return_result)
18 changes: 9 additions & 9 deletions tanabesugano/__main__.py → tanabesugano/cmd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import argparse

import matplotlib.pylab as plt
import matplotlib.pyplot as plt
import numpy as np
from prettytable import PrettyTable

Expand Down Expand Up @@ -41,21 +41,21 @@ def __init__(
def plot(self):

# Figure one for classical Tanabe-Sugano-Diagram with B-dependency
fig_1 = plt.figure(1)
plt.figure(1)

# Set Window Title

fig_1.canvas.set_window_title("Tanabe-Sugano-Diagram")
for i in range(self._size + 1):
plt.plot(self.delta_B, self.result[i, :] / self.B, ls="--")
# plt.title( 'Tanabe-Sugano-Diagram' )
plt.title("Tanabe-Sugano-Diagram")
plt.ylabel("$E/B$")
plt.xlabel("$\Delta/B$")

# Figure one for Energy-Correlation-Diagram Dq-Energy versus State-Energy
fig_2 = plt.figure(2)
fig_2.canvas.set_window_title("DD excitations -Diagram")
plt.figure(2)
for i in range(self._size + 1):
plt.plot(self.e_range * 10.0, self.result[i, :], ls="--")
# plt.title( 'DD excitations -Diagram' )
plt.title("DD excitations -Diagram")
plt.ylabel("$dd-state-energy\,(1/cm)$")
plt.xlabel("$10Dq\,(1/cm)$")

Expand Down Expand Up @@ -195,7 +195,7 @@ def ts_print(self, states, dq_ci=None):
for irreducible in states.keys():
for energy in states[irreducible]:
cut["state"][count] = irreducible
cut["cm"][count] = np.int(np.round(energy, 0))
cut["cm"][count] = np.round(energy, 0).astype(int)
cut["eV"][count] = np.round(energy * 0.00012, 4)

count += 1
Expand Down Expand Up @@ -227,7 +227,7 @@ def ts_print(self, states, dq_ci=None):
)


if __name__ == "__main__":
def cmd_line() -> None:
description = (
"A python-based Eigensolver for Tanabe-Sugano- & Energy-Correlation-Diagrams "
"based on the original three proposed studies of *Yukito Tanabe and Satoru Sugano* "
Expand Down
6 changes: 3 additions & 3 deletions tanabesugano/matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def solver(self):

GS = np.array([-12 * self.Dq - 15 * self.B])

A_4_2 = np.array([0], dtype=np.float)
A_4_2 = np.array([0], dtype=np.float64)
T_4_2 = np.array([-2 * self.Dq - 15 * self.B]) - GS

A_2_1 = np.array([-2 * self.Dq - 11 * self.B + 3 * self.C]) - GS
Expand Down Expand Up @@ -637,7 +637,7 @@ def solver(self):

GS = np.array([-6 * self.Dq - 21 * self.B])

E_5_1 = np.array([0], dtype=np.float)
E_5_1 = np.array([0], dtype=np.float64)
T_5_2 = np.array([4 * self.Dq - 21 * self.B]) - GS

A_3_1 = np.array([-6 * self.Dq - 12 * self.B + 4 * self.C]) - GS
Expand Down Expand Up @@ -1394,7 +1394,7 @@ def solver(self):

GS = np.array([-4 * self.Dq - 21 * self.B])

T_5_2 = np.array([0], dtype=np.float)
T_5_2 = np.array([0], dtype=np.float64)

E_5_1 = np.array([6 * self.Dq - 21 * self.B]) - GS

Expand Down
8 changes: 7 additions & 1 deletion tanabesugano/test/test_front.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
from tanabesugano import __main__ as frontapp
from tanabesugano import cmd as frontapp
from typing import Any


def test_frontapp():
return frontapp.CMDmain(
Dq=4000.0, B=400.0, C=3600.0, nroots=100, d_count=5
).calculation()


def test_cmd(script_runner: Any) -> None:
ret = script_runner.run("tanabesugano", "--help")
assert ret.success

0 comments on commit 918007e

Please sign in to comment.