diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 463404f..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,13 +0,0 @@ -[bumpversion] -current_version = 18.0.4 -commit = True -tag = True -tag_name = {new_version} - -[bumpversion:file:oktacli/cli.py] -search = VERSION = "{current_version}" -replace = VERSION = "{new_version}" - -[bumpversion:file:setup.py] -search = VERSION = "{current_version}" -replace = VERSION = "{new_version}" diff --git a/Makefile b/Makefile index 30fd537..431caae 100644 --- a/Makefile +++ b/Makefile @@ -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: @@ -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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5568187 --- /dev/null +++ b/pyproject.toml @@ -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}" diff --git a/requirements-dev.in b/requirements-dev.in new file mode 100644 index 0000000..0b66535 --- /dev/null +++ b/requirements-dev.in @@ -0,0 +1,4 @@ +-c requirements.txt +bump-my-version +pytest +responses diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..88af595 --- /dev/null +++ b/requirements-dev.txt @@ -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 diff --git a/requirements.dev.txt b/requirements.dev.txt deleted file mode 100644 index aefbcb6..0000000 --- a/requirements.dev.txt +++ /dev/null @@ -1 +0,0 @@ --e .[dev] diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..b319f35 --- /dev/null +++ b/requirements.in @@ -0,0 +1,7 @@ +appdirs +click +requests +openpyxl +pony +pyyaml +six diff --git a/requirements.txt b/requirements.txt index d6e1198..8666e11 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.py b/setup.py deleted file mode 100644 index f28fcab..0000000 --- a/setup.py +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Note: Taken from here: https://github.com/kennethreitz/setup.py - -# Note: To use the 'upload' functionality of this file, you must: -# $ pip install twine - -import io -import os -import sys -from shutil import rmtree - -from setuptools import find_packages, setup, Command - -# Package meta-data. -VERSION = "18.0.4" - -NAME = "okta-cli" -DESCRIPTION = ( - "An Okta command line interface for scripting and quickly performing routine tasks" -) -URL = "https://github.com/flypenguin/okta-cli" -EMAIL = "ab@a3b3.de" -AUTHOR = "Axel Bock" -REQUIRES_PYTHON = ">=3.7.0, <3.11" - -REQUIRED = [ - "appdirs", - "click", - "requests", - "openpyxl", - "pony", - "pyyaml", - "six", # dotted remainders ... -] - -EXTRAS = [ - "bumpversion", - "pre-commit", - "pytest", - "responses", - "tox", - "twine", - "wheel", -] - -# The rest you shouldn't have to touch too much :) -# ------------------------------------------------ -# Except, perhaps the License and Trove Classifiers! - -here = os.path.abspath(os.path.dirname(__file__)) - -# Import the README and use it as the long-description. -# Note: this will only work if 'README.md' is present in your MANIFEST.in file! -try: - with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f: - long_description = "\n" + f.read() -except FileNotFoundError: - long_description = DESCRIPTION - -# Load the package's __version__.py module as a dictionary. -about = {} -if not VERSION: - with open(os.path.join(here, NAME, "__version__.py")) as f: - exec(f.read(), about) -else: - about["__version__"] = VERSION - - -class UploadCommand(Command): - """Support setup.py upload.""" - - description = "Build and publish the package." - user_options = [] - - @staticmethod - def status(s): - """Prints things in bold.""" - print("\033[1m{0}\033[0m".format(s)) - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - try: - self.status("Removing previous builds…") - rmtree(os.path.join(here, "dist")) - except OSError: - pass - - self.status("Building Source and Wheel (universal) distribution…") - os.system("{0} setup.py sdist bdist_wheel --universal".format(sys.executable)) - - self.status("Uploading the package to PyPI via Twine…") - os.system("twine upload dist/*") - - self.status("Pushing git tags ...") - os.system("git tag v{0}".format(about["__version__"])) - os.system("git push --tags") - - sys.exit() - - -# Where the magic happens: -setup( - name=NAME, - version=about["__version__"], - description=DESCRIPTION, - long_description=long_description, - long_description_content_type="text/markdown", - author=AUTHOR, - author_email=EMAIL, - python_requires=REQUIRES_PYTHON, - url=URL, - packages=find_packages(exclude=("tests",)), - entry_points={ - "console_scripts": ["okta-cli=oktacli:cli_main"], - }, - install_requires=REQUIRED, - extras_require={ - "dev": EXTRAS, - }, - include_package_data=True, - license="MIT", - 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", - ], - # $ setup.py publish support. - cmdclass={ - "upload": UploadCommand, - }, -)