Skip to content

Commit

Permalink
try to improve workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Sep 29, 2023
1 parent 8a0cf6d commit a526b77
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 116 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/components_instructor_embedders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ jobs:
with:
python-version: '3.10'

- name: Install Hatch
run: pip install --upgrade hatch

- name: Install instructor-embedders
run: |
pip install -e .[dev]
- name: Lint
run: hatch run lint:all
- name: Pylint
run: |
pylint -ry -j 0 ./instructor_embedders
- name: Run tests and track code coverage
run: hatch run cov
- name: Run tests
run: |
pytest
143 changes: 34 additions & 109 deletions components/instructor-embedders/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ dependencies = [
"InstructorEmbedding"
]

[project.optional-dependencies]
dev = ["pytest", "pylint", "black"]

[project.urls]
Documentation = "https://github.com/deepset-ai/haystack-extras/tree/main/components/instructor-embedders#readme"
Issues = "https://github.com/deepset-ai/haystack-extras/issues"
Expand All @@ -55,123 +58,45 @@ Source = "https://github.com/deepset-ai/haystack-extras/tree/main/components/tex
path = "instructor_embedders/__about__.py"

[tool.hatch.envs.default]
dependencies = [
"coverage[toml]>=6.5",
"pytest",
]
dependencies = ["pytest", "pytest-cov"]

[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
cov-report = [
"- coverage combine",
"coverage report",
]
cov = [
"test-cov",
"cov-report",
]
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=text2speech --cov=tests"
no-cov = "cov --no-cov"

[[tool.hatch.envs.all.matrix]]
python = ["3.7", "3.8", "3.9", "3.10", "3.11"]
[[tool.hatch.envs.test.matrix]]
python = ["37", "38", "39", "310", "311"]

[tool.hatch.envs.lint]
detached = true
dependencies = [
"black>=23.1.0",
"mypy>=1.0.0",
"ruff>=0.0.243",
]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:instructor_embedders tests}"
style = [
"ruff {args:.}",
"black --check --diff {args:.}",
]
fmt = [
"black {args:.}",
"ruff --fix {args:.}",
"style",
]
all = [
"style",
"typing",
]
[tool.coverage.run]
branch = true
parallel = true
omit = ["text2speech/__about__.py"]

[tool.black]
target-version = ["py37"]
line-length = 120
skip-string-normalization = true
[tool.coverage.report]
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]

[tool.ruff]
target-version = "py37"
line-length = 120
select = [
"A",
"ARG",
"B",
"C",
"DTZ",
"E",
"EM",
"F",
"FBT",
"I",
"ICN",
"ISC",
"N",
"PLC",
"PLE",
"PLR",
"PLW",
"Q",
"RUF",
"S",
"T",
"TID",
"UP",
"W",
"YTT",
]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords
"S105", "S106", "S107",
# Ignore complexity
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
]
unfixable = [
# Don't touch unused imports
"F401",
]
[tool.pylint.'MESSAGES CONTROL']
max-line-length = 120
disable = ["missing-module-docstring", "fixme", "R0913", "W0221"]

[tool.ruff.isort]
known-first-party = ["instructor_embedders"]
[tool.pylint.'DESIGN']
max-args = 7

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.pylint.'SIMILARITIES']
min-similarity-lines = 10
ignore-comments = true

[tool.ruff.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004", "S101", "TID252"]
[tool.pylint.'TYPECHECK']
# List of members which are set dynamically and missed by Pylint inference
# system, and so shouldn't trigger E1101 when accessed.
generated-members = "torch.*"

[tool.coverage.run]
source_pkgs = ["instructor_embedders", "tests"]
branch = true
parallel = true
omit = [
"instructor_embedders/__about__.py",
]
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--strict-markers"
markers = ["integration: integration tests", "unit: unit tests"]
log_cli = true

[tool.coverage.paths]
instructor_embedders = ["instructor_embedders", "*/instructor-embedders/instructor_embedders"]
tests = ["tests", "*/instructor-embedders/tests"]
[tool.black]
line-length = 120

[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]

0 comments on commit a526b77

Please sign in to comment.