Browse Source

Switch to proviso for requirements.txt management

pull/1330/head
Ross McFarland 3 weeks ago
parent
commit
a2e3b93e74
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
6 changed files with 8 additions and 173 deletions
  1. +4
    -0
      .changelog/fbd3d292e2be485fb0e005d97b41c994.md
  2. +0
    -52
      requirements-dev.txt
  3. +0
    -26
      requirements-docs.txt
  4. +0
    -4
      script/bootstrap
  5. +3
    -91
      script/update-requirements
  6. +1
    -0
      setup.py

+ 4
- 0
.changelog/fbd3d292e2be485fb0e005d97b41c994.md View File

@ -0,0 +1,4 @@
---
type: none
---
Switch to proviso for requirements.txt management

+ 0
- 52
requirements-dev.txt View File

@ -1,52 +0,0 @@
# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements to update
Pygments==2.19.2
SecretStorage==3.4.0
black==24.10.0
build==1.3.0
certifi==2025.10.5
cffi==2.0.0
changelet==0.3.0
charset-normalizer==3.4.3
click==8.1.8; python_version<'3.10'
click==8.3.0; python_version>='3.10'
cmarkgfm==2024.11.20
coverage==7.10.7
cryptography==46.0.2
docutils==0.21.2
id==1.5.0
iniconfig==2.1.0
isort==6.1.0
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.3.0
jeepney==0.9.0
keyring==25.6.0
markdown-it-py==3.0.0
mdurl==0.1.2
more-itertools==10.8.0
mypy_extensions==1.1.0
nh3==0.3.1
packaging==25.0
pathspec==0.12.1
platformdirs==4.5.0
pluggy==1.6.0
pprintpp==0.4.0
pycountry==24.6.1
pycountry-convert==0.7.2
pycparser==2.23
pyflakes==3.4.0
pyproject_hooks==1.2.0
pytest==8.4.2
pytest-cov==7.0.0
pytest-mock==3.15.1
pytest_network==0.0.1
readme_renderer==44.0
repoze.lru==0.7
requests==2.32.5
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.1.0
semver==3.0.4
twine==6.2.0
urllib3==2.5.0
wheel==0.45.1

+ 0
- 26
requirements-docs.txt View File

@ -1,26 +0,0 @@
# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements to update
Jinja2==3.1.6
MarkupSafe==3.0.3
Sphinx==7.4.7; python_version=='3.9'
Sphinx==8.1.3; python_version=='3.10'
Sphinx==8.2.3; python_version>='3.11'
alabaster==0.7.16; python_version<'3.10'
alabaster==1.0.0; python_version>='3.10'
babel==2.17.0
imagesize==1.4.1
mdit-py-plugins==0.4.2; python_version=='3.9'
mdit-py-plugins==0.5.0; python_version>='3.10'
myst-parser==3.0.1; python_version<'3.10'
myst-parser==4.0.1; python_version>='3.10'
roman-numerals-py==3.1.0
snowballstemmer==3.0.1
sphinx-copybutton==0.5.2
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-mermaid==1.0.0
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0

+ 0
- 4
script/bootstrap View File

@ -25,10 +25,6 @@ fi
python -m pip install -U 'pip>=10.0.1'
python -m pip install -r requirements.txt
if [ "$ENV" != "production" ]; then
python -m pip install -r requirements-dev.txt
fi
if [ -d ".git" ]; then
if [ -f ".git-blame-ignore-revs" ]; then
echo ""


+ 3
- 91
script/update-requirements View File

@ -1,93 +1,5 @@
#!/usr/bin/env python3
#!/bin/bash
from os.path import join
from subprocess import check_call, check_output
from sys import argv, stdout
from tempfile import TemporaryDirectory
set -e
with TemporaryDirectory() as tmpdir:
check_call(['python3', '-m', 'venv', tmpdir])
def install_and_list(target):
check_call([join(tmpdir, 'bin', 'pip'), 'install', target])
frozen = (
check_output([join(tmpdir, 'bin', 'pip'), 'freeze'])
.decode('utf-8')
.strip()
.split('\n')
)
# file bit skips ourself
return set(p.split('=', 1)[0] for p in frozen if 'file' not in p)
# base needs
frozen = install_and_list('.')
# dev needs
dev_frozen = install_and_list('.[dev]') - frozen
# docs needs
docs_frozen = install_and_list('.[docs]') - dev_frozen - frozen
# find the installed version for each package
versions = {}
for pv in (
check_output([join(tmpdir, 'bin', 'pip'), 'freeze'])
.decode('utf-8')
.strip()
.split('\n')
):
if 'file' in pv:
# skip ourself
continue
p, v = pv.split('==')
versions[p] = (v,)
# special handling for older python versions due to libraries dropping support
# early
versions['alabaster'] = (
"0.7.16; python_version<'3.10'",
f"{versions['alabaster'][0]}; python_version>='3.10'",
)
versions['click'] = (
"8.1.8; python_version<'3.10'",
f"{versions['click'][0]}; python_version>='3.10'",
)
versions['myst-parser'] = (
"3.0.1; python_version<'3.10'",
f"{versions['myst-parser'][0]}; python_version>='3.10'",
)
versions['Sphinx'] = (
"7.4.7; python_version=='3.9'",
"8.1.3; python_version=='3.10'",
f"{versions['Sphinx'][0]}; python_version>='3.11'",
)
versions['mdit-py-plugins'] = (
"0.4.2; python_version=='3.9'",
f"{versions['mdit-py-plugins'][0]}; python_version>='3.10'",
)
def write_packages(fh, packages, header, prefix=''):
fh.write(header)
for p in sorted(packages):
for v in versions[p]:
fh.write(prefix)
fh.write(p)
fh.write('==')
fh.write(v)
fh.write('\n')
write_packages(stdout, frozen, header='base\n', prefix=' ')
write_packages(stdout, dev_frozen, header='dev\n', prefix=' ')
write_packages(stdout, docs_frozen, header='docs\n', prefix=' ')
header = f'# DO NOT EDIT THIS FILE DIRECTLY - use {argv[0]} to update\n'
with open('requirements.txt', 'w') as fh:
write_packages(fh, frozen, header=header)
with open('requirements-dev.txt', 'w') as fh:
write_packages(fh, dev_frozen, header=header)
with open('requirements-docs.txt', 'w') as fh:
write_packages(fh, docs_frozen, header=header)
proviso --header="# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements" "$@"

+ 1
- 0
setup.py View File

@ -65,6 +65,7 @@ setup(
'build>=0.7.0',
'changelet',
'isort>=5.11.5',
'proviso',
'pycountry>=19.8.18',
'pycountry-convert>=0.7.2',
'pyflakes>=2.2.0',


Loading…
Cancel
Save