From a9a050d0e3ea5a194706bc1cb601f9a19f9c0b32 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 13 Aug 2020 17:01:22 +0100 Subject: [PATCH] Latest updates from PyScaffold 4.0 development branch --- .cirrus.yml | 16 ++-- .gitignore | 2 +- .isort.cfg | 13 +-- .pre-commit-config.yaml | 6 +- README.rst | 19 +++- docs/Makefile | 192 +++----------------------------------- docs/conf.py | 107 +++++++++++---------- pyproject.toml | 8 ++ setup.cfg | 49 +++++----- setup.py | 22 ++--- src/ci_tester/__init__.py | 15 ++- src/ci_tester/skeleton.py | 1 - tests/conftest.py | 1 - tests/test_skeleton.py | 2 - tests/travis_install.sh | 3 +- tox.ini | 52 ++++++++--- 16 files changed, 197 insertions(+), 311 deletions(-) create mode 100644 pyproject.toml diff --git a/.cirrus.yml b/.cirrus.yml index 418603f..c18fea3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -17,16 +17,16 @@ env: clean_workspace_script: # Avoid information carried from one run to the other - rm -rf .coverage junit-*.xml .tox - test_script: &test_script + test_script: &test # This script is also used in Windows, so the shell is not POSIX - - python -m tox -- -rfEx --color yes + - python -m tox -- -rfEx --durations 10 --color yes # ^ tox is better if invoked as a module on Windows/OSX # Task definitions: linux_mac_task: # Use custom cloning since otherwise git tags are missing - clone_script: &clone_script | + clone_script: &clone | if [ -z "$CIRRUS_PR" ]; then git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR git reset --hard $CIRRUS_CHANGE_IN_REPO @@ -122,13 +122,14 @@ windows_task: # Avoid information carried from one run to the other # CMD is not capable of globbing, so we have to use PowerShell - ps: (rm -Recurse -Force -ErrorAction SilentlyContinue .tox,junit-*.xml) - test_script: *test_script + test_script: *test coverage_task: name: coverage (Linux) - clone_script: *clone_script + clone_script: *clone container: {image: "python:3.6-buster"} + pip_cache: *pip-cache depends_on: - test (Linux - 3.6) - test (Linux - 3.7) @@ -138,10 +139,7 @@ coverage_task: - test (Windows) install_script: *debian-install pip_install_script: - pip install --user --upgrade - pytest pytest-cov pytest-virtualenv - coverage coveralls - flake8 pre-commit + pip install --user --upgrade coverage coveralls pre-commit precommit_script: - pre-commit install - pre-commit run --all-files diff --git a/.gitignore b/.gitignore index 05d12f0..77f0457 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,7 @@ tags htmlcov/* .coverage .tox -junit.xml +junit*.xml coverage.xml .pytest_cache/ diff --git a/.isort.cfg b/.isort.cfg index 487f517..643c32f 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,14 +1,3 @@ [settings] -line_length = 88 -force_grid_wrap = 0 -multi_line_output = 3 -include_trailing_comma = True -use_parentheses = True -# ^ Black-compatible -indent = ' ' -skip = .tox,.venv,build,dist -extra_standard_library = setuptools,pkg_resources -known_test = pytest +profile = black known_first_party = ci_tester -sections = FUTURE,STDLIB,TEST,THIRDPARTY,FIRSTPARTY,LOCALFOLDER -default_section = THIRDPARTY diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d462ce..4df2c06 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ exclude: '^docs/conf.py' repos: - repo: git://github.com/pre-commit/pre-commit-hooks - rev: v3.1.0 + rev: v3.2.0 hooks: - id: trailing-whitespace - id: check-added-large-files @@ -18,12 +18,12 @@ repos: args: ['--fix=no'] - repo: http://github.com/timothycrosley/isort - rev: 5.0.9 + rev: 5.4.1 hooks: - id: isort - repo: https://github.com/psf/black - rev: stable + rev: 19.10b0 hooks: - id: black language_version: python3 diff --git a/README.rst b/README.rst index 29a3c99..af2cc52 100644 --- a/README.rst +++ b/README.rst @@ -8,9 +8,26 @@ It should be updated (forcefully if necessary) every time a change that impacts integrations is made (a PR on PyScaffold's main repository that changes CI is expected to provide a companion PR to this repository). +Making Changes & Contributing +============================= + +This project uses `pre-commit`_, please make sure to install it before making any +changes:: + + $ pip install pre-commit + $ cd ci-tester + $ pre-commit install + +It is a good idea to update the hooks to the latest version:: + + pre-commit autoupdate + +Don't forget to tell your contributors to also install and use pre-commit. + +.. _pre-commit: http://pre-commit.com/ Note ==== -This project has been set up using PyScaffold 3.2.3.post0.dev40. For details and usage +This project has been set up using PyScaffold 3.2.3.post180+gc7877c4. For details and usage information on PyScaffold see https://pyscaffold.org/. diff --git a/docs/Makefile b/docs/Makefile index 5497d7c..fa2cc35 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,193 +1,29 @@ # Makefile for Sphinx documentation # -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = ../build/sphinx/ +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build AUTODOCDIR = api -AUTODOCBUILD = sphinx-apidoc -PROJECT = ci-tester -MODULEDIR = ../src/ci_tester # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +$(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/") endif -# 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 doc-requirements +.PHONY: help clean Makefile +# Put it first so that "make" without argument is like "make help". 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 " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @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 " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) clean: rm -rf $(BUILDDIR)/* $(AUTODOCDIR) -$(AUTODOCDIR): $(MODULEDIR) - mkdir -p $@ - $(AUTODOCBUILD) -f -o $@ $^ - -doc-requirements: $(AUTODOCDIR) - -html: doc-requirements - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: doc-requirements - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: doc-requirements - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: doc-requirements - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: doc-requirements - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: doc-requirements - $(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: doc-requirements - $(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/$(PROJECT).qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/$(PROJECT).qhc" - -devhelp: doc-requirements - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $HOME/.local/share/devhelp/$(PROJECT)" - @echo "# ln -s $(BUILDDIR)/devhelp $HOME/.local/share/devhelp/$(PROJEC)" - @echo "# devhelp" - -epub: doc-requirements - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -patch-latex: - find _build/latex -iname "*.tex" | xargs -- \ - sed -i'' 's~includegraphics{~includegraphics\[keepaspectratio,max size={\\textwidth}{\\textheight}\]{~g' - -latex: doc-requirements - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - $(MAKE) patch-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: doc-requirements - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - $(MAKE) patch-latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -latexpdfja: doc-requirements - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: doc-requirements - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: doc-requirements - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -texinfo: doc-requirements - $(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: doc-requirements - $(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: doc-requirements - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: doc-requirements - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: doc-requirements - $(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: doc-requirements - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -xml: doc-requirements - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -pseudoxml: doc-requirements - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py index f2a0d13..1a5ee27 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,9 +1,8 @@ -# -*- coding: utf-8 -*- -# # This file is execfile()d with the current directory set to its containing dir. # -# Note that not all possible configuration values are present in this -# autogenerated file. +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html # # All configuration values have a default; values that are commented out # serve to show the default. @@ -13,15 +12,18 @@ import inspect import shutil -__location__ = os.path.join(os.getcwd(), os.path.dirname( - inspect.getfile(inspect.currentframe()))) +# -- Path setup -------------------------------------------------------------- + +__location__ = os.path.join( + os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())) +) # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.join(__location__, '../src')) +sys.path.insert(0, os.path.join(__location__, "../src")) -# -- Run sphinx-apidoc ------------------------------------------------------ +# -- Run sphinx-apidoc ------------------------------------------------------- # This hack is necessary since RTD does not issue `sphinx-apidoc` before running # `sphinx-build -b html . _build/html`. See Issue: # https://github.com/rtfd/readthedocs.org/issues/1139 @@ -43,55 +45,63 @@ try: import sphinx - from pkg_resources import parse_version cmd_line_template = "sphinx-apidoc -f -o {outputdir} {moduledir}" cmd_line = cmd_line_template.format(outputdir=output_dir, moduledir=module_dir) args = cmd_line.split(" ") - if parse_version(sphinx.__version__) >= parse_version('1.7'): + if tuple(sphinx.__version__.split(".")) >= ("1", "7"): + # This is a rudimentary parse_version to avoid external dependencies args = args[1:] apidoc.main(args) except Exception as e: print("Running `sphinx-apidoc` failed!\n{}".format(e)) -# -- General configuration ----------------------------------------------------- +# -- General configuration --------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', - 'sphinx.ext.autosummary', 'sphinx.ext.viewcode', 'sphinx.ext.coverage', - 'sphinx.ext.doctest', 'sphinx.ext.ifconfig', 'sphinx.ext.mathjax', - 'sphinx.ext.napoleon'] +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx.ext.autosummary", + "sphinx.ext.viewcode", + "sphinx.ext.coverage", + "sphinx.ext.doctest", + "sphinx.ext.ifconfig", + "sphinx.ext.mathjax", + "sphinx.ext.napoleon", +] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'ci-tester' -copyright = u'2020, Anderson Bravalheri' +project = "ci-tester" +copyright = "2020, Anderson Bravalheri" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '' # Is set by calling `setup.py docs` +version = "" # Is set by calling `setup.py docs` # The full version, including alpha/beta/rc tags. -release = '' # Is set by calling `setup.py docs` +release = "" # Is set by calling `setup.py docs` # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -105,7 +115,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The reST default role (used for this markup: `text`) to use for all documents. # default_role = None @@ -122,7 +132,7 @@ # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -131,18 +141,18 @@ # keep_warnings = False -# -- Options for HTML output --------------------------------------------------- +# -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'alabaster' +html_theme = "alabaster" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. html_theme_options = { - 'sidebar_width': '300px', - 'page_width': '1200px' + "sidebar_width": "300px", + "page_width": "1200px" } # Add any paths that contain custom themes here, relative to this directory. @@ -172,7 +182,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. @@ -216,27 +226,24 @@ # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'ci_tester-doc' +htmlhelp_basename = "ci-tester-doc" -# -- Options for LaTeX output -------------------------------------------------- +# -- Options for LaTeX output ------------------------------------------------ latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -# 'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -# 'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -# 'preamble': '', + # The paper size ("letterpaper" or "a4paper"). + # "papersize": "letterpaper", + # The font size ("10pt", "11pt" or "12pt"). + # "pointsize": "10pt", + # Additional stuff for the LaTeX preamble. + # "preamble": "", } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'user_guide.tex', u'ci-tester Documentation', - u'Anderson Bravalheri', 'manual'), + ("index", "user_guide.tex", "ci-tester Documentation", "Anderson Bravalheri", "manual") ] # The name of an image file (relative to this directory) to place at the top of @@ -259,14 +266,14 @@ # If false, no module index is generated. # latex_domain_indices = True -# -- External mapping ------------------------------------------------------------ -python_version = '.'.join(map(str, sys.version_info[0:2])) +# -- External mapping -------------------------------------------------------- +python_version = ".".join(map(str, sys.version_info[0:2])) intersphinx_mapping = { - 'sphinx': ('http://www.sphinx-doc.org/en/stable', None), - 'python': ('https://docs.python.org/' + python_version, None), - 'matplotlib': ('https://matplotlib.org', None), - 'numpy': ('https://docs.scipy.org/doc/numpy', None), - 'sklearn': ('https://scikit-learn.org/stable', None), - 'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None), - 'scipy': ('https://docs.scipy.org/doc/scipy/reference', None), + "sphinx": ("http://www.sphinx-doc.org/en/stable", None), + "python": ("https://docs.python.org/" + python_version, None), + "matplotlib": ("https://matplotlib.org", None), + "numpy": ("https://docs.scipy.org/doc/numpy", None), + "sklearn": ("https://scikit-learn.org/stable", None), + "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None), + "scipy": ("https://docs.scipy.org/doc/scipy/reference", None), } diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cfda59d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,8 @@ +[build-system] +# AVOID CHANGING REQUIRES: IT WILL BE UPDATED BY PYSCAFFOLD! +requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=4.1.2", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +# See configuration details in https://github.com/pypa/setuptools_scm +version_scheme = "post-release" diff --git a/setup.cfg b/setup.cfg index b88aa40..1887e46 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,30 +11,40 @@ license = mozilla long-description = file: README.rst long-description-content-type = text/x-rst; charset=UTF-8 url = https://github.com/pyscaffold/pyscaffold/ +# Add here related links, for example: project-urls = Documentation = https://pyscaffold.org/ +# Source = https://github.com/pyscaffold/pyscaffold/ +# Tracker = https://github.com/pyscaffold/pyscaffold/issues +# Conda-Forge = https://anaconda.org/conda-forge/pyscaffold +# Download = https://pypi.org/project/PyScaffold/#files +# Twitter = https://twitter.com/PyScaffold + # Change if running only on Windows, Mac or Linux (comma-separated) platforms = any + # Add here all kinds of additional classifiers as defined under # https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers = Development Status :: 4 - Beta Programming Language :: Python + [options] zip_safe = False -packages = find: +packages = find_namespace: include_package_data = True package_dir = =src -# DON'T CHANGE THE FOLLOWING LINE! IT WILL BE UPDATED BY PYSCAFFOLD! -setup_requires = pyscaffold>=3.2a0,<3.3a0 -# Add here dependencies of your project (semicolon/line-separated), e.g. -# install_requires = numpy; scipy -# The usage of test_requires is discouraged, see `Dependency Management` docs -# tests_require = pytest; pytest-cov -# Require a specific Python version, e.g. Python 2.7 or >= 3.4 -# python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.* + +# Require a min/specific Python version (comma-separated conditions) +# python_requires = >=3.8 + +# Add here dependencies of your project (line-separated) +# TODO: Remove conditional dependencies according to `python_requires` above +install_requires = + importlib-metadata; python_version<"3.8" + [options.packages.find] where = src @@ -45,6 +55,7 @@ exclude = # Add here additional requirements for extra features, to install with: # `pip install ci-tester[PDF]` like: # PDF = ReportLab; RXP + # Add here test requirements (semicolon/line-separated) testing = pytest @@ -61,14 +72,8 @@ testing = # pyscaffold.cli = # awesome = pyscaffoldext.awesome.extension:AwesomeExtension -[test] -# py.test options when running `python setup.py test` -# addopts = --verbose -extras = True - [tool:pytest] -# Options for py.test: -# Specify command line options as you would do when invoking py.test directly. +# Specify command line options as you would do when invoking pytest directly. # e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml # in order to write a coverage file that can be read by Jenkins. addopts = @@ -79,18 +84,17 @@ norecursedirs = build .tox testpaths = tests +# Use pytest markers to select/deselect specific tests +# markers = +# slow: mark tests as slow (deselect with '-m "not slow"') [aliases] -dists = bdist_wheel +dists = sdist bdist_wheel [bdist_wheel] # Use this option if your package is pure-python universal = 1 -[build_sphinx] -source_dir = docs -build_dir = build/sphinx - [devpi:upload] # Options for the devpi: PyPI server and packaging tool # VCS export must be deactivated since we are using setuptools-scm @@ -113,10 +117,9 @@ exclude = [pyscaffold] # PyScaffold's parameters when the project was created. # This will be used when updating. Do not change! -version = 3.2.3.post132+g1564bfa.d20200716 +version = 3.3a1.post207+g263737a package = ci_tester extensions = cirrus pre_commit - tox travis diff --git a/setup.py b/setup.py index ea16ee7..b5c1970 100644 --- a/setup.py +++ b/setup.py @@ -1,22 +1,20 @@ -# -*- coding: utf-8 -*- """ Setup file for ci_tester. Use setup.cfg to configure your project. - This file was generated with PyScaffold 3.2.3.post132+g1564bfa.d20200716. + This file was generated with PyScaffold 3.3a1.post207+g263737a. PyScaffold helps you to put up the scaffold of your new Python project. Learn more under: https://pyscaffold.org/ """ -import sys -from pkg_resources import VersionConflict, require from setuptools import setup -try: - require("setuptools>=38.3") -except VersionConflict: - print("Error: version of setuptools is too old (<38.3)!") - sys.exit(1) - - if __name__ == "__main__": - setup(use_pyscaffold=True) + try: + setup(use_scm_version={"version_scheme": "post-release"}) + except: # noqa + print( + "\n\nAn error occurred while building the project, " + "please ensure you have the most updated version of setuptools with: " + "`pip install -U setuptools`\n\n" + ) + raise diff --git a/src/ci_tester/__init__.py b/src/ci_tester/__init__.py index 5924ae0..35bfeaa 100644 --- a/src/ci_tester/__init__.py +++ b/src/ci_tester/__init__.py @@ -1,11 +1,16 @@ -# -*- coding: utf-8 -*- -from pkg_resources import DistributionNotFound, get_distribution +import sys + +if sys.version_info[:2] >= (3, 8): + # TODO: Import directly (no need for conditional) when `python_requires = >= 3.8` + from importlib.metadata import PackageNotFoundError, version +else: + from importlib_metadata import PackageNotFoundError, version try: # Change here if project is renamed and does not equal the package name dist_name = "ci-tester" - __version__ = get_distribution(dist_name).version -except DistributionNotFound: + __version__ = version(dist_name) +except PackageNotFoundError: __version__ = "unknown" finally: - del get_distribution, DistributionNotFound + del version, PackageNotFoundError diff --git a/src/ci_tester/skeleton.py b/src/ci_tester/skeleton.py index 8c2b3c7..076f443 100644 --- a/src/ci_tester/skeleton.py +++ b/src/ci_tester/skeleton.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ This is a skeleton file that can serve as a starting point for a Python console script. To run this script uncomment the following lines in the diff --git a/tests/conftest.py b/tests/conftest.py index 2c78d50..11ec6fa 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Dummy conftest.py for ci_tester. diff --git a/tests/test_skeleton.py b/tests/test_skeleton.py index a35815b..d2327a4 100644 --- a/tests/test_skeleton.py +++ b/tests/test_skeleton.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import pytest from ci_tester.skeleton import fib diff --git a/tests/travis_install.sh b/tests/travis_install.sh index d80c447..c2a7f27 100644 --- a/tests/travis_install.sh +++ b/tests/travis_install.sh @@ -25,8 +25,7 @@ if [[ "$DISTRIB" == "conda" ]]; then # Use the miniconda installer for faster download / install of conda # itself - wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ - -O miniconda.sh + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh chmod +x miniconda.sh && ./miniconda.sh -b -p "$HOME/miniconda" fi export PATH=$HOME/miniconda/bin:$PATH diff --git a/tox.ini b/tox.ini index 2920bd0..b8bfd84 100644 --- a/tox.ini +++ b/tox.ini @@ -3,34 +3,64 @@ # THIS SCRIPT IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS! [tox] -minversion = 2.4 +minversion = 3.15 envlist = default [testenv] +description = invoke pytest to run automated tests +isolated_build = True setenv = TOXINIDIR = {toxinidir} passenv = HOME -commands = - py.test {posargs} extras = all testing +commands = + pytest {posargs} + -[testenv:doc] -description = invoke sphinx-build to build the HTML docs +[testenv:{clean,build}] +description = + Build (or clean) the package in isolation according to instructions in: + https://setuptools.readthedocs.io/en/latest/build_meta.html#how-to-use-it +# NOTE: pep517.build is transitional, please refer to the link for updates +skip_install = True +changedir = {toxinidir} +deps = + build: pep517 +commands = + clean: python -c 'from shutil import rmtree; rmtree("build", True); rmtree("dist", True)' + build: python -m pep517.build . + + +[testenv:{docs,doctests}] +description = invoke sphinx-build to build the docs/run doctests setenv = DOCSDIR = {toxinidir}/docs BUILDDIR = {toxinidir}/docs/_build + docs: BUILD = html + doctests: BUILD = doctest deps = sphinx # sphinx_rtd_theme + # any docs/requirements.txt for/shared with Read The Docs? commands = - sphinx-build -b html -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/html" {posargs} + sphinx-build -b {env:BUILD} -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/{env:BUILD}" {posargs} -[testenv:doctest] -description = invoke sphinx-build to run doctests -setenv = {[testenv:doc]setenv} -deps = {[testenv:doc]deps} + +[testenv:publish] +description = + Publish the package you have been developing to a package index server. + By default, it uses testpypi. If you really want to publish your package + to be publicly accessible in PyPI, use the `-- --repository pypi` option. +skip_install = True +changedir = {toxinidir} +passenv = + TWINE_USERNAME + TWINE_PASSWORD + TWINE_REPOSITORY +deps = twine commands = - sphinx-build -b doctest -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/doctest" {posargs} + python -m twine check dist/* + python -m twine upload {posargs:--repository testpypi} dist/*