Skip to content

Commit

Permalink
chore(project): switch to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
flypenguin committed Nov 8, 2023
1 parent 5dc2c2a commit be8d43d
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 192 deletions.
13 changes: 0 additions & 13 deletions .bumpversion.cfg

This file was deleted.

72 changes: 40 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,38 @@ SHELL = bash

all: checkclean clean build


_bump:
bump-my-version bump $(BUMP_WHAT)
.PHONY: _bump


_checkclean:
echo -e "\nCHECK IF BUILD DIR IS CLEAN ...\n"
git diff-index --quiet HEAD --
.PHONY: _checkclean
.SILENT: _checkclean


_print_upload_message:
@echo -e "\nDONE.\nNow push & upload by executing ...\n"
@echo -e " make upload\n\nHave fun :)"
.PHONY: _print_upload_message


%.txt: %.in
pip-compile -q --output-file "$@" "$<"

requirements-dev.txt: requirements.txt

requirements: requirements.txt requirements-dev.txt
.PHONY: requirements


test:
pytest
.PHONY: test

.PHONY: checkclean
checkclean:
echo -e "\nCHECK IF BUILD DIR IS CLEAN ...\n"
git diff-index --quiet HEAD --

.PHONY: clean
clean:
Expand All @@ -20,52 +44,36 @@ clean:
rm -rf ignoreme build dist
rm -rf tmp


.PHONY: build
build: clean test
rm -rf build/ dist/
python setup.py sdist
python setup.py bdist_wheel
python -m build --wheel


.PHONY: push
push:
git push
git push --tags


.PHONY: upload
upload: push
twine upload dist/*

.PHONY: now-upload-message
now-upload-message:
@echo -e "\nDONE.\nNow push & upload by executing ...\n"
@echo -e " make upload\n\nHave fun :)"

# now let's get to the ones we use most often :)

.PHONY: bump_major
bump_major:
bumpversion major

.PHONY: bump_minor
bump_minor:
bumpversion minor

.PHONY: bump_patch
bump_patch:
bumpversion patch

major: BUMP_WHAT := major
major: _checkclean _bump build _print_upload_message
.PHONY: major
major: checkclean bump_major build now-upload-message


minor: BUMP_WHAT := minor
minor: _checkclean _bump build _print_upload_message
.PHONY: minor
minor: checkclean bump_minor build now-upload-message

.PHONY: patch
patch: checkclean bump_patch build now-upload-message

dockertest:
@IMG="temp/$$(basename $$(pwd)):$$(date +%s)" ; \
echo $$IMG ; \
docker build . --no-cache --tag $$IMG ; \
docker run $$IMG
.PHONY: test
patch: BUMP_WHAT := patch
patch: _checkclean _bump build _print_upload_message
.PHONY: patch
70 changes: 70 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/


[project]
name = "okta-cli"
authors = [{ name = "Axel Bock", email = "ab@a3b3.de" }]
version = "18.0.4"
requires-python = ">=3.7"

description = "An Okta command line interface for scripting and quickly performing routine tasks"
readme = "README.md"
license = { text = "MIT License" }
keywords = ["okta", "cli"]
classifiers = [
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
]

dynamic = ["dependencies"]


[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"


[tool.setuptools.dynamic.dependencies]
file = "requirements.txt"


[tool.setuptools.dynamic.optional-dependencies]
dev = {file = "requirements-dev.txt"}


[project.urls]
Homepage = "https://github.com/flypenguin/okta-cli"
Repository = "https://github.com/flypenguin/okta-cli"


[project.scripts]
okta-cli = "oktacli:cli_main"


[tool.bumpversion]
current_version = "18.0.4"
commit = true
tag = true
message = "build(release): {current_version} -> {new_version}"
tag_message = ""
no_sign_tags = true


[[tool.bumpversion.files]]
filename = "oktacli/cli.py"
search = "{current_version}"
replace = "{new_version}"


[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = "{current_version}"
replace = "{new_version}"
4 changes: 4 additions & 0 deletions requirements-dev.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-c requirements.txt
bump-my-version
pytest
responses
83 changes: 83 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements-dev.txt requirements-dev.in
#
annotated-types==0.6.0
# via pydantic
bump-my-version==0.12.0
# via -r requirements-dev.in
certifi==2023.7.22
# via
# -c requirements.txt
# requests
charset-normalizer==3.3.2
# via
# -c requirements.txt
# requests
click==8.1.7
# via
# -c requirements.txt
# bump-my-version
# rich-click
exceptiongroup==1.1.3
# via pytest
idna==3.4
# via
# -c requirements.txt
# requests
iniconfig==2.0.0
# via pytest
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
packaging==23.2
# via pytest
pluggy==1.3.0
# via pytest
pydantic==2.4.2
# via
# bump-my-version
# pydantic-settings
pydantic-core==2.10.1
# via pydantic
pydantic-settings==2.0.3
# via bump-my-version
pygments==2.16.1
# via rich
pytest==7.4.3
# via -r requirements-dev.in
python-dotenv==1.0.0
# via pydantic-settings
pyyaml==6.0.1
# via
# -c requirements.txt
# responses
requests==2.31.0
# via
# -c requirements.txt
# responses
responses==0.24.0
# via -r requirements-dev.in
rich==13.6.0
# via
# bump-my-version
# rich-click
rich-click==1.7.1
# via bump-my-version
tomli==2.0.1
# via pytest
tomlkit==0.12.2
# via bump-my-version
typing-extensions==4.8.0
# via
# pydantic
# pydantic-core
# rich-click
urllib3==2.0.7
# via
# -c requirements.txt
# requests
# responses
1 change: 0 additions & 1 deletion requirements.dev.txt

This file was deleted.

7 changes: 7 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
appdirs
click
requests
openpyxl
pony
pyyaml
six
31 changes: 30 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
-e .
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements.txt requirements.in
#
appdirs==1.4.4
# via -r requirements.in
certifi==2023.7.22
# via requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via -r requirements.in
et-xmlfile==1.1.0
# via openpyxl
idna==3.4
# via requests
openpyxl==3.1.2
# via -r requirements.in
pony==0.7.17
# via -r requirements.in
pyyaml==6.0.1
# via -r requirements.in
requests==2.31.0
# via -r requirements.in
six==1.16.0
# via -r requirements.in
urllib3==2.0.7
# via requests
Loading

0 comments on commit be8d43d

Please sign in to comment.