Skip to content

Commit

Permalink
move requirements to pyproject.toml (#4)
Browse files Browse the repository at this point in the history
* move requirements to pyproject.toml

* update caching

* edit mode

* check cache

* coverage report

* pin linting versions
  • Loading branch information
shapiromatron committed Jul 25, 2023
1 parent ba9ae2d commit c101ec4
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 53 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/dev-enviro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Test development environments

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
Expand All @@ -21,17 +20,11 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: try to restore pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py', 'requirements_dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install -U pip wheel
python -m pip install -r requirements_dev.txt
python -m pip install -U pip
python -m pip install -e ".[dev]"
- name: Check all Makefile commands
run: |
make clean
Expand Down
25 changes: 6 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,19 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Restore pip cache (Linux)
uses: actions/cache@v3
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'requirements_dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Restore pip cache (Windows)
uses: actions/cache@v3
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'requirements_dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install -U pip wheel
python -m pip install -r requirements_dev.txt
python -m pip install -U pip
python -m pip install -e ".[dev]"
- name: Check linting
run: |
make lint
- name: Test with pytest
run: |
make test
coverage run -m pytest
echo "# Python coverage report" >> $GITHUB_STEP_SUMMARY
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
- name: Build a wheel
run: |
make build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.ipynb_checkpoints/
.mypy_cache/
.pytest_cache/
.ruff_cache/
.tox/
.vscode/
build/
Expand Down
2 changes: 1 addition & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# History

## v0.0.1 (2022-07-15)
## v0.0.1 (2023-07-24)

* Initial release
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ Make sure you have python 3.11 available and on your path. Then:
# update pip
python -m pip install -U pip

# if it's local file...
pip install path/to/pyscaffold-0.0.1-py3-none-any.whl
# if it's on github somewhere...
# if it's local file or a github link...
pip install path/to/pyscaffold-0.0.1-py3-none-any.whl
# if it's on pypi
pip install pyscaffold
Expand All @@ -35,7 +33,7 @@ pip install pyscaffold
pyscaffold --help
pyscaffold hello
pyscaffold hello --name Andy
pyscaffold bottles -n 10
pyscaffold bottles --num 20
```

## Developer setup
Expand All @@ -51,7 +49,7 @@ source venv/bin/activate # or venv\Scripts\activate on windows.

# install packages
python -m pip install -U pip
pip install -r requirements_dev.txt
pip install -e ".[dev]"

# test local install
pyscaffold hello
Expand Down
2 changes: 1 addition & 1 deletion make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ black . --check && ruff .
goto :eof

:format
black . && ruff . --fix
black . && ruff . --fix --show-fixes
goto :eof

:test
Expand Down
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
requires = ["flit_core >=3.9,<4"]
build-backend = "flit_core.buildapi"

[project]
Expand All @@ -20,6 +20,15 @@ dependencies = [
"typer",
]

[project.optional-dependencies]
dev = [
"flit~=3.9.0",
"coverage~=7.2.7",
"pytest~=7.4.0",
"black==23.7.0",
"ruff==0.0.280",
]

[project.urls]
Home = "https://github.com/shapiromatron/pyscaffold"
Changes = "https://github.com/shapiromatron/pyscaffold/blob/main/HISTORY.md"
Expand Down
13 changes: 0 additions & 13 deletions requirements_dev.txt

This file was deleted.

8 changes: 7 additions & 1 deletion tests/test_work.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import pytest

from pyscaffold.work import super_add
from pyscaffold.work import bottles, super_add


def test_bottles(capsys):
bottles(1, "pepsi")
captured = capsys.readouterr()
assert "1 bottles of pepsi on the wall" in captured.out


def test_super_add():
Expand Down

0 comments on commit c101ec4

Please sign in to comment.