Skip to content

Commit

Permalink
Use pyproject.toml and Python 3.8+ (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri authored May 15, 2024
2 parents e7983e5 + 7c0f859 commit d55badb
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 261 deletions.
24 changes: 11 additions & 13 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,27 @@ check_task:
name: check (Linux - 3.11)
alias: check
depends_on: [build]
container: {image: "python:3.11-bullseye"} # most recent => better types
container: {image: "python:3.11-bookworm"} # most recent => better types
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
<<: *task-template
install_script: pip install tox
check_script: tox --installpkg dist/*.whl -e lint,typecheck

linux_task:
matrix:
- name: test (Linux - 3.6)
container: {image: "python:3.6-bullseye"}
allow_failures: true # EoL
- name: test (Linux - 3.7)
container: {image: "python:3.7-bullseye"}
- name: test (Linux - 3.8)
container: {image: "python:3.8-bullseye"}
container: {image: "python:3.8-bookworm"}
- name: test (Linux - 3.9)
container: {image: "python:3.9-bullseye"}
container: {image: "python:3.9-bookworm"}
- name: test (Linux - 3.10)
container: {image: "python:3.10-bullseye"}
container: {image: "python:3.10-bookworm"}
- name: test (Linux - 3.11)
container: {image: "python:3.11-bullseye"}
container: {image: "python:3.11-bookworm"}
- name: test (Linux - 3.12)
container: {image: "python:3.12-bullseye"}
container: {image: "python:3.12-bookworm"}
- name: test (Linux - 3.13)
container: {image: "python:3.13-rc-bookworm"}
allow_failures: true # RC
install_script:
- python -m pip install --upgrade pip tox pipx
<<: *test-template
Expand Down Expand Up @@ -132,7 +130,7 @@ freebsd_task:
<<: *test-template

windows_task:
name: test (Windows - 3.9.10)
name: test (Windows - 3.9.13)
windows_container:
image: "cirrusci/windowsservercore:2019"
os_version: 2019
Expand All @@ -142,7 +140,7 @@ windows_task:
install_script:
# Activate long file paths to avoid some errors
- ps: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- choco install -y --no-progress python3 --version=3.9.10 --params "/NoLockdown"
- choco install -y --no-progress python3 --version=3.9.13 --params "/NoLockdown"
- pip install --upgrade certifi
- python -m pip install -U pip tox pipx
<<: *test-template
Expand Down
26 changes: 14 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ repos:
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
Expand All @@ -18,6 +20,12 @@ repos:
- id: mixed-line-ending
args: ['--fix=lf']

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
Expand All @@ -33,11 +41,11 @@ repos:
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 24.4.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
language_version: python3
- id: black
language_version: python3

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
Expand All @@ -48,17 +56,11 @@ repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell # See setup.cfg for args
- id: codespell
args: [-w]

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear>=23.2.13]

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade
args:
- --py37-plus
4 changes: 0 additions & 4 deletions docs/dev-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,6 @@ Please notice plugins are activated in a specific order, which can interfere
with the order that the processors run. They are sorted using Python's built-in
``sorted`` function.

When writing your own plugin, please have a look on `our library of helper
functions`_ that implement common operations.


.. |basename| replace:: ``basename``
.. |ini_cfg| replace:: ``.ini/.cfg``
Expand All @@ -390,7 +387,6 @@ functions`_ that implement common operations.
.. _entry-point: https://setuptools.pypa.io/en/stable/userguide/entry_point.html#entry-points
.. _idempotent: https://en.wikipedia.org/wiki/Idempotence#Computer_science_meaning
.. _our docs: https://ini2toml.readthedocs.io/en/stable/api/ini2toml.html
.. _our library of helper functions: https://ini2toml.readthedocs.io/en/stable/api/ini2toml.html
.. _PyPI: https://pypi.org
.. _Python package: https://packaging.python.org/
.. _TOML: https://toml.io/en/
103 changes: 99 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,104 @@
[build-system]
# AVOID CHANGING REQUIRES: IT WILL BE UPDATED BY PYSCAFFOLD!
requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5", "wheel"]
requires = ["setuptools>=61.2", "setuptools_scm[toml]>=5"]
build-backend = "setuptools.build_meta"

[project]
name = "ini2toml"
description = "Automatically conversion of .ini/.cfg files to TOML equivalents"
authors = [{name = "Anderson Bravalheri", email = "[email protected]"}]
readme ="README.rst"
license = {text = "MPL-2.0"}
requires-python = ">=3.8"
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
]
dependencies = [
"packaging>=20.7",
"setuptools>=60", # local setuptools._distutils is the default
]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/abravalheri/ini2toml/"
Documentation = "https://ini2toml.readthedocs.io/"
Source = "https://github.com/abravalheri/ini2toml"
Tracker = "https://github.com/abravalheri/ini2toml/issues"
Changelog = "https://ini2toml.readthedocs.io/en/latest/changelog.html"
Download = "https://pypi.org/project/ini2toml/#files"

[project.optional-dependencies]
full = [
"configupdater>=3.0.1,<4",
"tomlkit>=0.10.0,<2",
]
lite = [
"tomli-w>=0.4.0,<2",
]
all = [
"configupdater>=3.0.1,<4",
"tomlkit>=0.10.0,<2",
"tomli-w>=0.4.0,<2",
]
experimental = [
"pyproject-fmt>=0.4.0,<2"
]
testing = [
"isort",
"setuptools",
"tomli",
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-randomly",
"validate-pyproject>=0.6,<2",
]

[project.scripts]
ini2toml = "ini2toml.cli:run"

[project.entry-points."ini2toml.processing"]
setuptools_pep621 = "ini2toml.plugins.setuptools_pep621:activate"
best_effort = "ini2toml.plugins.best_effort:activate"
isort = "ini2toml.plugins.isort:activate"
coverage = "ini2toml.plugins.coverage:activate"
pytest = "ini2toml.plugins.pytest:activate"
mypy = "ini2toml.plugins.mypy:activate"
independent_tasks = "ini2toml.plugins.profile_independent_tasks:activate"
toml_incompatibilities = "ini2toml.plugins.toml_incompatibilities:activate"

[tool.setuptools_scm]
# For smarter version schemes and other configuration options,
# check out https://github.com/pypa/setuptools_scm
version_scheme = "no-guess-dev"

[tool.pytest.ini_options]
addopts = """
--cov ini2toml
--cov-report term-missing
--doctest-modules
-vv
"""
norecursedirs = [
"dist",
"build",
".tox",
]
testpaths = ["src", "tests"]
# Use pytest markers to select/deselect specific tests
# markers =
# slow: mark tests as slow (deselect with '-m "not slow"')
# system: mark end-to-end system tests

[tool.codespell]
skip = "tests/examples/*"

[mypy]
pretty = true
show_error_codes = true
show_error_context = true
show_traceback = true
ignore_missing_imports = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_unused_configs = true
# Add here plugins
# plugins = mypy_django_plugin.main, returns.contrib.mypy.returns_plugin
Loading

0 comments on commit d55badb

Please sign in to comment.