diff --git a/.fossa.yml b/.fossa.yml deleted file mode 100644 index 7a283dd20..000000000 --- a/.fossa.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Generated by FOSSA CLI (https://github.com/fossas/fossa-cli) -# Visit https://fossa.com to learn more - -version: 2 -cli: - server: https://app.fossa.com - fetcher: custom - project: jira -analyze: - modules: - - name: . - type: pip - target: . - path: . - options: - strategy: requirements diff --git a/.gitchangelog.rc b/.gitchangelog.rc deleted file mode 100644 index 09b45b543..000000000 --- a/.gitchangelog.rc +++ /dev/null @@ -1,37 +0,0 @@ -ignore_regexps = [ - # ignore trivial fixes - r'Auto-generating.*', - r'spelling|typo', - r'bump.*version', - # all merged commits in the PR will appear in changelog anyway so - # the PR merge commit is not needed. - r'Merge pull request #\d+ from.*' -] - -section_regexps = [ - ('Other', None), ## Match all lines -] - - -empty_string = lambda _: '' -body_process = empty_string - - -subject_process = (strip | - ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') | - ucfirst | final_dot) - - -tag_filter_regexp = r'^[0-9]+\.[0-9]+(\.[0-9]+)?$' - - -unreleased_version_label = "Upcoming release (unreleased changes)" - - -output_engine = rest_py -#output_engine = mustache("restructuredtext") -#output_engine = mustache("markdown") -#output_engine = makotemplate("restructuredtext") - - -include_merge = True diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index b009dfb9d..000000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -lts/* diff --git a/Makefile b/Makefile deleted file mode 100644 index ce7f12c21..000000000 --- a/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -all: info clean lint test docs dist -.PHONY: all docs info req dist - -PACKAGE_NAME := $(shell python setup.py --name) -PACKAGE_VERSION := $(shell python setup.py --version) -PYTHON_PATH := $(shell which python) -PLATFORM := $(shell uname -s | awk '{print tolower($$0)}') -ifeq ($(PLATFORM), darwin) - DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -else - DIR := $(shell dirname $(realpath $(MAKEFILE_LIST))) -endif -PYTHON_VERSION := $(shell python3 -c "import sys; print('py%s%s' % sys.version_info[0:2] + ('-conda' if 'conda' in sys.version or 'Continuum' in sys.version else ''))") -ifneq (,$(findstring conda, $(PYTHON_VERSION))) - #CONDA := $(shell conda info --envs | grep '*' | awk '{print $$1}') - CONDA := $(CONDA_DEFAULT_ENV) -endif - -PREFIX := -ifndef GIT_BRANCH -GIT_BRANCH=$(shell git branch | sed -n '/\* /s///p') -endif - -info: - @echo "INFO: Building $(PACKAGE_NAME):$(PACKAGE_VERSION) on $(GIT_BRANCH) branch" - @echo "INFO: Python $(PYTHON_VERSION) from '$(PREFIX)' [$(CONDA)]" - -clean: - @find . -name "*.pyc" -delete - @rm -rf .tox dist/* docs/build/* - -package: - python setup.py sdist bdist_wheel build_sphinx - -req: - @$(PREFIX)requires.io update-site -t ac3bbcca32ae03237a6aae2b02eb9411045489bb -r $(PACKAGE_NAME) - -install: prepare - $(PREFIX)pip install . - -# https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/install-the-atlassian-sdk-on-a-linux-or-mac-system#InstalltheAtlassianSDKonaLinuxorMacsystem-Homebrew -install-sdk: -ifeq ($(PLATFORM), darwin) - which atlas-run-standalone || brew tap atlassian/tap && brew install atlassian/tap/atlassian-plugin-sdk -else ifeq ($(PLATFORM), linux) - ifneq ($(USER), root) - @echo "Install of Atlassian SDK must be run as root (or with sudo)" - exit 1 - endif - ifneq ($(wildcard /etc/debian_version),) - sh -c 'echo "deb https://packages.atlassian.com/atlassian-sdk-deb stable contrib" >/etc/apt/sources.list.d/atlassian_development.list' - curl -fsSL https://packages.atlassian.com/api/gpg/key/public | apt-key add - - apt-get install apt-transport-https - apt-get update - apt-get install atlassian-plugin-sdk - else ifneq ($(wildcard /etc/redhat-release),) - tmp_dir=$(mktemp -d) - curl https://marketplace.atlassian.com/download/plugins/atlassian-plugin-sdk-rpm/version/42380 -o ${tmp_dir}/atlassian-plugin-sdk.noarch.rpm - yum -y install ${tmp_dir}/atlassian-plugin-sdk.noarch.rpm - rm -rf ${tmp_dir} - else - @echo "Error: Cannot determine package manager to use to install atlassian-sdk. Please see:" - @echo "https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/install-the-atlassian-sdk-on-a-linux-or-mac-system" - exit 1 - endif -endif - -uninstall: - $(PREFIX)pip uninstall -y $(PACKAGE_NAME) - -dist: - $(PREFIX)python setup.py sdist bdist_wheel - -prepare: - @pyenv install -s 3.6.9 - @pyenv install -s 3.7.4 - @pyenv local 3.6.9 3.7.4 - @echo "INFO: === Preparing to run for package:$(PACKAGE_NAME) platform:$(PLATFORM) py:$(PYTHON_VERSION) dir:$(DIR) ===" - #if [ -f ${HOME}/testspace/testspace ]; then ${HOME}/testspace/testspace config url ${TESTSPACE_TOKEN}@pycontribs.testspace.com/jira/tests ; fi; - -testspace: - ${HOME}/testspace/testspace publish build/results.xml - -lint: - @echo "INFO: linting...." - $(PREFIX)tox -e lint - -test: prepare lint - @echo "INFO: test" - $(PREFIX)python setup.py build test build_sphinx sdist bdist_wheel check --restructuredtext --strict - -test-all: - @echo "INFO: test-all (extended/matrix tests)" - # tox should not run inside virtualenv because it does create and use multiple virtualenvs - pip install -q tox tox-pyenv - python -m tox - -docs: - @echo "INFO: Building the docs" - $(PREFIX)pip install sphinx sphinx_rtd_theme - $(PREFIX)python setup.py build_sphinx - @mkdir -p docs/build/docset - @mkdir -p docs/build/html/docset - -tag: - bumpversion --feature --no-input - git push origin main - git push --tags diff --git a/bindep.txt b/bindep.txt deleted file mode 100644 index 05c9df6ca..000000000 --- a/bindep.txt +++ /dev/null @@ -1,4 +0,0 @@ -gcc [platform:rpm] -krb5-devel [platform:rpm] -krb5-workstation [platform:rpm] -python3-devel [platform:rpm] diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 18081029e..000000000 --- a/docs/Makefile +++ /dev/null @@ -1,154 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -W -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = $(abspath build) -SOURCE_DATE_EPOCH = $(shell git log -1 --format=%ct) - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - -clean: - -rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in file://$(BUILDDIR)/html/index.html" - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in file://$(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/JIRAPythonClient.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/JIRAPythonClient.qhc" - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/JIRAPythonClient" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/JIRAPythonClient" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." diff --git a/jira/jirashell.py b/jira/jirashell.py index 39605229b..18525480a 100644 --- a/jira/jirashell.py +++ b/jira/jirashell.py @@ -302,7 +302,8 @@ def handle_basic_auth(auth, server): else: print("Getting password from keyring...") password = keyring.get_password(server, auth["username"]) - assert password, "No password provided!" + if not password: + raise ValueError("No password provided!") return auth["username"], password diff --git a/pyproject.toml b/pyproject.toml index 1ce0c5d16..b518a16f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,39 @@ [build-system] -requires = [ - "setuptools >= 41.0.0", - "setuptools_scm >= 1.15.0", - "setuptools_scm_git_archive >= 1.0", - "wheel", -] +requires = ["setuptools >= 60.0.0", "setuptools_scm[toml] >= 7.0.0"] build-backend = "setuptools.build_meta" -[project] -requires-python = ">=3.8" + +# Setuptools config +# Equivalent to use_scm_version=True +[tool.setuptools_scm] + +# Tool Config +[tool.isort] +profile = "black" +src_paths = ["jira", "tests"] + + +[tool.pytest.ini_options] +minversion = "6.0" +testpaths = ["tests"] +python_files = ["test_*.py", "tests.py"] +addopts = '''-p no:xdist --durations=10 --tb=long -rxX -v --color=yes + --junitxml=build/results.xml + --cov-report=xml --cov jira''' + +# these are important for distributed testing, to speedup their execution we minimize what we sync +rsyncdirs = ". jira demo docs" +rsyncignore = ".git" + +# pytest-timeout, delete_project on jira cloud takes >70s +timeout = 80 + +# avoid useless warnings related to coverage skips +filterwarnings = ["ignore::pytest.PytestWarning"] + +markers = ["allow_on_cloud: opt in for the test to run on Jira Cloud"] + + +[tool.mypy] +python_version = 3.8 +warn_unused_configs = true +namespace_packages = true diff --git a/setup.cfg b/setup.cfg index fd6708fda..b57ad13df 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,15 +43,10 @@ packages = jira [options] -use_scm_version = True python_requires = >=3.8 packages = find: include_package_data = True zip_safe = False -# These are required during `setup.py` run: -setup_requires = - setuptools_scm >= 1.15.0 - setuptools_scm_git_archive >= 1.0 install_requires = defusedxml packaging @@ -105,20 +100,7 @@ console_scripts = [options.package_data] jira = jira/py.typed -[egg_info] -egg_base = . - -[aliases] -test=pytest - -[build_sphinx] -source-dir = docs -build-dir = docs/build -all_files = 1 - -[upload_sphinx] -upload-dir = docs/build/html - +# No pyproject support: https://github.com/PyCQA/flake8/issues/234 [flake8] format = pylint exclude = @@ -131,40 +113,3 @@ statistics=yes ignore = E741,W503,W504,H,E501,E203 # 88 is official black default: max-line-length = 88 - -[isort] -# start - black compatible settings -multi_line_output = 3 -include_trailing_comma = True -force_grid_wrap = 0 -use_parentheses = True -ensure_newline_before_comments = True -line_length = 88 -# end - black compatible settings -known_first_party = - jira - tests - -[tool:pytest] -norecursedirs = . jira _build tmp* lib/third lib *.egg bin distutils build docs demo -python_files = *.py -addopts = -p no:xdist --durations=10 --tb=long -rxX -v --color=yes --junitxml=build/results.xml --cov-report=xml --cov jira - -testpaths = tests - -# these are important for distributed testing, to speedup their execution we minimize what we sync -rsyncdirs = . jira demo docs -rsyncignore = .git - -# pytest-timeout, delete_project on jira cloud takes >70s -timeout = 80 - -# avoid useless warnings related to coverage skips -filterwarnings = - ignore::pytest.PytestWarning - -markers = - allow_on_cloud: opt in for the test to run on Jira Cloud - -[mypy] -python_version = 3.8 diff --git a/setup.py b/setup.py deleted file mode 100644 index a5bf1b484..000000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -# !/usr/bin/env python -import setuptools - -if __name__ == "__main__": - setuptools.setup(use_scm_version=True) diff --git a/tests/test_shell.py b/tests/test_shell.py index aec6490ff..18b5a3e9a 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -68,7 +68,7 @@ def test_no_password_try_keyring( assert len(requests_mock.request_history) == 0 captured = capsys.readouterr() - assert captured.err == "No password provided!\nassert ''\n" + assert "No password provided!" == captured.err.strip() assert "Getting password from keyring..." == captured.out.strip() assert mock_keyring._keyring == {} diff --git a/tox.ini b/tox.ini index 7c389b8a3..161c89027 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] minversion = 3.8.0 +isolated_build = True requires = tox-extra tox-pyenv @@ -105,7 +106,7 @@ skip_install = true commands = # build wheel and sdist using PEP-517 {envpython} -c 'import os.path, shutil, sys; \ - dist_dir = os.path.join("{toxinidir}", "dist"); \ + dist_dir = os.path.join(r"{toxinidir}", "dist"); \ os.path.isdir(dist_dir) or sys.exit(0); \ print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \ shutil.rmtree(dist_dir)' @@ -119,7 +120,7 @@ commands = # Check if cli was installed jirashell --help # Uninstall the wheel - pip uninstall -y jira + {envpython} -m pip uninstall -y jira [testenv:lint] deps = pre-commit>=1.17.0