Skip to content

Commit

Permalink
Update packaging process (#189)
Browse files Browse the repository at this point in the history
* Replace setup.py by pyproject.toml

* Add build as requirements

* Update actions version and build commands

* Configure flake8 max length

* Update precommit hooks

* Update CHANGELOG

* Put twine back

* Put twine installation in the right place

* Update env
  • Loading branch information
anapaulagomes authored Nov 6, 2024
1 parent 58e153d commit aac3197
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 61 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
name: Publish to PyPi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --user --upgrade setuptools wheel
pip install --user --upgrade build
- name: Build
run: python setup.py sdist bdist_wheel
run: python -m build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish_to_test_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ on:
push:
branches: [dev]
paths:
- 'setup.py'
- 'pyproject.toml'

jobs:
publish_to_test_pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_USERNAME: ${{ secrets.test_pypi_username }}
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload --skip-existing --repository testpypi dist/*
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: python -m pip install -r requirements_test.txt
- name: Lint
Expand All @@ -23,15 +23,15 @@ jobs:
os: [ubuntu-latest, windows-latest]
python-version: [3.8, 3.9, 3.10.12, 3.11.4, 3.12, 3.13-dev]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip build
python -m pip install -r requirements.txt
python setup.py install
python -m pip install .
- name: Run tests for ${{ matrix.python-version }}
run: pytest -vvv
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: debug-statements
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.1.1
hooks:
- id: flake8
args: ["--max-line-length=88"]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 23.3.0
rev: 24.10.0
hooks:
- id: black
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
### Modified
- Replace setup.py by pyproject.toml

## [0.5.1] - 2024-11-05
### Added
Expand Down
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[project]
name = "pytest-picked"
version = "0.5.1"
description = "Run the tests related to the changed files"
readme = { file = "README.md", content-type = "text/markdown" }
license = { text = "MIT" }
authors = [{ name = "Ana Paula Gomes", email = "apgomes88@gmail.com" }]
keywords = ["pytest", "testing", "changed files", "selective tests"]
requires-python = ">=3.8"
classifiers = [
"Framework :: Pytest",
"Intended Audience :: Developers",
"Topic :: Software Development :: Testing",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License"
]
dependencies = ["pytest>=3.7.0"]

[project.entry-points."pytest11"]
picked = "pytest_picked.plugin"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages]
find = { exclude = ["tests", "docs"] }
1 change: 1 addition & 0 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r requirements.txt
build==1.2.2.post1
pre-commit==4.0.1
tox==4.23.2
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

40 changes: 0 additions & 40 deletions setup.py

This file was deleted.

0 comments on commit aac3197

Please sign in to comment.