Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Alternatively, consider using https://pre-commit.ci/
name: pre-commit checks

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
name: pre-commit-hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- uses: pre-commit/[email protected]
87 changes: 77 additions & 10 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,98 @@
name: Publish to PyPI

on:
pull_request:
workflow_dispatch:
inputs:
upload_dest:
type: choice
description: Upload wheels to
options:
- No Upload
- PyPI
- Test PyPI
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

permissions: {}

jobs:
build_and_deploy:
build-artifacts:
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.8"
python-version: "3.9"
- name: Install build dependencies
run: python -m pip install setuptools wheel
- name: Build wheel
run: python setup.py sdist bdist_wheel
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build wheel and sdist
run: python -m build
- uses: actions/upload-artifact@v4
with:
name: releases
path: dist
if-no-files-found: error
- name: Check with twine
run: python -m twine check --strict dist/*

upload-to-test-pypi:
needs: build-artifacts
runs-on: ubuntu-latest
if: github.repository == 'pytoolz/toolz' && (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' && github.event.inputs.upload_dest == 'Test PyPI')

environment:
name: test-pypi
url: https://test.pypi.org/p/toolz
permissions:
contents: read
id-token: write

steps:
- uses: actions/download-artifact@v5
with:
name: releases
path: dist
- name: Publish to Test-PyPI
uses: pypa/[email protected]
with:
print-hash: true
verbose: true

upload-to-pypi:
needs: build-artifacts
runs-on: ubuntu-latest
if: github.repository == 'pytoolz/toolz' && startsWith(github.ref, 'refs/tags/') && (github.event_name != 'workflow_dispatch' || github.event.inputs.upload_dest == 'PyPI')

environment:
name: pypi
url: https://pypi.org/p/toolz
permissions:
contents: read
id-token: write

steps:
- uses: actions/download-artifact@v5
with:
name: releases
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.11
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
print-hash: true
verbose: true
21 changes: 12 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test

on:
push:
branches: [ master ]
branches: [master]
pull_request:

jobs:
Expand All @@ -13,34 +13,37 @@ jobs:
matrix:
os: ["ubuntu-latest"]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14-dev"
- "pypy-3.8"
- "3.13t"
- "3.14"
- "3.14t"
- "pypy-3.9"
- "pypy-3.10"
- "pypy-3.11"
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install coverage pep8 pytest
pip install coverage pycodestyle pytest
pip install -e .
- name: PyTest
- name: Pytest
run: |
coverage run -m pytest --doctest-modules toolz/
pytest bench/
pep8 --ignore="E731,W503,E402" --exclude=conf.py,tests,examples,bench -r --show-source .
pycodestyle --ignore="E731,W503,W504,E402" --exclude=conf.py,tests,examples,bench -r --show-source .
- name: Coverage
if: (! contains(matrix.python-version, 'pypy'))
run: |
Expand Down
66 changes: 66 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
fail_fast: false
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# Sanity checks
- id: check-added-large-files
- id: check-case-conflict
- id: check-illegal-windows-names
- id: check-merge-conflict
# Checks based on file type
- id: check-ast
- id: check-toml
# Detect mistakes
- id: check-vcs-permalinks
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: forbid-submodules
# Automatic fixes
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
- id: name-tests-test
args: ["--pytest-test-first"]
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.24.1
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.0
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
types_or: [python, markdown, rst, toml, yaml]
additional_dependencies:
- tomli; python_version<'3.11'
files: ^(toolz|tlz|docs)/
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-eval
- id: python-no-log-warn
- id: text-unicode-replacement-char
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.34.1
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ python:
install:
- requirements: doc/requirements.txt
- method: pip
path: .
path: .
11 changes: 7 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
recursive-include toolz *
recursive-include tlz *
include AUTHORS.md
include LICENSE.txt

include toolz/tests/*.py
include versioneer.py
include toolz/_version.py
include MANIFEST.in
include README.rst
include pyproject.toml
global-exclude *.pyc *~ *.bak *.swp *.swo *.pyo *.so
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This builds a standard wordcount function from pieces within ``toolz``:
Dependencies
------------

``toolz`` supports Python 3.8+ with a common codebase.
``toolz`` supports Python 3.9+ with a common codebase.
It is pure Python and requires no dependencies beyond the standard
library.

Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx
furo
furo
28 changes: 13 additions & 15 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# Toolz documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 22 18:06:00 2013.
#
Expand Down Expand Up @@ -41,8 +39,8 @@
master_doc = 'index'

# General information about the project.
project = u'Toolz'
copyright = u'2013, Matthew Rocklin, John Jacobsen'
project = 'Toolz'
copyright = '2013, Matthew Rocklin, John Jacobsen'

# 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 Expand Up @@ -185,8 +183,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Toolz.tex', u'Toolz Documentation',
u'Matthew Rocklin, John Jacobsen', 'manual'),
('index', 'Toolz.tex', 'Toolz Documentation',
'Matthew Rocklin, John Jacobsen', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -215,8 +213,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'toolz', u'Toolz Documentation',
[u'Matthew Rocklin, John Jacobsen'], 1)
('index', 'toolz', 'Toolz Documentation',
['Matthew Rocklin, John Jacobsen'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -229,8 +227,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Toolz', u'Toolz Documentation',
u'Matthew Rocklin, John Jacobsen', 'Toolz', 'One line description of project.',
('index', 'Toolz', 'Toolz Documentation',
'Matthew Rocklin, John Jacobsen', 'Toolz', 'One line description of project.',
'Miscellaneous'),
]

Expand All @@ -247,10 +245,10 @@
# -- Options for Epub output ---------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = u'Toolz'
epub_author = u'Matthew Rocklin, John Jacobsen'
epub_publisher = u'Matthew Rocklin, John Jacobsen'
epub_copyright = u'2013, Matthew Rocklin, John Jacobsen'
epub_title = 'Toolz'
epub_author = 'Matthew Rocklin, John Jacobsen'
epub_publisher = 'Matthew Rocklin, John Jacobsen'
epub_copyright = '2013, Matthew Rocklin, John Jacobsen'

# The language of the text. It defaults to the language option
# or en if the language is not set.
Expand All @@ -273,7 +271,7 @@
# The format is a list of tuples containing the path and title.
#epub_pre_files = []

# HTML files shat should be inserted after the pages created by sphinx.
# HTML files that should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []

Expand Down
2 changes: 1 addition & 1 deletion doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ three ways:

1. Toolz is pure Python
2. Toolz relies only on the standard library
3. Toolz simultaneously supports Python versions 3.8+ and PyPy
3. Toolz simultaneously supports Python versions 3.9+ and PyPy
2 changes: 1 addition & 1 deletion doc/source/laziness.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ In this case ``frequencies`` is a sort of reduction. At no time were more than
a few hundred bytes of Tale of Two Cities necessarily in memory. We could just
have easily done this computation on the entire Gutenberg collection or on
Wikipedia. In this case we are limited by the size and speed of our hard drive
and not by the capacity of our memory.
and not by the capacity of our memory.
Loading