Skip to content

Commit

Permalink
updated config files and added pre commit hooks
Browse files Browse the repository at this point in the history
(cherry picked from commit 28712e6)
  • Loading branch information
FilippoAiraldi committed Oct 27, 2023
1 parent eaa3a9d commit c0f620b
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 60 deletions.
8 changes: 0 additions & 8 deletions .cmd

This file was deleted.

12 changes: 0 additions & 12 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
python -m pip install --upgrade setuptools
git clone -b experimental --single-branch https://github.com/FilippoAiraldi/casadi-nlp.git
python -m pip install ./casadi-nlp
python -m pip install -r requirements-dev.txt
python -m pip install -r requirements.txt
python -m pip install -e .
python -m pip install -r requirements-tests.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -r requirements-dev.txt
python -m pip install -r requirements.txt
python -m pip install -e .
python -m pip install -r requirements-tests.txt
Expand Down
22 changes: 0 additions & 22 deletions .mypy.ini

This file was deleted.

51 changes: 51 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

default_language_version:
python: python3.9

default_stages: [pre-commit, pre-push]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- --py39-plus

- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
hooks:
- id: autoflake
args: [--in-place, --remove-all-unused-imports, --remove-unused-variables, --remove-duplicate-keys, --recursive]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: black

- repo: local
hooks:
- id: coverage
name: coverage
entry: coverage run -m unittest discover tests
language: system
pass_filenames: false
always_run: true
verbose: true
stages: [manual] # pre-push
8 changes: 0 additions & 8 deletions .sh

This file was deleted.

61 changes: 56 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta"

[project]
name = "mpcrl"
version = "1.1.8rc5"
authors = [
{ name="Filippo Airaldi", email="[email protected]" },
]
Expand All @@ -13,12 +12,16 @@ readme = "README.md"
requires-python = ">=3.9"
license = { text = "MIT" }
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Mathematics"
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
"typing_extensions >= 4.5.0",
Expand All @@ -27,15 +30,63 @@ dependencies = [
"scipy >= 1.11.0",
"gymnasium >= 0.28.1",
]
keywords = [
"reinforcement-learning",
"model-predictive-control",
"optimization",
"casadi",
]
dynamic = ["version"]

[project.urls]
"Homepage" = "https://github.com/FilippoAiraldi/mpc-reinforcement-learning"
"Bug Tracker" = "https://github.com/FilippoAiraldi/mpc-reinforcement-learning/issues"

[tool.setuptools]
license-files = [
"LICENSE",
]
license-files = ["LICENSE"]

[tool.setuptools.dynamic]
version = {attr = "mpcrl.__version__"}

[tool.black]
target-version = ["py39", "py310", "py311"]
color = true

[tool.isort]
profile = "black"
py_version = 39

[tool.mypy]
python_version = "3.9"
plugins = ["numpy.typing.mypy_plugin"]
exclude = ["tests"]

[[tool.mypy.overrides]]
module = [
"casadi.*",
"csnlp.*",
"matplotlib.*",
"parameterized.*",
"scipy.*",
"mpcrl.*",
]
ignore_missing_imports = true

[tool.coverage.run]
branch = true
omit = [
"tests/*",
"examples/*",
"*/csnlp/*",
]

[tool.coverage.report]
exclude_also = [
"def __repr__",
"def __str__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
sort = "miss"
6 changes: 3 additions & 3 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage==7.1.0
parameterized==0.8.1
coverage[toml]>=7.3.2
parameterized>=0.9.0
--find-links https://download.pytorch.org/whl/torch_stable.html
torch==2.1.0+cpu
torch>=2.1.0+cpu
File renamed without changes.
2 changes: 2 additions & 0 deletions src/mpcrl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__version__ = "1.1.8"

__all__ = [
"Agent",
"ExperienceReplay",
Expand Down

0 comments on commit c0f620b

Please sign in to comment.