build: migrate setup.{cfg,py} => pyproject.toml

This commit is contained in:
Casper da Costa-Luis 2023-06-05 14:09:50 +01:00
parent f44f5b96ec
commit 2efa1e8224
No known key found for this signature in database
GPG Key ID: F5126E5FBD2512AD
13 changed files with 181 additions and 211 deletions

2
.github/CODEOWNERS vendored
View File

@ -6,8 +6,6 @@ LICENCE @tqdm/maintainers
.github/* @github/pages
# @mention if >= 30%
DEMO.ipynb @casperdcl @martinzugnoni
demo.yml @casperdcl @martinzugnoni
codecov.yml @lrq3000
setup.py @casperdcl @lrq3000
tqdm/_tqdm_notebook.py @lrq3000 @casperdcl
tests/tests_pandas.py @casperdcl @chengs

View File

@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
TOXENV:
- setup.py
- check
- perf
runs-on: ubuntu-latest
steps:

6
.meta/nbval.ini Normal file
View File

@ -0,0 +1,6 @@
[regex1]
regex: (?<= )[\s\d.]+(it/s|s/it)
replace: ??.??it/s
[regex2]
regex: 00:0[01]<00:0[01]
replace: 00:00<00:00

View File

@ -1,3 +1,3 @@
py-make>=0.1.0
twine
wheel
build

View File

@ -49,6 +49,7 @@ repos:
- flake8-comprehensions
- flake8-debugger
- flake8-isort
- flake8-pyproject
- flake8-string-format
- repo: https://github.com/PyCQA/isort
rev: 5.12.0

View File

@ -12,7 +12,7 @@ Makefile:
```
make [<alias>] # on UNIX-like environments
python setup.py make [<alias>] # if make is unavailable
python -m pymake [<alias>] # if make is unavailable
```
The latter depends on [`py-make>=0.1.0`](https://github.com/tqdm/py-make).
@ -85,7 +85,7 @@ The standard way to run the tests:
- run the following command:
```
[python setup.py] make test
[python -m py]make test
# or:
tox --skip-missing-interpreters
```
@ -105,11 +105,11 @@ that each distribution has an alias to call the Python interpreter:
Alternatively, use `pytest` to run the tests just for the current Python version:
- install test requirements: `[python setup.py] make install_test`
- install test requirements: `[python -m py]make install_test`
- run the following command:
```
[python setup.py] make alltests
[python -m py]make alltests
```
@ -118,9 +118,9 @@ Alternatively, use `pytest` to run the tests just for the current Python version
This section is intended for the project's maintainers and describes
how to build and upload a new release. Once again,
`[python setup.py] make [<alias>]` will help.
`[python -m py]make [<alias>]` will help.
Also consider `pip install`ing development utilities:
`[python setup.py] make install_build` at a minimum, or a more thorough `conda env create`.
`[python -m py]make install_build` at a minimum, or a more thorough `conda env create`.
## Pre-commit Hook
@ -137,20 +137,20 @@ The `tqdm` repository managers should:
- follow the [Semantic Versioning](https://semver.org) convention for tagging
## Checking setup.py
## Checking `pyproject.toml`
To check that the `setup.py`/`setup.cfg`/`pyproject.toml` file is compliant with PyPI
To check that the `pyproject.toml` file is compliant with PyPI
requirements (e.g. version number; reStructuredText in `README.rst`) use:
```
[python setup.py] make testsetup
[python -m py]make testsetup
```
To upload just metadata (including overwriting mistakenly uploaded metadata)
to PyPI, use:
```
[python setup.py] make pypimeta
[python -m py]make pypimeta
```
@ -199,7 +199,7 @@ git merge --no-ff pr-branch-name
### 4 Test
```
[python setup.py] make alltests
[python -m py]make alltests
```
### 5 Push to master
@ -233,7 +233,7 @@ Manual instructions are given below in case of failure.
Build `tqdm` into a distributable python package:
```
[python setup.py] make build
[python -m py]make build
```
This will generate several builds in the `dist/` folder. On non-windows
@ -243,13 +243,13 @@ Finally, upload everything to PyPI. This can be done easily using the
[twine](https://github.com/pypa/twine) module:
```
[python setup.py] make pypi
[python -m py]make pypi
```
Also, the new release can (should) be added to GitHub by creating a new
release from the [web interface](https://github.com/tqdm/tqdm/releases);
uploading packages from the `dist/` folder
created by `[python setup.py] make build`.
created by `[python -m py]make build`.
The [wiki] can be automatically updated with GitHub release notes by
running `make` within the wiki repository.
@ -282,7 +282,7 @@ before the real deployment
- in case of a mistake, you can delete an uploaded release on PyPI, but you
cannot re-upload another with the same version number
- in case of a mistake in the metadata on PyPI (e.g. bad README),
updating just the metadata is possible: `[python setup.py] make pypimeta`
updating just the metadata is possible: `[python -m py]make pypimeta`
## Updating Websites
@ -333,16 +333,16 @@ to assist with maintenance.
For experienced devs, once happy with local master, follow the steps below.
Much is automated so really it's steps 1-5, then 11(a).
1. test (`[python setup.py] make alltests` or rely on `pre-commit`)
1. test (`[python -m py]make alltests` or rely on `pre-commit`)
2. `git commit [--amend] # -m "bump version"`
3. `git push`
4. wait for tests to pass
a) in case of failure, fix and go back to (1)
5. `git tag vM.m.p && git push --tags` or comment `/tag vM.m.p commit_hash`
6. **`[AUTO:GHA]`** `[python setup.py] make distclean`
7. **`[AUTO:GHA]`** `[python setup.py] make build`
6. **`[AUTO:GHA]`** `[python -m py]make distclean`
7. **`[AUTO:GHA]`** `[python -m py]make build`
8. **`[AUTO:GHA]`** upload to PyPI. either:
a) `[python setup.py] make pypi`, or
a) `[python -m py]make pypi`, or
b) `twine upload -s -i $(git config user.signingkey) dist/tqdm-*`
9. **`[AUTO:GHA]`** upload to docker hub:
a) `make -B docker`
@ -359,7 +359,7 @@ Much is automated so really it's steps 1-5, then 11(a).
13. **`[SUB][AUTO:GHA-rel]`** run `make deploy` in the `docs` submodule to update website
14. **`[SUB][AUTO:GHA-rel]`** accept the automated PR in the `feedstock` submodule to update conda
15. **`[AUTO:GHA-rel]`** update the [gh-pages project] benchmarks
a) `[python setup.py] make testasvfull`
a) `[python -m py]make testasvfull`
b) `asv gh-pages`
Key:

View File

@ -7,11 +7,11 @@ Exceptions or notable authors are listed below
in reverse chronological order:
* files: *
MPLv2.0 2015-2023 (c) Casper da Costa-Luis
MPL-2.0 2015-2023 (c) Casper da Costa-Luis
[casperdcl](https://github.com/casperdcl).
* files: tqdm/_tqdm.py
MIT 2016 (c) [PR #96] on behalf of Google Inc.
* files: tqdm/_tqdm.py setup.py README.rst MANIFEST.in .gitignore
* files: tqdm/_tqdm.py README.rst .gitignore
MIT 2013 (c) Noam Yorav-Raphael, original author.
[PR #96]: https://github.com/tqdm/tqdm/pull/96

View File

@ -1,4 +1,4 @@
# IMPORTANT: for compatibility with `python setup.py make [alias]`, ensure:
# IMPORTANT: for compatibility with `python -m pymake [alias]`, ensure:
# 1. Every alias is preceded by @[+]make (eg: @make alias)
# 2. A maximum of one @make alias or command per line
# see: https://github.com/tqdm/py-make/issues/1
@ -31,7 +31,7 @@
run
help:
@python setup.py make -p
@python -m pymake -p
alltests:
@+make testcoverage
@ -58,15 +58,14 @@ testsetup:
@make README.rst
@make tqdm/tqdm.1
@make tqdm/completion.sh
python setup.py check --metadata --restructuredtext --strict
python setup.py make none
@make help
testnb:
pytest tests_notebook.ipynb --nbval --nbval-current-env -W=ignore --nbval-sanitize-with=setup.cfg --cov=tqdm.notebook --cov-report=term
pytest tests_notebook.ipynb --cov=tqdm.notebook --cov-report=term -W=ignore --nbval --current-env --sanitize-with=.meta/nbval.ini
testcoverage:
@make coverclean
pytest tests_notebook.ipynb --cov=tqdm --cov-report= --nbval --nbval-current-env --nbval-sanitize-with=setup.cfg -W=ignore
pytest tests_notebook.ipynb --cov=tqdm --cov-report= -W=ignore --nbval --current-env --sanitize-with=.meta/nbval.ini
pytest -k "not perf" --cov=tqdm --cov-report=xml --cov-report=term --cov-append --cov-fail-under=80
testperf:
@ -152,12 +151,11 @@ submodules:
cd feedstock && git remote add autotick-bot git@github.com:regro-cf-autotick-bot/tqdm-feedstock
install:
python setup.py install
python -m pip install .
install_dev:
python setup.py develop --uninstall
python setup.py develop
python -m pip install -e .
install_build:
python -m pip install -r .meta/requirements-dev.txt
python -m pip install -r .meta/requirements-build.txt
install_test:
python -m pip install -r .meta/requirements-test.txt
pre-commit install
@ -165,11 +163,11 @@ install_test:
build:
@make prebuildclean
@make testsetup
python setup.py sdist bdist_wheel
# python setup.py bdist_wininst
python -m build
python -m twine check dist/*
pypi:
twine upload dist/*
python -m twine upload dist/*
buildupload:
@make build

View File

@ -33,14 +33,14 @@ dependencies:
- requests # contrib.telegram
- rich # rich
- argopt # `cd wiki && pymake`
- twine # `pymake pypi`
- wheel # `setup.py bdist_wheel`
- twine # `pymake check pypi`
- build # `python -m build`
# `cd docs && pymake`
- mkdocs-material
- pydoc-markdown
- pygments
- pymdown-extensions
- pip:
- py-make >=0.1.0 # `setup.py make/pymake`
- py-make >=0.1.0 # `make/pymake`
- mkdocs-minify-plugin # `cd docs && pymake`
- git+https://github.com/tqdm/jsmin@python3-only#egg=jsmin # `cd docs && pymake`

View File

@ -5,3 +5,131 @@ build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
write_to = "tqdm/_dist_ver.py"
write_to_template = "__version__ = '{version}'\n"
[tool.setuptools.packages.find]
exclude = ["benchmarks", "tests", "wiki", "docs", "feedstock"]
[project.urls]
homepage = "https://tqdm.github.io"
repository = "https://github.com/tqdm/tqdm"
changelog = "https://tqdm.github.io/releases"
wiki = "https://github.com/tqdm/tqdm/wiki"
[project]
name = "tqdm"
dynamic = ["version"]
maintainers = [{name = "tqdm developers", email = "devs@tqdm.ml"}]
description = "Fast, Extensible Progress Meter"
readme = "README.rst"
requires-python = ">=3.7"
keywords = ["progressbar", "progressmeter", "progress", "bar", "meter", "rate", "eta", "console", "terminal", "time"]
license = {text = "MPL-2.0 AND MIT"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: MacOS X",
"Environment :: Other Environment",
"Environment :: Win32 (MS Windows)",
"Environment :: X11 Applications",
"Framework :: IPython",
"Framework :: Jupyter",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Other Audience",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Operating System :: MacOS",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft",
"Operating System :: Microsoft :: MS-DOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: POSIX :: BSD",
"Operating System :: POSIX :: BSD :: FreeBSD",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX :: SunOS/Solaris",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation",
"Programming Language :: Python :: Implementation :: IronPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Unix Shell",
"Topic :: Desktop Environment",
"Topic :: Education :: Computer Aided Instruction (CAI)",
"Topic :: Education :: Testing",
"Topic :: Office/Business",
"Topic :: Other/Nonlisted Topic",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Pre-processors",
"Topic :: Software Development :: User Interfaces",
"Topic :: System :: Installation/Setup",
"Topic :: System :: Logging",
"Topic :: System :: Monitoring",
"Topic :: System :: Shells",
"Topic :: Terminals",
"Topic :: Utilities"]
dependencies = ['colorama; platform_system == "Windows"']
[project.optional-dependencies]
dev = ["pytest>=6", "pytest-cov", "pytest-timeout", "pytest-xdist"]
slack = ["slack-sdk"]
telegram = ["requests"]
notebook = ["ipywidgets>=6"]
[project.scripts]
tqdm = "tqdm.cli:main"
[tool.flake8]
max_line_length = 99
exclude = [".git", "__pycache__", "build", "dist", ".eggs", ".asv", ".tox", ".ipynb_checkpoints"]
[tool.yapf]
spaces_before_comment = [15, 20]
arithmetic_precedence_indication = true
allow_split_before_dict_value = false
coalesce_brackets = true
column_limit = 99
each_dict_entry_on_separate_line = false
space_between_ending_comma_and_closing_bracket = false
split_before_named_assigns = false
split_before_closing_bracket = false
blank_line_before_nested_class_or_def = false
[tool.isort]
line_length = 99
multi_line_output = 4
known_first_party = ["tqdm", "tests"]
[tool.pytest.ini_options]
minversion = "6.0"
timeout = 30
log_level = "INFO"
markers = ["asyncio", "slow"]
python_files = ["tests_*.py", "tests_*.ipynb"]
testpaths = ["tests"]
addopts = "-v --tb=short -rxs -W=error --durations=0 --durations-min=0.1 --asyncio-mode=strict"
[tool.coverage.run]
branch = true
include = ["tqdm/*"]
omit = [
"tqdm/contrib/bells.py",
"tqdm/contrib/slack.py",
"tqdm/contrib/discord.py",
"tqdm/contrib/telegram.py",
"tqdm/contrib/utils_worker.py"]
relative_files = true
disable_warnings = ["include-ignored"]
[tool.coverage.report]
show_missing = true

145
setup.cfg
View File

@ -1,145 +0,0 @@
[metadata]
name=tqdm
url=https://tqdm.github.io
project_urls=
Changelog=https://tqdm.github.io/releases
Source=https://github.com/tqdm/tqdm
Wiki=https://github.com/tqdm/tqdm/wiki
maintainer=tqdm developers
maintainer_email=python.tqdm@gmail.com
license=MPLv2.0, MIT Licences
license_file=LICENCE
description=Fast, Extensible Progress Meter
long_description=file: README.rst
long_description_content_type=text/x-rst
keywords=progressbar, progressmeter, progress, bar, meter, rate, eta, console, terminal, time
platforms=any
provides=tqdm
# Trove classifiers (https://pypi.org/pypi?%3Aaction=list_classifiers)
classifiers=
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: MacOS X
Environment :: Other Environment
Environment :: Win32 (MS Windows)
Environment :: X11 Applications
Framework :: IPython
Framework :: Jupyter
Intended Audience :: Developers
Intended Audience :: Education
Intended Audience :: End Users/Desktop
Intended Audience :: Other Audience
Intended Audience :: System Administrators
License :: OSI Approved :: MIT License
License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Operating System :: MacOS
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft
Operating System :: Microsoft :: MS-DOS
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Operating System :: POSIX :: BSD
Operating System :: POSIX :: BSD :: FreeBSD
Operating System :: POSIX :: Linux
Operating System :: POSIX :: SunOS/Solaris
Operating System :: Unix
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation
Programming Language :: Python :: Implementation :: IronPython
Programming Language :: Python :: Implementation :: PyPy
Programming Language :: Unix Shell
Topic :: Desktop Environment
Topic :: Education :: Computer Aided Instruction (CAI)
Topic :: Education :: Testing
Topic :: Office/Business
Topic :: Other/Nonlisted Topic
Topic :: Software Development :: Build Tools
Topic :: Software Development :: Libraries
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Software Development :: Pre-processors
Topic :: Software Development :: User Interfaces
Topic :: System :: Installation/Setup
Topic :: System :: Logging
Topic :: System :: Monitoring
Topic :: System :: Shells
Topic :: Terminals
Topic :: Utilities
[options]
setup_requires=setuptools>=42; setuptools_scm[toml]>=3.4
python_requires=>=3.7
install_requires=
colorama; platform_system == 'Windows'
tests_require=tox
include_package_data=True
packages=find:
[options.extras_require]
dev=py-make>=0.1.0; twine; wheel
slack=slack-sdk
telegram=requests
notebook=ipywidgets>=6
[options.entry_points]
console_scripts=
tqdm=tqdm.cli:main
[options.packages.find]
exclude=benchmarks, tests
[flake8]
max_line_length=99
exclude=.asv,.eggs,.tox,.ipynb_checkpoints,build,dist,.git,__pycache__
[pydocstyle]
add_ignore=D400,D415
[yapf]
spaces_before_comment=15, 20
arithmetic_precedence_indication=true
allow_split_before_dict_value=false
coalesce_brackets=True
column_limit=99
each_dict_entry_on_separate_line=False
space_between_ending_comma_and_closing_bracket=False
split_before_named_assigns=False
split_before_closing_bracket=False
blank_line_before_nested_class_or_def=False
[isort]
line_length=99
multi_line_output=4
known_first_party=tqdm,tests
[tool:pytest]
timeout=30
log_level=INFO
markers=
asyncio
slow
python_files=tests_*.py tests_*.ipynb
testpaths=tests
addopts=-v --tb=short -rxs -W=error --durations=0 --durations-min=0.1 --asyncio-mode=strict
[regex1]
regex: (?<= )[\s\d.]+(it/s|s/it)
replace: ??.??it/s
[regex2]
regex: 00:0[01]<00:0[01]
replace: 00:00<00:00
[coverage:run]
branch=True
include=tqdm/*
omit=
tqdm/contrib/bells.py
tqdm/contrib/slack.py
tqdm/contrib/discord.py
tqdm/contrib/telegram.py
tqdm/contrib/utils_worker.py
relative_files=True
disable_warnings=include-ignored
[coverage:report]
show_missing=True

View File

@ -1,17 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from os import path
from setuptools import setup
src_dir = path.abspath(path.dirname(__file__))
if sys.argv[1].lower().strip() == 'make': # exec Makefile commands
import pymake
fpath = path.join(src_dir, 'Makefile')
pymake.main(['-f', fpath] + sys.argv[2:])
# Stop to avoid setup.py raising non-standard command error
sys.exit(0)
setup(use_scm_version=True)

15
tox.ini
View File

@ -4,7 +4,7 @@
# and then run "tox" from this directory.
[tox]
envlist=py{37,38,39,310,311,py3}{,-tf}{,-keras}, perf, setup.py
envlist=py{37,38,39,310,311,py3}{,-tf}{,-keras}, perf, check
isolated_build=True
[gh-actions]
@ -48,7 +48,7 @@ deps=
!py311-tf: tensorflow!=2.5.0
keras: keras
commands=
pytest --cov=tqdm --cov-report= tests_notebook.ipynb --nbval --nbval-current-env -W=ignore --nbval-sanitize-with=setup.cfg
pytest --cov=tqdm --cov-report= -W=ignore tests_notebook.ipynb --nbval --current-env --sanitize-with=.meta/nbval.ini
pytest --cov=tqdm --cov-report=xml --cov-report=term --cov-append -k "not perf"
{[core]commands}
allowlist_externals=codacy
@ -64,11 +64,12 @@ deps=
pytest-asyncio
commands=pytest -k perf
[testenv:setup.py]
[testenv:check]
deps=
docutils
pygments
build
twine
py-make>=0.1.0
commands=
{envpython} setup.py check --restructuredtext --metadata --strict
{envpython} setup.py make none
{envpython} -m build
{envpython} -m twine check dist/*
{envpython} -m pymake -h