-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to pyproject.toml; use ruff (#83)
* Migrate to pyproject.toml; use ruff * tox -e lint * Update readme * Prevent unnecessary builds * Remove __version__ * Update publishing workflow adapted from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
- Loading branch information
Showing
18 changed files
with
148 additions
and
150 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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: ["main"] | ||
tags: ["*"] | ||
pull_request: | ||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.name }} | ||
|
@@ -13,39 +16,58 @@ jobs: | |
- { name: "3.8", python: "3.8", tox: py38 } | ||
- { name: "3.12", python: "3.12", tox: py312 } | ||
steps: | ||
- uses: actions/checkout@v3.1.0 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- run: python -m pip install --upgrade pip | ||
- run: python -m pip install tox | ||
- run: python -m tox -e${{ matrix.tox }} | ||
build: | ||
if: startsWith(github.ref, 'refs/tags') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Install pypa/build | ||
run: python3 -m pip install build --user | ||
- name: Build a binary wheel and a source tarball | ||
run: python3 -m build | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
# this duplicates pre-commit.ci, so only run it on tags | ||
# it guarantees that linting is passing prior to a release | ||
lint-pre-release: | ||
name: lint | ||
if: startsWith(github.ref, 'refs/tags') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3.1.0 | ||
- uses: actions/setup-python@v4.3.0 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- run: python -m pip install --upgrade pip | ||
- run: python -m pip install tox | ||
- run: python -m tox -elint | ||
release: | ||
needs: [tests, lint-pre-release] | ||
publish-to-pypi: | ||
name: PyPI release | ||
if: startsWith(github.ref, 'refs/tags') | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: [build, tests, lint-pre-release] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/ped | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
- name: install requirements | ||
run: python -m pip install build twine | ||
- name: build dists | ||
run: python -m build | ||
- name: check package metadata | ||
run: twine check dist/* | ||
- name: publish | ||
run: twine upload -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/* | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
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 |
---|---|---|
|
@@ -64,3 +64,6 @@ target/ | |
.konchrc | ||
test-output | ||
.mypy_cache | ||
|
||
# ruff | ||
.ruff_cache |
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 |
---|---|---|
@@ -1,24 +1,20 @@ | ||
repos: | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.0 | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.13 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py38-plus] | ||
- repo: https://github.com/psf/black | ||
rev: 23.12.1 | ||
- id: ruff | ||
- id: ruff-format | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.27.3 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [flake8-bugbear==23.12.2] | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.8.0 | ||
hooks: | ||
- id: mypy | ||
- id: check-github-workflows | ||
- id: check-readthedocs | ||
- repo: https://github.com/asottile/blacken-docs | ||
rev: 1.16.0 | ||
hooks: | ||
- id: blacken-docs | ||
additional_dependencies: [black==23.12.1] | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.8.0 | ||
hooks: | ||
- id: mypy |
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,3 +1,63 @@ | ||
[tool.black] | ||
line-length = 88 | ||
target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] | ||
[project] | ||
name = "ped" | ||
version = "2.1.0" | ||
description = "Quickly open Python modules in your text editor." | ||
readme = "README.rst" | ||
license = { file = "LICENSE" } | ||
authors = [{ name = "Steven Loria", email = "[email protected]" }] | ||
classifiers = [ | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Natural Language :: English", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: System :: Shells", | ||
] | ||
keywords = ["commandline", "cli", "open", "editor", "editing"] | ||
requires-python = ">=3.8" | ||
|
||
[project.scripts] | ||
ped = "ped:main" | ||
|
||
[project.urls] | ||
Issues = "https://github.com/sloria/ped/issues" | ||
Source = "https://github.com/sloria/ped/" | ||
|
||
[project.optional-dependencies] | ||
dev = ["ped[tests]", "tox"] | ||
tests = ["pytest", "pytest-mock", "scripttest==1.3"] | ||
|
||
[build-system] | ||
requires = ["flit_core<4"] | ||
build-backend = "flit_core.buildapi" | ||
|
||
[tool.flit.sdist] | ||
include = ["tests/", "NOTICE", "tox.ini"] | ||
exclude = ["tests/test-output"] | ||
|
||
[tool.ruff] | ||
src = ["src"] | ||
fix = true | ||
show-fixes = true | ||
show-source = true | ||
|
||
[tool.ruff.lint] | ||
select = [ | ||
"B", # flake8-bugbear | ||
"E", # pycodestyle error | ||
"F", # pyflakes | ||
"I", # isort | ||
"UP", # pyupgrade | ||
"W", # pycodestyle warning | ||
] | ||
|
||
[tool.mypy] | ||
ignore_missing_imports = true | ||
warn_unreachable = true | ||
warn_unused_ignores = true | ||
warn_redundant_casts = true | ||
no_implicit_optional = true |
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
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
Oops, something went wrong.