Skip to content

Commit

Permalink
Update to PyScaffold v4.0b3
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jan 7, 2021
1 parent c9ed467 commit 2e3c9ac
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 36 deletions.
13 changes: 12 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Cirrus CI configuration file using the matrix feature
# Read more under https://cirrus-ci.org/guide/writing-tasks/
# THIS FILE IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS!
---
# Default values to be merged into tasks:
auto_cancellation: false
Expand All @@ -17,6 +20,10 @@ env:
folder: $PIP_CACHE
tox_install_script:
- python -m pip install --upgrade pip setuptools tox
prepare_script: &prepare
# This script is also used in Windows, so the shell is not POSIX
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
clean_workspace_script:
# Avoid information carried from one run to the other
- rm -rf .coverage junit-*.xml .tox
Expand Down Expand Up @@ -52,13 +59,16 @@ linux_mac_task:
- name: test (Linux - 3.8)
container: {image: "python:3.8-buster"}
install_script: *debian-install
- name: test (Linux - 3.9)
container: {image: "python:3.9-buster"}
install_script: *debian-install
- name: test (Linux - Anaconda)
container: {image: "continuumio/anaconda3:2019.03"}
install_script: *debian-install
extra_install_script:
- apt-get update
- apt-get install -y --fix-missing gcc python3-dev
# ^ Required by a weird conda bug... Aparently this is need for isolated builds
# ^ required by a weird conda bug - apparently this is needed for isolated builds
# https://cirrus-ci.com/task/5049814234693632?command=test#L251
- name: test (OS X)
osx_instance: {image: "catalina-xcode"}
Expand Down Expand Up @@ -130,6 +140,7 @@ windows_task:
- REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v Autorun /t REG_SZ /d "@chcp 65001>nul" /f
- python -m ensurepip
- python -m pip install --upgrade --user pip setuptools certifi tox
prepare_script: *prepare
clean_workspace_script:
# Avoid information carried from one run to the other
# CMD is not capable of globbing, so we have to use PowerShell
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ tags
# Unittest and coverage
htmlcov/*
.coverage
.coverage.*
.tox
junit*.xml
coverage.xml
Expand Down
29 changes: 23 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: '^docs/conf.py'

repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -15,20 +15,37 @@ repos:
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ['--fix=no']
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows

- repo: http://github.com/timothycrosley/isort
rev: 5.4.2
- repo: https://github.com/myint/autoflake.git
rev: v1.4
hooks:
- id: autoflake
args: [
--in-place,
--remove-all-unused-imports,
--remove-unused-variables,
]

- repo: https://github.com/pycqa/isort
rev: 5.7.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: stable
rev: 20.8b1
hooks:
- id: black
language_version: python3

- repo: https://github.com/asottile/blacken-docs
rev: v1.9.1
hooks:
- id: blacken-docs
additional_dependencies: [black]

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
rev: 3.8.4
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]
22 changes: 22 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

python:
version: 3.8
install:
- requirements: docs/requirements.txt
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@
# Read more under http://docs.travis-ci.com/user/build-configuration/
# THIS SCRIPT IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS!

sudo: false
language: python
git:
depth: false
env:
- PRE_COMMIT_HOME=$HOME/.cache/pre-commit
virtualenv:
system_site_packages: false
matrix:
jobs:
fast_finish: true
include:
- python: 3.6
env: DISTRIB="ubuntu" TOX_PYTHON_VERSION="py36" COVERAGE="true"
- python: 3.7
env: DISTRIB="ubuntu" TOX_PYTHON_VERSION="py37" COVERAGE="false"
- python: 3.8
env: DISTRIB="ubuntu" TOX_PYTHON_VERSION="py38" COVERAGE="false"
- python: 3.9
env: DISTRIB="ubuntu" TOX_PYTHON_VERSION="py39" COVERAGE="false"
- env: DISTRIB="conda" PYTHON_VERSION="3.6" COVERAGE="false"
install:
- source tests/travis_install.sh
before_script:
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
script:
- tox -e build
- tox
- |
if [[ "$COVERAGE" == "true" ]]; then
Expand All @@ -32,3 +42,4 @@ cache:
pip: true
directories:
- $HOME/miniconda
- $HOME/.cache/pre-commit
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ 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
pip install pre-commit
cd ci-tester
pre-commit install

It is a good idea to update the hooks to the latest version::

Expand All @@ -32,5 +32,5 @@ Don't forget to tell your contributors to also install and use pre-commit.
Note
====

This project has been set up using PyScaffold 4.0a2. For details and usage
This project has been set up using PyScaffold 4.0b3. For details and usage
information on PyScaffold see https://pyscaffold.org/.
6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
try:
import sphinx

cmd_line_template = "sphinx-apidoc -f -o {outputdir} {moduledir}"
cmd_line_template = (
"sphinx-apidoc --implicit-namespaces -f -o {outputdir} {moduledir}"
)
cmd_line = cmd_line_template.format(outputdir=output_dir, moduledir=module_dir)

args = cmd_line.split(" ")
Expand Down Expand Up @@ -92,7 +94,7 @@

# General information about the project.
project = "ci-tester"
copyright = "2020, Anderson Bravalheri"
copyright = "2021, 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
Expand Down
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Requirements file for ReadTheDocs, check .readthedocs.yml.
# To build the module reference correctly, make sure every external package
# under `install_requires` in `setup.cfg` is also listed here!
sphinx>=3.2.1
# sphinx_rtd_theme
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +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"]
requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# See configuration details in https://github.com/pypa/setuptools_scm
version_scheme = "post-release"
version_scheme = "no-guess-dev"
9 changes: 5 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ url = https://github.com/pyscaffold/pyscaffold/
project-urls =
Documentation = https://pyscaffold.org/
# Source = https://github.com/pyscaffold/pyscaffold/
# Changelog = https://pyscaffold.org/en/latest/changelog.html
# Tracker = https://github.com/pyscaffold/pyscaffold/issues
# Conda-Forge = https://anaconda.org/conda-forge/pyscaffold
# Download = https://pypi.org/project/PyScaffold/#files
Expand Down Expand Up @@ -58,6 +59,7 @@ exclude =
# Add here test requirements (semicolon/line-separated)
testing =
setuptools
pytest
pytest-cov
Expand All @@ -76,6 +78,8 @@ testing =
# 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.
# CAUTION: --cov flags may prohibit setting breakpoints while debugging.
# Comment those flags to avoid this py.test issue.
addopts =
--cov ci_tester --cov-report term-missing
--verbose
Expand All @@ -89,9 +93,6 @@ testpaths = tests
# slow: mark tests as slow (deselect with '-m "not slow"')
# system: mark end-to-end system tests
[aliases]
dists = sdist bdist_wheel
[bdist_wheel]
# Use this option if your package is pure-python
universal = 1
Expand All @@ -118,7 +119,7 @@ exclude =
[pyscaffold]
# PyScaffold's parameters when the project was created.
# This will be used when updating. Do not change!
version = 4.0a2.post10+g5176081
version = 4.0b3
package = ci_tester
extensions =
cirrus
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
Setup file for ci-tester.
Use setup.cfg to configure your project.
This file was generated with PyScaffold 4.0a2.post10+g5176081.
This file was generated with PyScaffold 4.0b3.post1.dev1+gcdef40f.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""
from setuptools import setup

if __name__ == "__main__":
try:
setup(use_scm_version={"version_scheme": "post-release"})
setup(use_scm_version={"version_scheme": "no-guess-dev"})
except: # noqa
print(
"\n\nAn error occurred while building the project, "
Expand Down
6 changes: 3 additions & 3 deletions src/ci_tester/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

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
from importlib.metadata import PackageNotFoundError, version # pragma: no cover
else:
from importlib_metadata import PackageNotFoundError, version
from importlib_metadata import PackageNotFoundError, version # pragma: no cover

try:
# Change here if project is renamed and does not equal the package name
dist_name = "ci-tester"
__version__ = version(dist_name)
except PackageNotFoundError:
__version__ = "unknown"
__version__ = "unknown" # pragma: no cover
finally:
del version, PackageNotFoundError
5 changes: 2 additions & 3 deletions src/ci_tester/skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def fib(n):
"""
assert n > 0
a, b = 1, 1
for i in range(n - 1):
for _i in range(n - 1):
a, b = b, a + b
return a

Expand Down Expand Up @@ -104,8 +104,7 @@ def main(args):


def run():
"""Entry point for console_scripts
"""
"""Entry point for console_scripts"""
main(sys.argv[1:])


Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
https://pytest.org/latest/plugins.html
- https://docs.pytest.org/en/stable/fixture.html
- https://docs.pytest.org/en/stable/writing_plugins.html
"""

# import pytest
15 changes: 9 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
minversion = 3.15
envlist = default


[testenv]
description = invoke pytest to run automated tests
isolated_build = True
Expand All @@ -24,14 +25,17 @@ commands =
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
https://github.com/pypa/pep517/issues/91
https://github.com/pypa/build
# NOTE: build is still experimental, please refer to the links for updates/issues
skip_install = True
changedir = {toxinidir}
deps =
build: pep517
build: build
commands =
clean: python -c 'from shutil import rmtree; rmtree("build", True); rmtree("dist", True)'
build: python -m pep517.build .
build: python -m build .
# By default `build` produces wheels, you can also explicitly use the flags `--sdist` and `--wheel`


[testenv:{docs,doctests}]
Expand All @@ -42,9 +46,8 @@ setenv =
docs: BUILD = html
doctests: BUILD = doctest
deps =
sphinx
# sphinx_rtd_theme
# any docs/requirements.txt for/shared with Read The Docs?
-r {toxinidir}/docs/requirements.txt
# ^ requirements.txt shared with Read The Docs
commands =
sphinx-build -b {env:BUILD} -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/{env:BUILD}" {posargs}

Expand Down

0 comments on commit 2e3c9ac

Please sign in to comment.