Skip to content

Commit

Permalink
migrated to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
mukundesh committed Jan 15, 2025
1 parent 47570e9 commit 96434ab
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions .github/workflows/translateGR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions flow/writeTxt_/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 7 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
97 changes: 53 additions & 44 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT"
authors = [{ name = "Orgpedia Foundation", email = "[email protected]" }]
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.
Expand All @@ -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 = [
Expand All @@ -87,13 +98,11 @@ exclude = [
"page_images",
"html",
]
lint.per-file-ignores = {}

# Same as Black.
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"

0 comments on commit 96434ab

Please sign in to comment.