Skip to content

Commit

Permalink
Fix version thingy
Browse files Browse the repository at this point in the history
  • Loading branch information
glesica committed Feb 29, 2020
1 parent 73c8c86 commit 7b5a3fe
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
49 changes: 49 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,83 @@
.PHONY: help
help:
@echo analyze - run the type checker
@echo check - run tests
@echo check-fast - run non-network, non-subprocess tests
@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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <george@lesica.com>",
Expand Down
4 changes: 3 additions & 1 deletion pyrs990/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions pyrs990/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.3

0 comments on commit 7b5a3fe

Please sign in to comment.