Skip to content

Commit

Permalink
chore: drop support for py3.7, add justfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Jul 2, 2023
1 parent 41a5342 commit 73f5ea2
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 112 deletions.
52 changes: 25 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: build

on:
on:
push:
paths:
- '.github/workflows/build.yml'
- '**/*.py'
branches:
- "**"
- '**'
tags:
- "!**"
- '!**'
pull_request:
paths:
- '.github/workflows/build.yml'
Expand All @@ -18,37 +18,35 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Dependencies
run: make install
- name: Check format
run: make format-check
- name: Scan for security vulnerabilities
run: make scan
python-version: '3.11'
- run: just install lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
pythonversion: ["3.7", "3.8", "3.9", "3.10", "3.11"]
pythonversion: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pythonversion }}
- name: Install Dependencies
run: make install
- name: Run tests
run: make coverage
- name: Coveralls
if: github.ref == 'refs/heads/main'
uses: coverallsapp/github-action@master
- run: just install coverage
coverage:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- run: just install coverage
- uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./coverage.lcov"
path-to-lcov: './coverage.lcov'
16 changes: 6 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@ name: release
on:
push:
tags:
- "*"
- '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Build package
run: |
make install
make build
python-version: '3.11'
- run: just install build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
67 changes: 0 additions & 67 deletions Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pip3 install pip-tree
venv/bin/pip install pip-tree

# Install locally
make install
just install
```

## Usage
Expand Down Expand Up @@ -104,5 +104,5 @@ for package in package_list:

```bash
# Get a comprehensive list of development tools
make help
just --list
```
65 changes: 65 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
PYTHON_BINARY := "python3"
VIRTUAL_ENV := "venv"
VIRTUAL_BIN := VIRTUAL_ENV / "bin"
PROJECT_NAME := "pip_tree"
TEST_DIR := "test"

# Scans the project for security vulnerabilities
bandit:
{{VIRTUAL_BIN}}/bandit -r {{PROJECT_NAME}}/

# Builds the project in preparation for release
build:
{{VIRTUAL_BIN}}/python -m build

# Runs the Black Python formatter against the project
black:
{{VIRTUAL_BIN}}/black {{PROJECT_NAME}}/ {{TEST_DIR}}/

# Checks if the project is formatted correctly against the Black rules
black-check:
{{VIRTUAL_BIN}}/black {{PROJECT_NAME}}/ {{TEST_DIR}}/ --check

# Test the project and generate an HTML coverage report
coverage:
{{VIRTUAL_BIN}}/pytest --cov={{PROJECT_NAME}} --cov-branch --cov-report=html --cov-report=lcov --cov-report=term-missing --cov-fail-under=90

# Cleans the project
clean:
rm -rf {{VIRTUAL_ENV}} dist *.egg-info .coverage htmlcov .*cache
find . -name '*.pyc' -delete

# Run flake8 checks against the project
flake8:
{{VIRTUAL_BIN}}/flake8 {{PROJECT_NAME}}/ {{TEST_DIR}}/

# Lints the project
lint: black-check isort-check flake8 mypy bandit

# Runs all formatting tools against the project
lint-fix: black isort

# Install the project locally
install:
{{PYTHON_BINARY}} -m venv {{VIRTUAL_ENV}}
{{VIRTUAL_BIN}}/pip install -e ."[dev]"

# Sorts imports throughout the project
isort:
{{VIRTUAL_BIN}}/isort {{PROJECT_NAME}}/ {{TEST_DIR}}/

# Checks that imports throughout the project are sorted correctly
isort-check:
{{VIRTUAL_BIN}}/isort {{PROJECT_NAME}}/ {{TEST_DIR}}/ --check-only

# Run mypy type checking on the project
mypy:
{{VIRTUAL_BIN}}/mypy {{PROJECT_NAME}}/ {{TEST_DIR}}/

# Scans the project for security vulnerabilities
scan:
{{VIRTUAL_BIN}}/bandit -r {{PROJECT_NAME}}/

# Test the project
test:
{{VIRTUAL_BIN}}/pytest
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

DEV_REQUIREMENTS = [
'bandit == 1.7.*',
'black == 22.*',
'black == 23.*',
'build == 0.10.*',
'flake8 == 5.*',
'flake8 == 6.*',
'isort == 5.*',
'mypy == 1.1.*',
'mypy == 1.3.*',
'pytest == 7.*',
'pytest-cov == 4.*',
'twine == 4.*',
Expand All @@ -19,7 +19,7 @@

setuptools.setup(
name='pip-tree',
version='2.1.0',
version='3.0.0',
description='Get the dependency tree of your Python virtual environment via Pip.',
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -41,5 +41,5 @@
'pip-tree=pip_tree.cli:main',
],
},
python_requires='>=3.7, <4',
python_requires='>=3.8, <4',
)
2 changes: 1 addition & 1 deletion test/unit/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def test_get_package_details():
assert any(item['name'] == 'pytest' for item in package_details)
assert any([] == item['requires'] for item in package_details)
assert any('pytest' in item['required_by'] for item in package_details)
assert 55 < package_count < 75 # Assert the package count is within a reasonable number for this package
assert 50 < package_count < 75 # Assert the package count is within a reasonable number for this package

0 comments on commit 73f5ea2

Please sign in to comment.