Skip to content

Commit

Permalink
Merge pull request #2 from SINTEF/fix_3_11_compatibility
Browse files Browse the repository at this point in the history
Added build setup and fixed error related to dataclass
  • Loading branch information
kevinksyTRD authored Mar 26, 2024
2 parents 37a2fc6 + f6ab59c commit 64ab5c6
Show file tree
Hide file tree
Showing 13 changed files with 1,290 additions and 41 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
__pycache__/
Data
PythonScript
venv
.idea/
build
dist
/docs/_build/
/feems.egg-info/
.DS_Store
*.egg-info/
9 changes: 0 additions & 9 deletions RunFEEMSSim/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion RunFEEMSSim/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ language = English
custom_sidebar = False
license = apache2
status = 2
requirements = pandas~=2.1.1 numpy~=1.24.2 MachSysS
requirements = pandas numpy MachSysS
nbs_path = .
doc_path = docs
recursive = False
Expand Down
2 changes: 0 additions & 2 deletions feems/build_feems.sh
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
poetry install
poetry build
4 changes: 2 additions & 2 deletions feems/feems/types_for_feems.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from enum import Enum, unique, auto
from functools import reduce
from typing import NewType, NamedTuple, Union, List, Optional, TypeVar, DefaultDict
Expand Down Expand Up @@ -45,7 +45,7 @@ class FEEMSResult:
running_hours_pti_pto_total_hr: float = 0.0
total_emission_kg: Optional[DefaultDict[EmissionType, float]] = None
detail_result: Optional[pd.DataFrame] = None
multi_fuel_consumption_total_kg: FuelConsumption = FuelConsumption()
multi_fuel_consumption_total_kg: FuelConsumption = field(default_factory=FuelConsumption)
co2_emission_total_kg: float = 0.0
energy_input_mechanical_total_mj: float = (
0.0 # Energy input for generator / PTO (electric side) or PTI (mechanical side)
Expand Down
1,216 changes: 1,216 additions & 0 deletions feems/poetry.lock

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions feems/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[tool.poetry]
name = "feems"
version = "0.10.4"
description = ""
authors = ["Kevin Koosup Yum <kevin.koosup.yum@gmail.com>"]
readme = "readme.md"
include = ["feems/py.typed"]
license = "Proprietary"

[tool.poetry.dependencies]
python = ">=3.9,<3.13"
pandas = "^2.1.1"
scipy = "^1.11.2"
numpy = "^1.22.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.2"
black = "22.6.0"
mypy = "^1.5.1"
sphinx = "^7.2.6"
sphinx-rtd-theme = "^1.3.0"
sphinx-autodoc-typehints = "^1.24.0"
pytest-subtests = "^0.11.0"
unittest-xml-reporting = "^3.2.0"
pytest-cov = "^4.1.0"

[tool.black]
line-length = 99
target-version = ['py37']

[build-system]
requires = ["poetry>=1.4.0", "setuptools>=40.8.0"]
build-backend = "poetry.core.masonry.api"
9 changes: 0 additions & 9 deletions feems/requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions feems/tests/test_fuel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
_GWP100_N2O,
_GWP100_CH4,
)
from pytest_subtests import subtests
from pytest_subtests import SubTests


def test_fuel_class():
Expand Down Expand Up @@ -131,7 +131,7 @@ def create_random_fuel_by_mass_fraction(
return FuelByMassFraction(fuels=fuel_list)


def test_fuel_by_mass_fraction_class(subtests):
def test_fuel_by_mass_fraction_class(subtests: SubTests):
with subtests.test(msg="Test fuel with no component"):
assert FuelByMassFraction(fuels=[]).get_kg_co2_per_kg_fuel() == 0

Expand Down
14 changes: 0 additions & 14 deletions machinery-system-structure/requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions machinery-system-structure/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ author = Kevin Koosup Yum
author_email = kevinkoosup.yum@sintef.no
copyright = SINTEF Ocean
version = 0.6.2
min_python = 3.9
min_python = 3.10
audience = Developers
language = English
# Set to True if you want to create a more fancy sidebar.json than the default
Expand All @@ -24,7 +24,7 @@ license = apache2
status = 1

# Optional. Same format as setuptools requirements
requirements = protobuf~=4.21.12
requirements = protobuf
# Optional. Same format as setuptools console_scripts
# console_scripts =
# Optional. Same format as setuptools dependency-links
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pandas
numpy
scipy
protobuf
pandas
18 changes: 18 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
mypy
pytest
wheel
black[jupyter]
pytest-subtests
mypy-protobuf
types-protobuf
typing_extensions
jupyter
jupyterlab
nbdev
deepdiff
plotly
poetry
-e ./feems
-e ./machinery-system-structure
-e ./RunFeemsSim
-r requirements.txt

0 comments on commit 64ab5c6

Please sign in to comment.