From 96434ab611f349bcd55d28e1f0971e8ba0386989 Mon Sep 17 00:00:00 2001 From: mukundesh Date: Thu, 16 Jan 2025 04:00:27 +0530 Subject: [PATCH] migrated to uv --- .copier-answers.yml | 2 +- .github/workflows/translateGR.yml | 10 ++-- flow/writeTxt_/makefile | 4 +- makefile | 13 +++-- pyproject.toml | 97 +++++++++++++++++-------------- 5 files changed, 68 insertions(+), 58 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index e463662..8bb6860 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,4 +1,4 @@ -_commit: a7a3421 +_commit: '4910441' _src_path: https://github.com/orgpedia/template.mahdept2024.git dept_name: Public Health Department org_code: mahhea2024 diff --git a/.github/workflows/translateGR.yml b/.github/workflows/translateGR.yml index 44810fc..4ed9467 100644 --- a/.github/workflows/translateGR.yml +++ b/.github/workflows/translateGR.yml @@ -22,12 +22,12 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.8' # specify your Python version + python-version: '3.10' # specify your Python version - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | python3 - - echo "$HOME/.poetry/bin" >> $GITHUB_PATH + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "0.5.16" - name: Install dependencies run: make install diff --git a/flow/writeTxt_/makefile b/flow/writeTxt_/makefile index d88a3f7..fe644a4 100644 --- a/flow/writeTxt_/makefile +++ b/flow/writeTxt_/makefile @@ -6,7 +6,7 @@ export PYTHONPATH := $(ROOT_DIR)/../src:$(PYTHONPATH) .PHONY: all all: - poetry run python src/writeTxt.py input output + uv run python src/writeTxt.py input output %: - poetry run python src/writeTxt.py input/$@.pdf output/$@.pdf.doc.json + uv run python src/writeTxt.py input/$@.pdf output/$@.pdf.doc.json diff --git a/makefile b/makefile index 51d707f..c83b149 100644 --- a/makefile +++ b/makefile @@ -25,7 +25,8 @@ help: @echo # dummy command install: pyproject.toml - poetry install --only=dev + uv sync + uv venv -p python310 install-tess: sudo apt-get install tesseract-ocr-all -y @@ -35,21 +36,21 @@ import/documents/all_infos.json: import: import/documents/all_infos.json $(info running import) - poetry run python import/src/build_documents.py import/documents/all_infos.json import/documents/documents.json flow/writeTxt_/input + uv run python import/src/build_documents.py import/documents/all_infos.json import/documents/documents.json flow/writeTxt_/input flow: $(tasks) $(tasks): - poetry run make -C $@ + uv run make -C $@ lint: - poetry run ruff . + uv run ruff . format: - poetry run ruff format . + uv run ruff format . export: - poetry run python flow/src/export.py import/documents flow/writeTxt_ export/orgpedia_mahhea2024 + uv run python flow/src/export.py import/documents flow/writeTxt_ export/orgpedia_mahhea2024 # Use pre-commit if there are lots of edits, diff --git a/pyproject.toml b/pyproject.toml index a5b079e..1e68a42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,58 +1,68 @@ -[tool.poetry] +[project] name = "orgpedia-mahhea2024" version = "0.0.1" description = "Datapackage containing orders of Public Health Department Government of Maharashtra." -authors = ["Orgpedia Foundation "] -license = "MIT" +authors = [{ name = "Orgpedia Foundation", email = "orgpedia.foundation@gmail.com" }] +requires-python = ">=3.10" readme = "README.md" -keywords = ["information extraction", "data package", "government data"] -classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', - 'Topic :: Scientific/Engineering :: Information Analysis', - +license = "MIT" +keywords = [ + "information extraction", + "data package", + "government data", +] +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Information Analysis", ] -packages = [ { include = "orgpedia_mahhea2024", from = "export" } ] -include = [ "export/orgpedia_mahhea2024/*" ] - -[tool.poetry.urls] -"homepage" = "https://www.orgpedia.in/" -"repository" = "https://github.com/orgpedia/mahhea2024" +[project.urls] +homepage = "https://www.orgpedia.in/" +repository = "https://github.com/orgpedia/mahhea2024" "data issues" = "https://github.com/orgpedia/mahhea2024/discussions" -[tool.poetry.dependencies] -python = ">3.8.1 <4.0" - -# this is a datapackage should not have any dependency as we are publishing data -# dependencies for running the flow are in group.dev.dependencies +[dependency-groups] +dev = [ + "pdfplumber>=0.9.0,<0.10", + "requests>=2.31.0,<3", + "pytesseract>=0.3.10,<0.4", + "docint", + "ruff>=0.2.2,<0.3", + "pre-commit>=2.21.0,<3", + "translateindic", + "orgpedia", +] +[tool.uv.sources] +docint = { git = "https://github.com/mukundesh/docInt.git" } +translateindic = { git = "https://github.com/orgpedia/translateIndic" } +orgpedia = { git = "https://github.com/orgpedia/orgpedia.git" } -[tool.poetry.group.dev] -optional = true +[tool.hatch.build.targets.sdist] +include = [ + "export/orgpedia_mahhea2024", + "export/orgpedia_mahhea2024/*", +] -[tool.poetry.group.dev.dependencies] -pdfplumber = "^0.9.0" -requests = "^2.31.0" -pytesseract = "^0.3.10" +[tool.hatch.build.targets.wheel] +include = [ + "export/orgpedia_mahhea2024", + "export/orgpedia_mahhea2024/*", +] -docint = {git = "https://github.com/mukundesh/docInt.git"} -ruff = "^0.2.2" -pre-commit = "^2.21.0" -translateindic = {git = "https://github.com/orgpedia/translateIndic"} -orgpedia = {git = "https://github.com/orgpedia/orgpedia.git"} +[tool.hatch.build.targets.wheel.sources] +"export/orgpedia_mahhea2024" = "orgpedia_mahhea2024" [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" [tool.ruff] # Enable Pyflakes `E` and `F` codes by default. @@ -62,6 +72,7 @@ lint.ignore = [] # Allow autofix for all enabled rules (when `--fix`) is provided. lint.fixable = ["I001"] # fix only isort issues lint.unfixable = [] +lint.per-file-ignores = {} # Exclude a variety of commonly ignored directories. exclude = [ @@ -87,7 +98,6 @@ exclude = [ "page_images", "html", ] -lint.per-file-ignores = {} # Same as Black. line-length = 100 @@ -95,5 +105,4 @@ line-length = 100 # Allow unused variables when underscore-prefixed. #dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" -# Assume Python 3.8 -target-version = "py38" +target-version = "py310"