Skip to content

Commit

Permalink
Merge pull request #1 from omar-abdelgawad/switch-to-ruff
Browse files Browse the repository at this point in the history
Switch to ruff
  • Loading branch information
omar-abdelgawad authored Apr 7, 2024
2 parents 3444921 + 0440400 commit 8ab2406
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 81 deletions.
2 changes: 0 additions & 2 deletions .pylintrc

This file was deleted.

31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
[![license](https://img.shields.io/badge/license-MIT-blue)](https://opensource.org/license/mit/)
[![Tests](https://github.com/omar-abdelgawad/image2image/actions/workflows/tests.yml/badge.svg)](https://github.com/omar-abdelgawad/image2image/actions)
[![Tests](https://github.com/omar-abdelgawad/python-project-template/actions/workflows/tests.yml/badge.svg)](https://github.com/omar-abdelgawad/image2image/actions)
[![PythonVersion](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue)](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
<!-- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -->

# Project Name
This is a template for a python project with the src layout. It has setup.cfg and pyproject.toml with some fields to fill in. It also has tox configured, docs dir for github pages, .github folder with actions configured and more.
Please Note that tox is configured with python 3.8,3.9, and 3.10. Feel free to reconfigure everything to your need.
This is a modern template for a python project with the pyproject.toml with some fields to change based on project. It also has tox configured, docs dir for github pages, .github dir with tox-gh-actions configured and more.
- pyproject.toml
- setuptools backend (setup.py and setup.cfg)
- the src layout
- tox configured
- docs dir for github pages with a tests.yml ready
- .github dir with a tests.yml configured with tox-gh-actions
- tox configured with pytest, ruff, and mypy
- tests dir for pytest

Please Note that tox is configured with python 3.8,3.9, and 3.10. Feel free to reconfigure everything to your need.

## Installation/Usage
```bash
Expand All @@ -16,7 +24,16 @@ Please Note that tox is configured with python 3.8,3.9, and 3.10. Feel free to r
$ source venv/bin/activate
$ pip install -e ".[dev]"
```
## Implementations

### Placeholder1
### Placeholder2
## Testing with tox
Just running `tox` with no args should work.
```bash
$ tox
```
tox creates virtual environments and runs all of pytest, ruff, and mypy.
## Package(s)

### package1
....
### package2
....
50 changes: 48 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,46 @@
[build-system]
requires = ["setuptools>=42.0", "wheel"]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "mypackagename"
dynamic = ["version"]
dependencies = [
"requests"
]
requires-python = ">=3.8"
authors = [
{name = "Omar Abdelgawad", email = "[email protected]"},
{name = "Tzu-Ping Chung", email = "[email protected]"},
]
description = "A package for image to image translation using GANs"
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["image-to-image-translation", "GAN", "vision", "deep-learning"]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10"
]

[project.optional-dependencies]
dev = [
"mypy",
"ruff",
"pytest",
"pytest-cov",
"tox"
]

[tool.setuptools.package-data]
firstpkg = ["py.typed"]
secondpkg = ["py.typed"]

[project.urls]
Repository = "https://github.com/me/spam.git"

###################################################################################################
[tool.pytest.ini_options]
addopts = "--cov=firstpkg --cov=secondpkg" #include all packages under src directory
testpaths = [
Expand All @@ -20,4 +59,11 @@ warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
no_implicit_reexport = true
no_implicit_reexport = true

[tool.ruff]
include = ["*.py"]
src = ["src"]

[tool.ruff.lint]
extend-select = ["UP","PL"]
5 changes: 0 additions & 5 deletions requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

49 changes: 0 additions & 49 deletions setup.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

20 changes: 9 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
[tox]
minversion = 3.8.0
envlist = py38, py39, py310, pylint, mypy
envlist = py38, py39, py310, ruff, mypy
isolated_build = true

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310, mypy, pylint
3.10: py310, mypy, ruff

[testenv]
setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements-dev.txt
pytest
pytest-cov
commands =
pytest --basetemp={envtmpdir}

# [testenv:flake8]
# basepython = python3.6
# deps = flake8
# commands = flake8 src tests

[testenv:pylint]
[testenv:ruff]
basepython = python3.10
deps = pylint
commands = pylint src tests --exit-zero
deps =
ruff
commands = ruff check src tests --exit-zero

[testenv:mypy]
basepython = python3.10
deps =
-r{toxinidir}/requirements-dev.txt
mypy
commands = mypy src #--exclude pattern

0 comments on commit 8ab2406

Please sign in to comment.