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 - name: Setup dependencies
if: steps.dep-cache.outputs.cache-hit != 'true' if: steps.dep-cache.outputs.cache-hit != 'true'
run: | run: |
. script/bootstrap . script/bootstrap.sh
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: setup needs: setup
@ -45,7 +45,7 @@ jobs:
./slack-status-cli.venv ./slack-status-cli.venv
- name: Setup dependencies - name: Setup dependencies
run: | run: |
. script/bootstrap . script/bootstrap.sh
- name: Tests - name: Tests
run: | run: |
python -m pytest --cov-report xml --cov=slack_status_cli -s python -m pytest --cov-report xml --cov=slack_status_cli -s
@ -86,7 +86,7 @@ jobs:
./slack-status-cli.venv ./slack-status-cli.venv
- name: Setup dependencies - name: Setup dependencies
run: | run: |
. script/bootstrap . script/bootstrap.sh
- name: Lint and format - name: Lint and format
run: | run: |
python -m pylint **/*.py 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" description = "Tooling to set your Slack status on the fly without having to click around"
requires-python = ">=3.8" requires-python = ">=3.8"
readme = "README.md" readme = "README.md"
dependencies = []
[[project.authors]] [[project.authors]]
name = "Marc Cataford" name = "Marc Cataford"
email = "mcat@riseup.net" email = "mcat@riseup.net"
@ -12,5 +14,16 @@ email = "mcat@riseup.net"
Homepage = "https://github.com/mcataford/slack-status-cli" Homepage = "https://github.com/mcataford/slack-status-cli"
"Bug Tracker" = "https://github.com/mcataford/slack-status-cli/issues" "Bug Tracker" = "https://github.com/mcataford/slack-status-cli/issues"
[project.optional-dependencies]
dev = [
"build",
"toml",
"pytest",
"black",
"pylint",
"pytest-cov",
"syrupy",
]
[tool.setuptools] [tool.setuptools]
packages = [ "slack_status_cli",] 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 astroid==3.0.3
# via pylint # via pylint
black==24.1.1 black==24.1.1
# via -r ./requirements_dev.in # via slack-status-cli (pyproject.toml)
build==1.0.3 build==1.0.3
# via -r ./requirements_dev.in # via slack-status-cli (pyproject.toml)
click==8.1.7 click==8.1.7
# via black # via black
coverage[toml]==7.4.1 coverage[toml]==7.4.1
@ -38,19 +32,19 @@ platformdirs==4.2.0
pluggy==1.4.0 pluggy==1.4.0
# via pytest # via pytest
pylint==3.0.3 pylint==3.0.3
# via -r ./requirements_dev.in # via slack-status-cli (pyproject.toml)
pyproject-hooks==1.0.0 pyproject-hooks==1.0.0
# via build # via build
pytest==7.4.4 pytest==7.4.4
# via # via
# -r ./requirements_dev.in
# pytest-cov # pytest-cov
# slack-status-cli (pyproject.toml)
# syrupy # syrupy
pytest-cov==4.1.0 pytest-cov==4.1.0
# via -r ./requirements_dev.in # via slack-status-cli (pyproject.toml)
syrupy==4.6.0 syrupy==4.6.0
# via -r ./requirements_dev.in # via slack-status-cli (pyproject.toml)
toml==0.10.2 toml==0.10.2
# via -r ./requirements_dev.in # via slack-status-cli (pyproject.toml)
tomlkit==0.12.3 tomlkit==0.12.3
# via pylint # via pylint

View file

@ -11,4 +11,4 @@ fi
source ./$PROJECT.venv/bin/activate 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