Skip to content

Commit

Permalink
Switch to using hatch and upgrade meilisearch (#54)
Browse files Browse the repository at this point in the history
* Switch to using hatch and upgrade meilisearch

* Small UX update
  • Loading branch information
scmmmh authored Aug 24, 2023
1 parent 9b2f6da commit baa73cb
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 1,599 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ node_modules
*~
cache
*.log
.venv
.venvs
.vscode
*.sqlite
*.sqlite-journal
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
ports:
- "127.0.0.1:5432:5432"
meilisearch:
image: getmeili/meilisearch:v1.0
image: getmeili/meilisearch:v1.3
environment:
- MEILI_ENV=development
- MEILI_MASTER_KEY=ff2e87a28b482fd787091a5824e05af3
Expand Down
1 change: 1 addition & 0 deletions museum_map/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.8.2"
8 changes: 3 additions & 5 deletions museum_map/cli/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ async def index_impl(config):
}
doc.update(item.attributes)
docs.append(doc)
progress = ClickIndeterminate('Waiting for indexing to complete')
progress.start()
tasks = await items_idx.add_documents_in_batches(docs)
for task in tasks:
await wait_for_task(client, task.task_uid, timeout_in_ms=None, interval_in_ms=1000)
progress.stop()
with click.progressbar(tasks, label='Waiting for indexing to complete') as progress:
for task in progress:
await wait_for_task(client, task.task_uid, timeout_in_ms=None, interval_in_ms=1000)
progress = ClickIndeterminate('Updating filterable attributes')
progress.start()
task = await items_idx.update_filterable_attributes(['mmap_room', 'mmap_floor'])
Expand Down
1,562 changes: 0 additions & 1,562 deletions poetry.lock

This file was deleted.

203 changes: 175 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,179 @@
[tool.poetry]
[dirs.env]
virtual = ".venvs"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "museum-map"
version = "0.8.2"
description = ""
authors = ["Mark Hall <mark.hall@work.room3b.eu>"]
dynamic = ["version"]
description = ''
readme = "README.md"
requires-python = ">=3.11"
license = "MIT"
keywords = []
authors = [
{ name = "Mark Hall", email = "mark.hall@work.room3b.eu" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"click>8.0.0,<9",
"inflection>=0.5.1,<1",
"requests>=2.31.0,<3",
"SQLAlchemy>=1.4.49,<2",
"sqlalchemy_json>=0.6.0,<1",
"lxml>=4.9.3,<5",
"spacy>=3.6.0,<3.7",
"gensim>=4.3.1,<5",
"scipy>=1.11.2,<2",
"tornado>=6.3.3,<7",
"asyncpg>=0.28.0,<1",
"en_core_web_sm@https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.6.0/en_core_web_sm-3.6.0-py3-none-any.whl",
"PyYAML>=6.0,<7",
"Cerberus>=1.3.5,<2",
"psycopg2-binary>=2.9.7,<3",
"meilisearch-python-async>=1.6.2,<2",
]

[tool.poetry.dependencies]
python = ">=3.9,<3.11"
click = "^8.0.0"
inflection = "^0.5.1"
requests = "^2.31.0"
sqlalchemy = "^1.4.36"
sqlalchemy_json = "^0.4.0"
lxml = "^4.9.1"
spacy = "^3.2.4"
gensim = "^4.1.2"
scipy = "^1.8.0"
tornado = "^6.3"
asyncpg = "^0.25.0"
SQLAlchemy = "^1.4.36"
en-core-web-sm = {url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0-py3-none-any.whl"}
PyYAML = "^6.0"
Cerberus = "^1.3.4"
psycopg2-binary = "^2.9.5"
meilisearch-python-async = "^1.2.0"

[tool.poetry.dev-dependencies]
[project.urls]
Documentation = "https://github.com/scmmmh/museum-map#readme"
Issues = "https://github.com/scmmmh/museum-map/issues"
Source = "https://github.com/scmmmh/museum-map"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
[project.scripts]
museum-map = "museum_map.cli:cli"

[tool.hatch.version]
path = "museum_map/__about__.py"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.envs.default]
dependencies = [
"coverage[toml]>=6.5",
"pytest",
]
[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",
]

[[tool.hatch.envs.all.matrix]]
python = ["3.11"]

[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:museum_map tests}"
style = [
"ruff {args:.}",
"black --check --diff {args:.}",
]
fmt = [
"black {args:.}",
"ruff --fix {args:.}",
"style",
]
all = [
"style",
"typing",
]

[tool.black]
target-version = ["py311"]
line-length = 120
skip-string-normalization = true

[tool.ruff]
target-version = "py311"
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.ruff.isort]
known-first-party = ["museum_map"]

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004", "S101", "TID252"]

[tool.coverage.run]
source_pkgs = ["museum_map", "tests"]
branch = true
parallel = true
omit = [
"museum_map/__about__.py",
]

[tool.coverage.paths]
museum_map = ["museum_map", "*/museum-map/museum_map"]
tests = ["tests", "*/museum-map/tests"]

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

0 comments on commit baa73cb

Please sign in to comment.