build: update dependency tracking to use pyproject.toml

This commit is contained in:
Marc 2024-02-07 00:03:42 -05:00
parent ca83820795
commit 6c2233245d
Signed by: marc
GPG key ID: 048E042F22B5DC79
9 changed files with 50 additions and 36 deletions

View file

@ -25,7 +25,7 @@ jobs:
- name: Setup dependencies
if: steps.dep-cache.outputs.cache-hit != 'true'
run: |
. script/bootstrap
. script/bootstrap.sh
test:
runs-on: ubuntu-latest
needs: setup
@ -45,7 +45,7 @@ jobs:
./slack-status-cli.venv
- name: Setup dependencies
run: |
. script/bootstrap
. script/bootstrap.sh
- name: Tests
run: |
python -m pytest --cov-report xml --cov=slack_status_cli -s
@ -86,7 +86,7 @@ jobs:
./slack-status-cli.venv
- name: Setup dependencies
run: |
. script/bootstrap
. script/bootstrap.sh
- name: Lint and format
run: |
python -m pylint **/*.py

View file

@ -4,6 +4,8 @@ version = "0.1.0"
description = "Tooling to set your Slack status on the fly without having to click around"
requires-python = ">=3.8"
readme = "README.md"
dependencies = []
[[project.authors]]
name = "Marc Cataford"
email = "mcat@riseup.net"
@ -12,5 +14,16 @@ email = "mcat@riseup.net"
Homepage = "https://github.com/mcataford/slack-status-cli"
"Bug Tracker" = "https://github.com/mcataford/slack-status-cli/issues"
[project.optional-dependencies]
dev = [
"build",
"toml",
"pytest",
"black",
"pylint",
"pytest-cov",
"syrupy",
]
[tool.setuptools]
packages = [ "slack_status_cli",]

View file

View file

@ -1,6 +1 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile ./requirements.in
#

View file

@ -1,9 +0,0 @@
-c requirements.txt
build
toml
pytest
black
pylint
pytest-cov
syrupy

View file

@ -1,15 +1,9 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile ./requirements_dev.in
#
astroid==3.0.3
# via pylint
black==24.1.1
# via -r ./requirements_dev.in
# via slack-status-cli (pyproject.toml)
build==1.0.3
# via -r ./requirements_dev.in
# via slack-status-cli (pyproject.toml)
click==8.1.7
# via black
coverage[toml]==7.4.1
@ -38,19 +32,19 @@ platformdirs==4.2.0
pluggy==1.4.0
# via pytest
pylint==3.0.3
# via -r ./requirements_dev.in
# via slack-status-cli (pyproject.toml)
pyproject-hooks==1.0.0
# via build
pytest==7.4.4
# via
# -r ./requirements_dev.in
# pytest-cov
# slack-status-cli (pyproject.toml)
# syrupy
pytest-cov==4.1.0
# via -r ./requirements_dev.in
# via slack-status-cli (pyproject.toml)
syrupy==4.6.0
# via -r ./requirements_dev.in
# via slack-status-cli (pyproject.toml)
toml==0.10.2
# via -r ./requirements_dev.in
# via slack-status-cli (pyproject.toml)
tomlkit==0.12.3
# via pylint

View file

@ -11,4 +11,4 @@ fi
source ./$PROJECT.venv/bin/activate
pip-sync ./requirements_dev.txt
pip-sync ./requirements.txt ./requirements_dev.txt

View file

@ -1,4 +0,0 @@
#!/bin/bash
pip-compile ./requirements.in
pip-compile ./requirements_dev.in

25
script/lock.sh Normal file
View file

@ -0,0 +1,25 @@
#!/bin/bash
PROD_DEP="requirements.txt"
DEV_DEP="requirements_dev.txt"
echo "Locking production dependencies as $PROD_DEP"
python -m piptools compile \
-o $PROD_DEP \
--no-header \
pyproject.toml
if [[ $? != 0 ]]; then
echo "Failed to lock production dependencies."
return 1
fi
echo "Locking production dependencies as $DEV_DEP"
python -m piptools compile \
-o $DEV_DEP \
--no-header \
--extra dev \
--constraint $PROD_DEP \
pyproject.toml