diff --git a/Makefile b/Makefile index 3036a10..133f5f4 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +.PHONY: help help: @echo analyze - run the type checker @echo check - run tests @@ -5,30 +6,78 @@ help: @echo clean - delete build artifacts @echo format - format the code +.PHONY: analyze analyze: poetry run mypy . tests/ +.PHONY: build build: poetry build +.PHONY: check check: analyze poetry run pytest +.PHONY: check-fast check-fast: analyze poetry run pytest -m "not network and not subprocess" +.PHONY: clean clean: rm -rf dist/ rm -rf pyrs990.egg-info/ +ORG_NAME := codeformontana +IMAGE_NAME := pyrs990 +FULL_VERSION := $(shell poetry version | cut -d ' ' -f 2) +MINOR_VERSION := $(shell poetry version | cut -d ' ' -f 2 | cut -d '.' -f 1,2) +MAJOR_VERSION := $(shell poetry version | cut -d ' ' -f 2 | cut -d '.' -f 1) + +.PHONY: docker-build +docker-build: + docker build -t $(ORG_NAME)/$(IMAGE_NAME):$(FULL_VERSION) \ + -t $(ORG_NAME)/$(IMAGE_NAME):$(MINOR_VERSION) \ + -t $(ORG_NAME)/$(IMAGE_NAME):$(MAJOR_VERSION) \ + -t $(ORG_NAME)/$(IMAGE_NAME):latest \ + . + docker run --mount src="${PWD}/data",target=/data,type=bind pyrs990:latest --version + +.PHONY: docker-push +docker-push: + docker push $(ORG_NAME)/$(IMAGE_NAME):$(FULL_VERSION) \ + $(ORG_NAME)/$(IMAGE_NAME):$(MINOR_VERSION) \ + $(ORG_NAME)/$(IMAGE_NAME):$(MAJOR_VERSION) \ + $(ORG_NAME)/$(IMAGE_NAME):latest + +.PHONY: format format: poetry run isort --recursive --use-parentheses --trailing-comma -y -w 80 poetry run autoflake -r --in-place --remove-unused-variables . poetry run black -t py38 -l 80 . +.PHONY: format-check format-check: poetry run black -t py38 -l 80 --check . +.PHONY: publish publish: poetry publish +.PHONY: store-version +store-version: + $(echo $(FULL_VERSION) > pyrs990/version.txt) + +.PHONY: version-major +version-major: + poetry version major + $(MAKE) store-version + +.PHONY: version-minor +version-minor: + poetry version minor + $(MAKE) store-version + +.PHONY: version-patch +version-patch: + poetry version patch + $(MAKE) store-version diff --git a/pyproject.toml b/pyproject.toml index c4d943d..13ca488 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pyrs990" -version = "0.1.3" +version = "0.1.4" description = "A tool for fetching and filtering IRS 990 data." authors = [ "George Lesica ", diff --git a/pyrs990/constants.py b/pyrs990/constants.py index ad96ef4..a977e45 100644 --- a/pyrs990/constants.py +++ b/pyrs990/constants.py @@ -14,7 +14,9 @@ use with the `HTTPDownloader` to download index documents. """ -CURRENT_VERSION = "0.0.1" +import importlib.resources as pkg_resources +version = pkg_resources.read_text('pyrs990', 'version.txt') +CURRENT_VERSION = version DEFAULT_CACHE_PATH = ".pyrs990-cache" diff --git a/pyrs990/version.txt b/pyrs990/version.txt new file mode 100644 index 0000000..7693c96 --- /dev/null +++ b/pyrs990/version.txt @@ -0,0 +1 @@ +0.1.3 \ No newline at end of file