Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update best practices #217

Merged
merged 21 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c29955f
Collapse skeleton history. Workaround for jaraco/skeleton#87.
jaraco Jul 4, 2023
6e19647
Merge https://github.com/jaraco/skeleton into feature/skeleton
jaraco Jul 4, 2023
972d1b3
Add links to project home page and pypi. Fixes jaraco/skeleton#77.
jaraco Jul 6, 2023
747c2a3
Replace redundant step names with simple 'Run'.
jaraco Jul 6, 2023
c43962a
Remove TOX_WORK_DIR workaround, no longer necessary with tox 4. Ref t…
jaraco Jul 11, 2023
0e2032c
Pin against sphinx 7.2.5 as workaround for sphinx/sphinx-doc#11662. C…
jaraco Aug 31, 2023
92d2d8e
Allow GITHUB_* settings to pass through to tests.
jaraco Sep 1, 2023
f3dc1f4
Remove spinner disablement. If it's not already fixed upstream, that'…
jaraco Sep 1, 2023
0484daa
Clean up 'color' environment variables.
jaraco Sep 1, 2023
b02bf32
Add diff-cover check to Github Actions CI. Closes jaraco/skeleton#90.
jaraco Sep 10, 2023
a6256e2
Add descriptions to the tox environments. Closes jaraco/skeleton#91.
jaraco Sep 10, 2023
928e9a8
Add FORCE_COLOR to the TOX_OVERRIDE for GHA. Requires tox 4.11.1. Clo…
jaraco Sep 10, 2023
ca1831c
Prefer ``pass_env`` in tox config. Preferred failure mode for tox-dev…
jaraco Sep 18, 2023
fe9018c
Merge https://github.com/jaraco/skeleton into feature/skeleton
jaraco Nov 5, 2023
cf6fb0c
Merge branch 'main' into feature/skeleton
jaraco Nov 5, 2023
03f03e7
Limit sphinxlint jobs to 1. Workaround for sphinx-contrib/sphinx-lint…
jaraco Nov 5, 2023
4673d63
Merge https://github.com/jaraco/skeleton into feature/skeleton
jaraco Nov 5, 2023
6ec501a
Merge branch 'main' into feature/skeleton
jaraco Nov 5, 2023
a49aff3
Merge branch 'main' into feature/skeleton
jaraco Nov 5, 2023
03c6392
Allow diffcov to fail also, as it requires the tests to pass on the l…
jaraco Nov 5, 2023
6e6ee97
Remove newsfragment
jaraco Nov 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
omit =
# leading `*/` for pytest-dev/pytest-cov#456
*/.tox/*
disable_warnings =
couldnt-parse

[report]
show_missing = True
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
end_of_line = lf

[*.py]
indent_style = space
max_line_length = 88

[*.{yml,yaml}]
indent_style = space
indent_size = 2

[*.rst]
indent_style = space
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-type: "all"
94 changes: 83 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ name: tests

on: [push, pull_request]

permissions:
contents: read

env:
# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1

# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_PYTHON_VERSION_WARNING: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'

# Ensure tests can sense settings about the environment
TOX_OVERRIDE: >-
testenv.pass_env+=GITHUB_*,FORCE_COLOR

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
Expand All @@ -11,29 +27,66 @@ jobs:
strategy:
matrix:
python:
# Build on pre-releases until stable, then stable releases.
# actions/setup-python#213
- ~3.7.0-0
- ~3.10.0-0
- ~3.11.0-0
- "3.8"
- "3.11"
- "3.12"
platform:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- platform: ubuntu-latest
python: 'pypy3.9'
- python: "3.9"
platform: ubuntu-latest
- python: "3.10"
platform: ubuntu-latest
- python: pypy3.9
platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.12' }}
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install tox
run: |
python -m pip install tox
- name: Run tests
- name: Run
run: tox

diffcov:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.python == '3.12' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
- name: Evaluate coverage
run: tox
env:
TOXENV: diffcov

docs:
runs-on: ubuntu-latest
env:
TOXENV: docs
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
- name: Install tox
run: |
python -m pip install tox
- name: Run
run: tox

test_cygwin:
Expand Down Expand Up @@ -103,8 +156,27 @@ jobs:
env:
VIRTUALENV_NO_SETUPTOOLS: null

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- test
- docs
- test_cygwin

runs-on: ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

release:
needs: test
permissions:
contents: write
needs:
- check
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

Expand All @@ -113,11 +185,11 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: 3.11-dev
- name: Install tox
run: |
python -m pip install tox
- name: Release
- name: Run
run: tox -e release
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
12 changes: 12 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
python:
install:
- path: .
extra_requirements:
- docs

# required boilerplate readthedocs/readthedocs.org#10401
build:
os: ubuntu-22.04
tools:
python: "3"
17 changes: 17 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Empty file added NEWS.rst
Empty file.
23 changes: 23 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
.. image:: https://img.shields.io/pypi/v/distutils.svg
:target: https://pypi.org/project/distutils

.. image:: https://img.shields.io/pypi/pyversions/distutils.svg

.. image:: https://github.com/pypa/distutils/workflows/tests/badge.svg
:target: https://github.com/pypa/distutils/actions?query=workflow%3A%22tests%22
:alt: tests

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: Black

.. .. image:: https://readthedocs.org/projects/PROJECT_RTD/badge/?version=latest
.. :target: https://PROJECT_RTD.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/badge/skeleton-2023-informational
:target: https://blog.jaraco.com/skeleton

Python Module Distribution Utilities extracted from the Python Standard Library

Synchronizing
Expand Down
45 changes: 45 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
extensions = [
'sphinx.ext.autodoc',
'jaraco.packaging.sphinx',
]

master_doc = "index"
html_theme = "furo"

# Link dates and other references in the changelog
extensions += ['rst.linker']
link_files = {
'../NEWS.rst': dict(
using=dict(GH='https://github.com'),
replace=[
dict(
pattern=r'(Issue #|\B#)(?P<issue>\d+)',
url='{package_url}/issues/{issue}',
),
dict(
pattern=r'(?m:^((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n)',
with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n',
),
dict(
pattern=r'PEP[- ](?P<pep_number>\d+)',
url='https://peps.python.org/pep-{pep_number:0>4}/',
),
],
)
}

# Be strict about any broken references
nitpicky = True

# Include Python intersphinx mapping to prevent failures
# jaraco/skeleton#51
extensions += ['sphinx.ext.intersphinx']
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}

# Preserve authored syntax for defaults
autodoc_preserve_defaults = True

# for distutils, disable nitpicky
nitpicky = False
8 changes: 8 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:tocdepth: 2

.. _changes:

History
*******

.. include:: ../NEWS (links).rst
21 changes: 21 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Welcome to |project| documentation!
===================================

.. sidebar-links::
:home:
:pypi:

.. toctree::
:maxdepth: 1

history
distutils/index


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

5 changes: 5 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[mypy]
ignore_missing_imports = True
# required to support namespace packages
# https://github.com/python/mypy/issues/14057
explicit_package_bases = True
13 changes: 5 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[build-system]
requires = ["setuptools>=56", "setuptools_scm[toml]>=3.4.1"]
build-backend = "setuptools.build_meta"

[tool.black]
skip-string-normalization = true

[tool.pytest-enabler.black]
addopts = "--black"

[tool.pytest-enabler.flake8]
addopts = "--flake8"

[tool.pytest-enabler.cov]
addopts = "--cov"
[tool.setuptools_scm]
24 changes: 18 additions & 6 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
[pytest]
norecursedirs=dist build .tox .eggs
addopts=--doctest-modules
filterwarnings=
# Suppress deprecation warning in flake8
ignore:SelectableGroups dict interface is deprecated::flake8
## upstream

# Ensure ResourceWarnings are emitted
default::ResourceWarning

# shopkeep/pytest-black#55
ignore:<class 'pytest_black.BlackItem'> is not using a cooperative constructor:pytest.PytestDeprecationWarning
ignore:The \(fspath. py.path.local\) argument to BlackItem is deprecated.:pytest.PytestDeprecationWarning
ignore:BlackItem is an Item subclass and should not be a collector:pytest.PytestWarning

# tholo/pytest-flake8#83
ignore:<class 'pytest_flake8.Flake8Item'> is not using a cooperative constructor:pytest.PytestDeprecationWarning
ignore:The \(fspath. py.path.local\) argument to Flake8Item is deprecated.:pytest.PytestDeprecationWarning
ignore:Flake8Item is an Item subclass and should not be a collector:pytest.PytestWarning
# shopkeep/pytest-black#67
ignore:'encoding' argument not specified::pytest_black

# realpython/pytest-mypy#152
ignore:'encoding' argument not specified::pytest_mypy

# python/cpython#100750
ignore:'encoding' argument not specified::platform

# pypa/build#615
ignore:'encoding' argument not specified::build.env

## end upstream

# acknowledge that TestDistribution isn't a test
ignore:cannot collect test class 'TestDistribution'
Expand Down
Loading
Loading