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:
Metadata
Release files for pptoml 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pptoml-0.3.0.tar.gz | 8.6 MB | Without provenance | Details for pptoml-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pptoml-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for pptoml-0.3.0-py3-none-any.whl |
Total release size: 8.6 MB
Release files / pptoml-0.3.0.tar.gz
| Download URL | pptoml-0.3.0.tar.gz |
|---|---|
| Size | 8.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf99c9b333270cc7e5be079420cbb8c306b3b2a570f97db9b4283c6329ed2bf4
|
|
BLAKE2b-256 checksum How to use checksums |
125cdebc9db092998a4543810fc3cd3b58e92fc92b4e63ff72a926d28ae28853
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.1
|
Release files / pptoml-0.3.0-py3-none-any.whl
| Download URL | pptoml-0.3.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ff4685718aece4094296946bfad6d06cffc38f4073edd31a2bcc3dae9e8f143
|
|
BLAKE2b-256 checksum How to use checksums |
9b8e45b86a63bd897f92e67bb5063a5664b83560b8b5a656063bebe0de73d40d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.1
|
Security for pptoml 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.