-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
ignore = E501, W503 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Run tests | ||
on: [push, pull_request] | ||
|
||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10', '3.11'] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- run: pip install --upgrade pip | ||
|
||
- name: 'Build, Test, Lint: ${{ matrix.python-version }}' | ||
uses: chris48s/python-package-shared@main | ||
with: | ||
python-version: ${{ matrix.python-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# python cache files | ||
__pycache__/ | ||
*.pyc | ||
|
||
# build artifacts | ||
build/ | ||
dist/ | ||
pip_abandoned.egg-info/ | ||
|
||
# test coverage | ||
.coverage | ||
coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## 📦 0.1.0 | ||
|
||
* First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# pip-abandoned | ||
|
||
This project uses: | ||
|
||
* [flit](https://flit.pypa.io/en/stable/) for packaging | ||
* [flake8](https://pypi.org/project/flake8/) for linting and | ||
* [black](https://github.com/psf/black) for code formatting | ||
* [isort](https://github.com/timothycrosley/isort) for import sorting | ||
|
||
Development Tasks: | ||
|
||
* Install dependencies: `make install` | ||
* Run the test suite: `make test` | ||
* Run lint checks: `make lint` | ||
* Auto-format: `make format` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 chris48s | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
SHELL := /bin/bash | ||
.PHONY: help format install lint test release | ||
|
||
help: | ||
@grep '^\.PHONY' Makefile | cut -d' ' -f2- | tr ' ' '\n' | ||
|
||
format: | ||
isort --profile black . | ||
black . | ||
|
||
install: | ||
pip install -e .[dev] | ||
|
||
lint: | ||
isort --profile black -c --diff . | ||
black --check . | ||
flake8 . | ||
|
||
test: | ||
pytest --cov=pip_abandoned --cov-report term --cov-report xml ./tests | ||
|
||
release: | ||
# usage: `make release version=0.0.0` | ||
make test | ||
@echo "" | ||
make lint | ||
@echo "" | ||
./release.sh "$(version)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# pip-abandoned | ||
|
||
[![Run tests](https://github.com/chris48s/pip-abandoned/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/chris48s/pip-abandoned/actions/workflows/test.yml) | ||
<!-- TODO: codecov badge --> | ||
[![PyPI Version](https://img.shields.io/pypi/v/pip-abandoned.svg)](https://pypi.org/project/pip-abandoned/) | ||
![License](https://img.shields.io/pypi/l/pip-abandoned.svg) | ||
![Python Compatibility](https://img.shields.io/badge/dynamic/json?query=info.requires_python&label=python&url=https%3A%2F%2Fpypi.org%2Fpypi%2Fpip-abandoned%2Fjson) | ||
![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg) | ||
|
||
|
||
|
||
## Installation | ||
|
||
``` | ||
pip install pip-abandoned | ||
``` | ||
|
||
## Usage | ||
|
||
<!-- TODO --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .__version__ import __version__ # noqa: F401 | ||
|
||
# TODO: write some code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[build-system] | ||
requires = ["flit_core >=3.2,<4"] | ||
build-backend = "flit_core.buildapi" | ||
|
||
[project] | ||
name = "pip-abandoned" | ||
authors = [{name = "chris48s", email = "[email protected]"}] | ||
description = "TODO" | ||
readme = "README.md" | ||
license = {file = "LICENSE"} | ||
classifiers = [ | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
] | ||
dynamic = ["version"] | ||
requires-python = ">=3.8" | ||
dependencies = [ | ||
"requests>=2,<3", | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"flit==3.9.0", | ||
"isort==5.12.0", | ||
"flake8==6.1.0", | ||
"black==23.7.0", | ||
"pytest==7.4.0", | ||
"pytest-cov==4.1.0", | ||
] | ||
|
||
[project.urls] | ||
Home = "https://github.com/chris48s/pip-abandoned" | ||
Source = "https://github.com/chris48s/pip-abandoned" | ||
|
||
[tool.flit.module] | ||
name = "pip_abandoned" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# read version + ensure non-empty | ||
VERSION="$1" | ||
[ -z "$VERSION" ] && echo "Error: No version specified" && exit 1 | ||
|
||
# ensure work tree is clean (aside from CHANGELOG.md) | ||
if [[ ! $(git status --porcelain | grep -vc "CHANGELOG.md") -eq 0 ]]; then | ||
echo "Error: Uncommitted changes in work tree" | ||
exit 1 | ||
fi | ||
|
||
# ensure we're on default branch | ||
if [[ ! "$(git branch --show-current)" =~ ^(main|master)$ ]]; then | ||
echo "Error: Not on default branch" | ||
exit 1 | ||
fi | ||
|
||
# ensure the changelog is up-to-date | ||
if ! (grep -q "$VERSION" CHANGELOG.md) | ||
then | ||
echo "Error: CHANGELOG.md is not up to date" | ||
exit 1 | ||
fi | ||
|
||
if ! type "flit" > /dev/null; | ||
then | ||
echo "Flit is not installed" | ||
exit 1 | ||
fi | ||
|
||
# confirm | ||
read -r -p "Bump version from $(cut -d '"' -f2 < pip_abandoned/__version__.py) to $VERSION. Are you sure? [y/n] " response | ||
response=${response,,} # tolower | ||
if [[ ! "$response" =~ ^(yes|y)$ ]]; then | ||
exit 1 | ||
fi | ||
|
||
# checks done, now publish the release... | ||
|
||
# bump version | ||
echo '__version__ = "'"$VERSION"'"' > pip_abandoned/__version__.py | ||
|
||
# commit | ||
git add pyproject.toml | ||
git add pip_abandoned/__version__.py | ||
git add CHANGELOG.md | ||
git commit -m "version $VERSION" | ||
|
||
# tag | ||
git tag "$VERSION" | ||
|
||
# build and push to PyPI | ||
flit build | ||
flit publish | ||
|
||
# push to GitHub | ||
git push origin "$(git branch --show-current)" --tags | ||
|
||
# cleanup | ||
rm -rf dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def test_TODO(): | ||
# TODO: write some tests | ||
assert True |