Skip to content

Commit

Permalink
structure
Browse files Browse the repository at this point in the history
  • Loading branch information
enzbus committed Jun 8, 2024
1 parent 4dc1066 commit 00efae2
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 70 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ __pycache__/
# L-BFGS-B when compiled separately
*/Lbfgsb.3.0/x.*
*/Lbfgsb.3.0/*.dat

# Python testing
*coverage.xml
63 changes: 0 additions & 63 deletions DISABLED_SETUP.py

This file was deleted.

11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ endif

env: ## create environment
$(PYTHON) -m venv $(VENV_OPTS) $(ENVDIR)
$(BINDIR)/python -m pip install -v -e .
$(BINDIR)/python -m pip install -v -e .[dev,tests,docs]

# build: ## build locally (instead of editable install)
# cmake -B$(BUILDDIR) $(CMAKE_OPTS)
Expand All @@ -56,7 +56,14 @@ pybuild: ## create Python packages
python -m wheel tags dist/*.whl --platform="${TAG}" --remove

test: #build ## run unit tests
python -m $(PROJECT).tests
$(BINDIR)/python -m coverage run -m $(PROJECT).tests
$(BINDIR)/python -m coverage report
$(BINDIR)/python -m coverage xml
$(BINDIR)/diff-cover coverage.xml --config-file pyproject.toml

coverage: ## open html cov report
$(BINDIR)/python -m coverage html --fail-under=0 # overwrite pyproject.toml default
open htmlcov/index.html

lint: ## run Pylint
pylint $(PROJECT)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion project_euromir/tests/test_equilibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

import project_euromir as lib

from . import equilibrate
from project_euromir import equilibrate

logging.basicConfig(level='INFO')

Expand Down
3 changes: 1 addition & 2 deletions project_euromir/tests/test_lbfgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import project_euromir as lib

from . import lbfgs
from project_euromir import lbfgs


class TestLBFGS(TestCase):
Expand All @@ -49,7 +49,6 @@ def test_base_direction(self):

np.random.seed(m)
current_gradient = np.random.randn(n)
active_set = np.ones(n, dtype=bool)

past_grad_diffs = np.random.randn(m, n)
past_steps = np.random.randn(m, n)
Expand Down
49 changes: 47 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,56 @@ dependencies = ['numpy', 'scipy']
[project.optional-dependencies]
docs = ["sphinx"]
dev = [
"build", "twine", "pylint", "isort", "autopep8", "docformatter"]
"build", "twine", "pylint", "isort", "autopep8", "docformatter", "cvxpy",
"diff_cover"]
tests = [
"cvxpy", 'coverage[toml]']

[build-system]
requires = ["setuptools"]#, "cmake"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["project_euromir", "project_euromir.tests"]
packages = ["project_euromir", "project_euromir.tests"]

[tool.coverage.report]
fail_under = 99

[tool.coverage.run]
omit = ["*/site-packages/*", "*/dist-packages/*"]

[tool.diff_cover]
# this will be superflous once we push coverage to 100
compare_branch = "origin/master"
fail_under = 99

[tool.diff_quality]
# this will be superflous once we push pylint score to 10
compare_branch = "origin/master"
fail_under = 99

[tool.autopep8]
# these have been selected by hand, whitespaces and empty lines
select = ["W291","W292","W293","W391","E231","E225","E303"]

[tool.docformatter]
# tweaked to remove whitespaces and other simple fixes
wrap-summaries = 0
wrap-descriptions = 0
tab-width = 4

[tool.pylint.main]
fail-under = 9.75
jobs = 0 # multiprocessing pylint
max-line-length = 79 # PEP8 default
load-plugins =["pylint.extensions.docparams", "pylint.extensions.docstyle"]

[tool.pylint.parameter_documentation]
# we require docstrings of public methods to document everything
accept-no-param-doc = false
accept-no-raise-doc = false
accept-no-return-doc = false
accept-no-yields-doc = false

[tool.pylint.'MESSAGE CONTROL'] # check updates for the spelling of this
enable=["useless-suppression"] # flag useless pylint pragmas

0 comments on commit 00efae2

Please sign in to comment.