Library and CLI tool for parsing, validating, modifying, and updating `pyproject.toml` files.
Project description
pptoml
Library and CLI tool for parsing, validating, modifying, and updating pyproject.toml files.
Table of Contents
Installation
as a module
<virtual environment shenanigans>
pip install pptoml
as a cli app
pipx install pptoml
Usage
as a module
from pathlib import Path
from pptoml.inout import load_config
from pptoml.fetch import fetch_info
config = load_config(Path('path/to/pyproject.toml'))
info = fetch_info(config)
as a cli app
$ pptoml --help
Usage: pptoml [OPTIONS] COMMAND [ARGS]...
cli for pptoml
╭─ Options ───────────────────────────────────────────╮
│ --install-completion Install completion │
│ for the current │
│ shell. │
│ --show-completion Show completion for │
│ the current shell, to │
│ copy it or customize │
│ the installation. │
│ --help Show this message and │
│ exit. │
╰─────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────╮
│ dump print pyproject config in specified │
│ format │
│ get print the value of the specified field │
│ info fetch generally useful info about the │
│ project from the pyproject config │
│ new generate a pyproject.toml file │
│ validate validate pyproject against PEP │
│ specifications │
╰─────────────────────────────────────────────────────╯
example info fetch
$ pptoml info
name pptoml
description Library and CLI tool for parsing, validating, modifying, and updating `pyproject.toml` files.
authors Patrick Armengol
python_version >=3.7
dependencies typer, tomli, validate-pyproject, questionary
license Apache-2.0 OR MIT
multi_licensed True
scripts pptoml
docs_url https://github.com/patrickarmengol/pptoml#readme
issues_url https://github.com/patrickarmengol/pptoml/issues
source_url https://github.com/patrickarmengol/pptoml
build_backend hatchling
type_checking pyright
formatting autopep8
linting ruff
testing coverage
other_tools hatch
example new pyproject.toml generation
$ pptoml new
? backend: hatchling
? project name: asdf
? project description: does something i think
? licenses: [MIT]
? author name: Pat Cat
? author email: pat@cat.cat
? github username (for urls): patthecat
? tools: done (3 selections)
? max line length (for tools): 120
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "asdf"
version = "0.0.1"
description = 'does something i think'
readme = "README.md"
requires-python = ">=3.7"
license = "MIT"
license-files = { globs = ["LICENSE*"] }
keywords = []
authors = [
{ name = "Pat Cat", email = "pat@cat.cat" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = []
[project.scripts]
[project.urls]
Documentation = "https://github.com/patthecat/asdf#readme"
Issues = "https://github.com/patthecat/asdf/issues"
Source = "https://github.com/patthecat/asdf"
[tool.pyright]
include = ["src/pptoml", "tests"]
exclude = [
"**/__pycache__",
]
typeCheckingMode = "strict"
[tool.ruff]
target-version = "py37"
line-length = 120
select = ["A", "B", "C", "E", "F", "FBT", "I", "N", "Q", "RUF", "S", "T", "UP", "W", "YTT"]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Ignore McCabe complexity
"C901",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords
"S105", "S106", "S107",
]
unfixable = [
# Don't touch unused imports
"F401",
]
[tool.ruff.isort]
known-first-party = ["pptoml"]
[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.per-file-ignores]
# Tests can use relative imports and assertions
"tests/**/*" = ["I252", "S101"]
[tool.autopep8]
max_line_length = 120
Roadmap
0.1.0
- fetch general info for the project
- dump config in various formats
0.2.0
using existing validate-pyproject library to validate
postponed support for PEP 639, tracked in https://github.com/abravalheri/validate-pyproject/issues/70
- validate with schema
0.3.0
- generate new pyproject.toml with prompts
0.4.0
the following depend on tomlkit, which is a bit broken for type hinting atm
- update version
- add, remove dependencies
0.5.0
- check for dep updates
License
pptoml is distributed under the terms of any of the following licenses:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pptoml-0.3.0.tar.gz.
File metadata
- Download URL: pptoml-0.3.0.tar.gz
- Upload date:
- Size: 8.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf99c9b333270cc7e5be079420cbb8c306b3b2a570f97db9b4283c6329ed2bf4
|
|
| MD5 |
65738b10f3eaa86c99f2424e723b55b1
|
|
| BLAKE2b-256 |
125cdebc9db092998a4543810fc3cd3b58e92fc92b4e63ff72a926d28ae28853
|
File details
Details for the file pptoml-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pptoml-0.3.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ff4685718aece4094296946bfad6d06cffc38f4073edd31a2bcc3dae9e8f143
|
|
| MD5 |
9f257094b69767687409a1f745ef5f11
|
|
| BLAKE2b-256 |
9b8e45b86a63bd897f92e67bb5063a5664b83560b8b5a656063bebe0de73d40d
|