Skip to content

Commit

Permalink
my favorite, fixing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
amogh7joshi committed Feb 8, 2025
2 parents 8cf62fb + 0cb18b7 commit dd70b20
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 1,589 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ __MACOSX
# Extra directories/files
/**data*/

!tests/*/*
agml/_helios
agml/helios_config.sh
agml/train
Expand Down
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,21 @@ make test
### Running scripts

For running scripts or one-offs using the project's installed enviroment
The build the associated wheels simply run:

```
uv build
```

To sync the dependencies simply run:

```
uv sync
```

### Running scripts

For running scripts or one using the project's environment:

```
uv run python <script>
Expand Down
57 changes: 4 additions & 53 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,69 +6,20 @@ version := 0.7.0
src.python := $(shell find ./agml -type f -name "*.py" || :)
test.python := $(shell find ./tests -type f -name "*.py" || :)

uv.project.enviroment := .venv
dist.dir := dist
build.wheel := $(dist.dir)/agml-$(version).tar.gz





.PHONY: help
help: ## Print the help screen.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":|:[[:space:]].*?##"}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

# Setup and Build


install: setup ## Installing dependencies
uv sync
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":|:[[:space:]].*?##"}; {printf "\033[36m%-30s\033[0m %s\n", $$2, $$3}'

setup: ## Setup the project.
uv venv $(uv.project.enviroment)


$(build.wheel): $(src.python) ## Build wheels
$(build.wheel): $(src.python)
uv build -o $(dist.dir)

build: $(build.wheel) ## Build the distribution wheel.

test: $(test.python) $(src.python) ## Run tests
uv run pytest -c=config/pytest.ini $(test.python)


# Quality Checks

.PHONY: pre-commit
pre-commit: check-format lint check-types docstring-coverage


.PHONY: check-types
check-types: ## Run mypy to check type definitions.
uv run mypy --config=config/mypy.ini $(src.python) $(test.python)


.PHONY: check-format
check-format: ## Check ruff format
uv run ruff format --check --config=config/ruff.toml $(src.python) $(test.python)


.PHONY: lint
lint: ## Run ruff Code Linter
uv run ruff check --config=config/ruff.toml $(src.python) $(test.python)

.PHONY:docstring-coverage
docstring-coverage: ## Compute docstring coverage
uv run interrogate -c config/interrogate.toml .

# Automated Quality fixes

.PHONY: lint-fix
lint-fix: ## Fix ruff Lint issues
uv run ruff check --fix --config=config/ruff.toml $(src.python) $(test.python)


.PHONY: format
format: ## Run ruff format (Includes sorting of imports)
uv run ruff check --select I --config=config/ruff.toml --fix
uv run ruff format --config=config/ruff.toml $(src.python) $(test.python)
test: $(test.python) $(src.python) # Run tests
uv run pytest -c=config/pytest.ini $(test.python)
2 changes: 0 additions & 2 deletions agml/data/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1763,8 +1763,6 @@ def export_torch(self, **loader_kwargs):
"""
from torch.utils.data import DataLoader

from agml.backend.tftorch import torch

if get_backend() != "torch":
if user_changed_backend():
raise StrictBackendError(change="torch", obj=self.export_torch)
Expand Down
2 changes: 2 additions & 0 deletions agml/data/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def _resolve_coco_annotations(annotations):
return annotations
if len(annotations) == 1:
return annotations

annotation = {
"bboxes": [],
"labels": [],
Expand All @@ -39,6 +40,7 @@ def _resolve_coco_annotations(annotations):
"iscrowd": [],
"segmentation": [],
}

for a_set in annotations:
annotation["bboxes"].append(a_set["bbox"])
annotation["labels"].append(a_set["category_id"])
Expand Down
22 changes: 4 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ maintainers = [{ name="Amogh Joshi", email="[email protected]"}]
license = {text = "Apache 2.0"}
readme = "README.md"
packages = [{include = "agml", from = "agml", exclude ='agml/_internal'}]
version = "0.7.0"
version = "0.1.0"
requires-python = ">=3.8,<3.12"
keywords = []
classifiers = [
Expand All @@ -35,6 +35,8 @@ classifiers = [
"Typing :: Typed",
]



# managed by uv
dependencies = [
"matplotlib>=3.7.5",
Expand Down Expand Up @@ -69,20 +71,4 @@ dev-dependencies = [
"mypy>=1.13.0",
"coverage>=7.6.1",
"interrogate>=1.7.0",
]

[dependency-groups]
docs = [
"markdown-callouts>=0.4.0",
"markdown-exec>=1.9.3",
"mkdocs-coverage>=1.1.0",
"mkdocs-gen-files>=0.5.0",
"mkdocs-git-revision-date-localized-plugin>=1.3.0",
"mkdocs-literate-nav>=0.6.1",
"mkdocs-material>=9.5.45",
"mkdocs-minify-plugin>=0.8.0",
"pymdown-extensions>=10.12",
"mkdocs-jupyter>=0.24.8",
"mkdocs>=1.6.1",
"mkdocstrings[python]>=0.26.1",
]
]
Loading

0 comments on commit dd70b20

Please sign in to comment.