diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d6ff92..96ac722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,15 @@ Adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.10.0] - unreleased +## [0.10.0] - 2021-05-08 + +### Changed + +- Made files like CITATION.cff require a `--extras` flag + +### Fixed + +- Typer help ## [0.9.x] - 2021-03-14 @@ -17,6 +25,7 @@ and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Improved the contributing guide ### Removed + - Code of conduct file (a link is fine) ### Fixed diff --git a/CITATION.cff b/CITATION.cff deleted file mode 100644 index e295398..0000000 --- a/CITATION.cff +++ /dev/null @@ -1,16 +0,0 @@ -cff-version: 1.1.0 -message: Software reference -title: Tyrannosaurus -version: 0.9.7 -abstract: Generate beautifully modern Python projects with seamless, Github-based CI/CD and loads of integrations. -authors: - - - family-names: Myers-Turnbull - given-names: Douglas -keywords: - - python - - template - - pyproject-toml - - python-poetry - - conda-build -date-released: 2020-05-10T20:06:00.000Z diff --git a/README.md b/README.md index 07c4122..66ac795 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,8 @@ tyrannosaurus new myproject --track ``` After initializing your project, Tyrannosaurus will list manual steps like adding API keys. -Feel free to delete files you don’t want (codemeta and citation.cff, for example). +Just delete files you don’t want. Or pass `--extras` to include extra files like +azure-pipelines config and `codemeta.json`. ### 💡 Main behavior / features @@ -194,6 +195,7 @@ Some of the packages in the table above need more explanation: ### ✨ Projects made with Tyrannosaurus These are some example projects that were generated with Tyrannosaurus: + - [Tyrannosaurus](https://github.com/dmyersturnbull/tyrannosaurus) - [Mandos](https://github.com/dmyersturnbull/mandos) - [typed-dfs](https://github.com/dmyersturnbull/typed-dfs) diff --git a/codemeta.json b/codemeta.json deleted file mode 100644 index 6286153..0000000 --- a/codemeta.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "@context": "https://doi.org/10.5063/schema/codemeta-2.0", - "@type": "SoftwareSourceCode", - "identifier": "tyrannosaurus", - "name": "Tyrannosaurus", - "description": "Generate beautifully modern Python projects with seamless, Github-based CI/CD and loads of integrations.", - "codeRepository": "https://github.com/dmyersturnbull/tyrannosaurus", - "issueTracker": "https://github.com/dmyersturnbull/tyrannosaurus/issues", - "license": "https://www.apache.org/licenses/LICENSE-2.0", - "version": "0.9.7", - "author": [ - { - "@type": "Person", - "givenName": "Douglas", - "familyName": "Myers-Turnbull", - "@id": "https://orcid.org/0000-0003-3610-4808" - } - ], - "contributor": [ - { - "@type": "Person", - "givenName": "Kenyon", - "familyName": "Ralph" - } - ], - "maintainer": { - "@type": "Person", - "givenName": "Douglas", - "familyName": "Myers-Turnbull", - "@id": "https://orcid.org/0000-0003-3610-4808" - }, - "contIntegration": "https://github.com/dmyersturnbull/tyrannosaurus/actions", - "developmentStatus": "active", - "downloadUrl": "https://pypi.org/project/tyrannosaurus/", - "keywords": [ - "python", - "template", - "pyproject-toml", - "python-poetry", - "conda-build" - ], - "dateCreated": "2020-05-10", - "datePublished": "2020-05-12", - "programmingLanguage": "Python" -} diff --git a/poetry.lock b/poetry.lock index 4a8401b..d684fbf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -16,11 +16,11 @@ python-versions = "*" [[package]] name = "astroid" -version = "2.5.3" +version = "2.5.6" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false -python-versions = ">=3.6" +python-versions = "~=3.6" [package.dependencies] lazy-object-proxy = ">=1.4.0" @@ -36,21 +36,21 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "attrs" -version = "20.3.0" +version = "21.2.0" description = "Classes Without Boilerplate" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [package.extras] -dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "furo", "sphinx", "pre-commit"] -docs = ["furo", "sphinx", "zope.interface"] -tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] -tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit"] +docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"] [[package]] name = "babel" -version = "2.9.0" +version = "2.9.1" description = "Internationalization utilities" category = "dev" optional = false @@ -182,7 +182,7 @@ python-versions = "*" [[package]] name = "flake8" -version = "3.9.1" +version = "3.9.2" description = "the modular source code checker: pep8 pyflakes and co" category = "dev" optional = false @@ -233,14 +233,15 @@ smmap = ">=3.0.1,<5" [[package]] name = "gitpython" -version = "3.1.14" +version = "3.1.15" description = "Python Git Library" category = "dev" optional = false -python-versions = ">=3.4" +python-versions = ">=3.5" [package.dependencies] gitdb = ">=4.0.1,<5" +typing-extensions = ">=3.7.4.0" [[package]] name = "grayskull" @@ -264,7 +265,7 @@ testing = ["pytest", "mock", "pytest-cov", "pytest-console-scripts"] [[package]] name = "identify" -version = "2.2.3" +version = "2.2.4" description = "File identification library for Python" category = "dev" optional = false @@ -388,7 +389,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "pbr" -version = "5.5.1" +version = "5.6.0" description = "Python Build Reasonableness" category = "dev" optional = false @@ -486,7 +487,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pygments" -version = "2.8.1" +version = "2.9.0" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false @@ -502,7 +503,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "pytest" -version = "6.2.3" +version = "6.2.4" description = "pytest: simple powerful testing with Python" category = "dev" optional = false @@ -633,7 +634,7 @@ python-versions = "*" [[package]] name = "six" -version = "1.15.0" +version = "1.16.0" description = "Python 2 and 3 compatibility utilities" category = "main" optional = false @@ -688,7 +689,7 @@ test = ["pytest", "pytest-cov", "html5lib", "cython", "typed-ast"] [[package]] name = "sphinx-autoapi" -version = "1.8.0" +version = "1.8.1" description = "Sphinx API documentation generator" category = "dev" optional = false @@ -871,7 +872,7 @@ doc = ["mkdocs (>=1.1.2,<2.0.0)", "mkdocs-material (>=5.4.0,<6.0.0)", "markdown- [[package]] name = "typing-extensions" -version = "3.7.4.3" +version = "3.10.0.0" description = "Backported and Experimental Type Hints for Python 3.5+" category = "dev" optional = false @@ -900,7 +901,7 @@ brotli = ["brotlipy (>=0.6.0)"] [[package]] name = "virtualenv" -version = "20.4.3" +version = "20.4.6" description = "Virtual Python Environment builder" category = "dev" optional = false @@ -927,7 +928,7 @@ python-versions = "*" [metadata] lock-version = "1.1" python-versions = ">=3.8, <4" -content-hash = "eb01ba35b02582b1ccea9af03b87fd59687f5793a3ba79d6de7837a64aae6082" +content-hash = "025d2484a68b57d763f8a593898176853cf05d85c25c9c43bb0e06a651992e54" [metadata.files] alabaster = [ @@ -939,20 +940,20 @@ appdirs = [ {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, ] astroid = [ - {file = "astroid-2.5.3-py3-none-any.whl", hash = "sha256:bea3f32799fbb8581f58431c12591bc20ce11cbc90ad82e2ea5717d94f2080d5"}, - {file = "astroid-2.5.3.tar.gz", hash = "sha256:ad63b8552c70939568966811a088ef0bc880f99a24a00834abd0e3681b514f91"}, + {file = "astroid-2.5.6-py3-none-any.whl", hash = "sha256:4db03ab5fc3340cf619dbc25e42c2cc3755154ce6009469766d7143d1fc2ee4e"}, + {file = "astroid-2.5.6.tar.gz", hash = "sha256:8a398dfce302c13f14bab13e2b14fe385d32b73f4e4853b9bdfb64598baa1975"}, ] atomicwrites = [ {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, ] attrs = [ - {file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"}, - {file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"}, + {file = "attrs-21.2.0-py2.py3-none-any.whl", hash = "sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1"}, + {file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"}, ] babel = [ - {file = "Babel-2.9.0-py2.py3-none-any.whl", hash = "sha256:9d35c22fcc79893c3ecc85ac4a56cde1ecf3f19c540bba0922308a6c06ca6fa5"}, - {file = "Babel-2.9.0.tar.gz", hash = "sha256:da031ab54472314f210b0adcff1588ee5d1d1d0ba4dbd07b94dba82bde791e05"}, + {file = "Babel-2.9.1-py2.py3-none-any.whl", hash = "sha256:ab49e12b91d937cd11f0b67cb259a57ab4ad2b59ac7a3b41d6c06c0ac5b0def9"}, + {file = "Babel-2.9.1.tar.gz", hash = "sha256:bc0c176f9f6a994582230df350aa6e05ba2ebe4b3ac317eab29d9be5d2768da0"}, ] bandit = [ {file = "bandit-1.7.0-py3-none-any.whl", hash = "sha256:216be4d044209fa06cf2a3e51b319769a51be8318140659719aa7a115c35ed07"}, @@ -1046,8 +1047,8 @@ filelock = [ {file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"}, ] flake8 = [ - {file = "flake8-3.9.1-py2.py3-none-any.whl", hash = "sha256:3b9f848952dddccf635be78098ca75010f073bfe14d2c6bda867154bea728d2a"}, - {file = "flake8-3.9.1.tar.gz", hash = "sha256:1aa8990be1e689d96c745c5682b687ea49f2e05a443aff1f8251092b0014e378"}, + {file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"}, + {file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"}, ] flake8-bugbear = [ {file = "flake8-bugbear-21.4.3.tar.gz", hash = "sha256:2346c81f889955b39e4a368eb7d508de723d9de05716c287dc860a4073dc57e7"}, @@ -1062,16 +1063,16 @@ gitdb = [ {file = "gitdb-4.0.7.tar.gz", hash = "sha256:96bf5c08b157a666fec41129e6d327235284cca4c81e92109260f353ba138005"}, ] gitpython = [ - {file = "GitPython-3.1.14-py3-none-any.whl", hash = "sha256:3283ae2fba31c913d857e12e5ba5f9a7772bbc064ae2bb09efafa71b0dd4939b"}, - {file = "GitPython-3.1.14.tar.gz", hash = "sha256:be27633e7509e58391f10207cd32b2a6cf5b908f92d9cd30da2e514e1137af61"}, + {file = "GitPython-3.1.15-py3-none-any.whl", hash = "sha256:a77824e516d3298b04fb36ec7845e92747df8fcfee9cacc32dd6239f9652f867"}, + {file = "GitPython-3.1.15.tar.gz", hash = "sha256:05af150f47a5cca3f4b0af289b73aef8cf3c4fe2385015b06220cbcdee48bb6e"}, ] grayskull = [ {file = "grayskull-0.8.5-py3-none-any.whl", hash = "sha256:e7c93d1b61405ec22e4de3c0d704a8ae0b6281e554a3f99585c320c746d954c7"}, {file = "grayskull-0.8.5.tar.gz", hash = "sha256:ea8df14dc2953b21c4d38c00e24353218c6c2aec5e494fecc4fc55fdf47a4b25"}, ] identify = [ - {file = "identify-2.2.3-py2.py3-none-any.whl", hash = "sha256:398cb92a7599da0b433c65301a1b62b9b1f4bb8248719b84736af6c0b22289d6"}, - {file = "identify-2.2.3.tar.gz", hash = "sha256:4537474817e0bbb8cea3e5b7504b7de6d44e3f169a90846cbc6adb0fc8294502"}, + {file = "identify-2.2.4-py2.py3-none-any.whl", hash = "sha256:ad9f3fa0c2316618dc4d840f627d474ab6de106392a4f00221820200f490f5a8"}, + {file = "identify-2.2.4.tar.gz", hash = "sha256:9bcc312d4e2fa96c7abebcdfb1119563b511b5e3985ac52f60d9116277865b2e"}, ] idna = [ {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, @@ -1132,39 +1133,20 @@ markupsafe = [ {file = "MarkupSafe-1.1.1-cp35-cp35m-win32.whl", hash = "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1"}, {file = "MarkupSafe-1.1.1-cp35-cp35m-win_amd64.whl", hash = "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d"}, {file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5"}, {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473"}, {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7"}, {file = "MarkupSafe-1.1.1-cp36-cp36m-win32.whl", hash = "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66"}, {file = "MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5"}, {file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193"}, {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e"}, {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f"}, {file = "MarkupSafe-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2"}, {file = "MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c"}, {file = "MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15"}, {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2"}, {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b"}, {file = "MarkupSafe-1.1.1-cp38-cp38-win32.whl", hash = "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b"}, {file = "MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-win32.whl", hash = "sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8"}, {file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"}, ] mccabe = [ @@ -1212,8 +1194,8 @@ pathspec = [ {file = "pathspec-0.8.1.tar.gz", hash = "sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"}, ] pbr = [ - {file = "pbr-5.5.1-py2.py3-none-any.whl", hash = "sha256:b236cde0ac9a6aedd5e3c34517b423cd4fd97ef723849da6b0d2231142d89c00"}, - {file = "pbr-5.5.1.tar.gz", hash = "sha256:5fad80b613c402d5b7df7bd84812548b2a61e9977387a80a5fc5c396492b13c9"}, + {file = "pbr-5.6.0-py2.py3-none-any.whl", hash = "sha256:c68c661ac5cc81058ac94247278eeda6d2e6aecb3e227b0387c30d277e7ef8d4"}, + {file = "pbr-5.6.0.tar.gz", hash = "sha256:42df03e7797b796625b1029c0400279c7c34fd7df24a7d7818a1abb5b38710dd"}, ] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, @@ -1248,16 +1230,16 @@ pyflakes = [ {file = "pyflakes-2.3.1.tar.gz", hash = "sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"}, ] pygments = [ - {file = "Pygments-2.8.1-py3-none-any.whl", hash = "sha256:534ef71d539ae97d4c3a4cf7d6f110f214b0e687e92f9cb9d2a3b0d3101289c8"}, - {file = "Pygments-2.8.1.tar.gz", hash = "sha256:2656e1a6edcdabf4275f9a3640db59fd5de107d88e8663c5d4e9a0fa62f77f94"}, + {file = "Pygments-2.9.0-py3-none-any.whl", hash = "sha256:d66e804411278594d764fc69ec36ec13d9ae9147193a1740cd34d272ca383b8e"}, + {file = "Pygments-2.9.0.tar.gz", hash = "sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f"}, ] pyparsing = [ {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pytest = [ - {file = "pytest-6.2.3-py3-none-any.whl", hash = "sha256:6ad9c7bdf517a808242b998ac20063c41532a570d088d77eec1ee12b0b5574bc"}, - {file = "pytest-6.2.3.tar.gz", hash = "sha256:671238a46e4df0f3498d1c3270e5deb9b32d25134c99b7d75370a68cfbe9b634"}, + {file = "pytest-6.2.4-py3-none-any.whl", hash = "sha256:91ef2131a9bd6be8f76f1f08eac5c5317221d6ad1e143ae03894b862e8976890"}, + {file = "pytest-6.2.4.tar.gz", hash = "sha256:50bcad0a0b9c5a72c8e4e7c9855a3ad496ca6a881a3641b4260605450772c54b"}, ] pytest-cov = [ {file = "pytest-cov-2.11.1.tar.gz", hash = "sha256:359952d9d39b9f822d9d29324483e7ba04a3a17dd7d05aa6beb7ea01e359e5f7"}, @@ -1278,26 +1260,18 @@ pyyaml = [ {file = "PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185"}, {file = "PyYAML-5.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253"}, {file = "PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc"}, - {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347"}, - {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_s390x.whl", hash = "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541"}, {file = "PyYAML-5.4.1-cp36-cp36m-win32.whl", hash = "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5"}, {file = "PyYAML-5.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df"}, {file = "PyYAML-5.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018"}, {file = "PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63"}, - {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa"}, - {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_s390x.whl", hash = "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"}, {file = "PyYAML-5.4.1-cp37-cp37m-win32.whl", hash = "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b"}, {file = "PyYAML-5.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf"}, {file = "PyYAML-5.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46"}, {file = "PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb"}, - {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247"}, - {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_s390x.whl", hash = "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc"}, {file = "PyYAML-5.4.1-cp38-cp38-win32.whl", hash = "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc"}, {file = "PyYAML-5.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696"}, {file = "PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77"}, {file = "PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183"}, - {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122"}, - {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_s390x.whl", hash = "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6"}, {file = "PyYAML-5.4.1-cp39-cp39-win32.whl", hash = "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10"}, {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, @@ -1435,8 +1409,8 @@ requests = [ {file = "ruamel.yaml.jinja2-0.2.4.tar.gz", hash = "sha256:c8e1d4e6d638c519a548be754639cbfb06560f9f0a95922435bdb4cf64816801"}, ] six = [ - {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, - {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] smmap = [ {file = "smmap-4.0.0-py2.py3-none-any.whl", hash = "sha256:a9a7479e4c572e2e775c404dcd3080c8dc49f39918c2cf74913d30c4c478e3c2"}, @@ -1451,8 +1425,8 @@ sphinx = [ {file = "Sphinx-3.5.4.tar.gz", hash = "sha256:19010b7b9fa0dc7756a6e105b2aacd3a80f798af3c25c273be64d7beeb482cb1"}, ] sphinx-autoapi = [ - {file = "sphinx-autoapi-1.8.0.tar.gz", hash = "sha256:51ff98016e51edfa98c03bb829a9843a4add37184c199bcd95b6b1da8cc6a74c"}, - {file = "sphinx_autoapi-1.8.0-py2.py3-none-any.whl", hash = "sha256:7572d47066e2386ff336660f288cc136b326099d5d45082caa19adcf190ad44d"}, + {file = "sphinx-autoapi-1.8.1.tar.gz", hash = "sha256:842c0a8f49c824803f7edee31cb1cabd5001a987553bec7b4681283ec9e47d4a"}, + {file = "sphinx_autoapi-1.8.1-py2.py3-none-any.whl", hash = "sha256:aa453c1011e64ebdf6937539de4d65fe9c6a94c62c5522d2bcdf9aed5cd41ff1"}, ] sphinx-copybutton = [ {file = "sphinx-copybutton-0.3.1.tar.gz", hash = "sha256:0e0461df394515284e3907e3f418a0c60ef6ab6c9a27a800c8552772d0a402a2"}, @@ -1539,9 +1513,9 @@ typer = [ {file = "typer-0.3.2.tar.gz", hash = "sha256:5455d750122cff96745b0dec87368f56d023725a7ebc9d2e54dd23dc86816303"}, ] typing-extensions = [ - {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"}, - {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"}, - {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"}, + {file = "typing_extensions-3.10.0.0-py2-none-any.whl", hash = "sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497"}, + {file = "typing_extensions-3.10.0.0-py3-none-any.whl", hash = "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84"}, + {file = "typing_extensions-3.10.0.0.tar.gz", hash = "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342"}, ] unidecode = [ {file = "Unidecode-1.2.0-py2.py3-none-any.whl", hash = "sha256:12435ef2fc4cdfd9cf1035a1db7e98b6b047fe591892e81f34e94959591fad00"}, @@ -1552,8 +1526,8 @@ urllib3 = [ {file = "urllib3-1.26.4.tar.gz", hash = "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"}, ] virtualenv = [ - {file = "virtualenv-20.4.3-py2.py3-none-any.whl", hash = "sha256:83f95875d382c7abafe06bd2a4cdd1b363e1bb77e02f155ebe8ac082a916b37c"}, - {file = "virtualenv-20.4.3.tar.gz", hash = "sha256:49ec4eb4c224c6f7dd81bb6d0a28a09ecae5894f4e593c89b0db0885f565a107"}, + {file = "virtualenv-20.4.6-py2.py3-none-any.whl", hash = "sha256:307a555cf21e1550885c82120eccaf5acedf42978fd362d32ba8410f9593f543"}, + {file = "virtualenv-20.4.6.tar.gz", hash = "sha256:72cf267afc04bf9c86ec932329b7e94db6a0331ae9847576daaa7ca3c86b29a4"}, ] wrapt = [ {file = "wrapt-1.12.1.tar.gz", hash = "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"}, diff --git a/pyproject.toml b/pyproject.toml index e502fde..c4ccd41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ build-backend = "poetry.masonry.api" [tool.poetry] name = "tyrannosaurus" -version = "0.9.7" +version = "0.10.0" description = "Generate beautifully modern Python projects with seamless, GitHub-based CI/CD and loads of integrations." authors = ["Douglas Myers-Turnbull"] maintainers = ["Douglas Myers-Turnbull"] @@ -136,10 +136,10 @@ python = ">=3.8, <4" tomlkit = ">=0.7, <1" typer = ">=0.3, <1" requests = ">=2.24, <3" -grayskull = ">=0.8.4, <1" +grayskull = ">=0.8.5, <1" [tool.poetry.dev-dependencies] -pre-commit = ">=2.11, <3.0" +pre-commit = ">=2.12, <3.0" pre-commit-hooks = ">=3.4, <4.0" bandit = ">=1.7, <2.0" black = {git = "https://github.com/psf/black.git", rev="692c0f50d91"} diff --git a/tests/test_new.py b/tests/test_new.py index 3d4eb51..eb9cbc9 100644 --- a/tests/test_new.py +++ b/tests/test_new.py @@ -32,6 +32,7 @@ def _test_it(self, should_track=False, tyranno_vr="latest"): version="0.1.0", status=DevStatus.alpha, should_track=should_track, + extras=False, tyranno_vr=tyranno_vr, ).create(path) assert (path / "pyproject.toml").exists() diff --git a/tyrannosaurus/cli.py b/tyrannosaurus/cli.py index 256e200..6e43aee 100644 --- a/tyrannosaurus/cli.py +++ b/tyrannosaurus/cli.py @@ -9,14 +9,17 @@ """ from __future__ import annotations +import inspect import logging import os +import re from pathlib import Path from dataclasses import dataclass from subprocess import check_call # nosec from typing import Optional, Sequence import typer +from typer.models import ArgumentInfo, OptionInfo from tyrannosaurus.clean import Clean from tyrannosaurus.recipes import Recipe @@ -31,6 +34,10 @@ logger = logging.getLogger(__package__) +def flag(name: str, desc: str, **kwargs) -> typer.Option: + return typer.Option(False, "--" + name, help=desc, show_default=False, **kwargs) + + class _DevNull: # pragma: no cover """Pretends to write but doesn't.""" @@ -84,17 +91,13 @@ def __post_init__(self): def tyranno_main( - version: bool = False, - info: bool = False, + version: bool = flag("version", "Write version and exit"), + info: bool = flag("info", "Write info and exit (same as 'tyrannosaurus info')"), ): """ Tyrannosaurus. Tyrannosaurus can create new modern Python projects from a template and synchronize metadata across the project. - - Args: - version: Write version and exit - info: Write info and exit (same as 'tyrannosaurus info') """ if version or info: Msg.write_info() @@ -109,52 +112,62 @@ class CliCommands: Commands for Tyrannosaurus. """ + @classmethod + def commands(cls): + return [cls.new, cls.sync, cls.env, cls.recipe, cls.update, cls.clean, cls.info, cls.build] + _APACHE2 = typer.Option(License.apache2) _ENV_YAML = Path("environment.yml") @staticmethod @cli.command() def new( - name: str, - license: str = _APACHE2, - user: Optional[str] = None, - authors: Optional[str] = None, - description: str = "A Python project", - keywords: str = "", - version: str = "0.1.0", - status: Optional[DevStatus] = None, - track: bool = False, - tyranno: str = "current", - prompt: bool = False, - verbose: bool = False, + name: str = typer.Argument( + "project", help="The name of the project, including any dashes or capital letters" + ), + license: str = typer.Option( + "apache2", help=f"License name. One of {', '.join(s.name for s in License)}" + ), + user: Optional[str] = typer.Option(None, help="GitHub user or org"), + authors: Optional[str] = typer.Option(None, help="Author names, comma-separated"), + desc: str = typer.Option("A Python project", help="Short project description"), + keywords: str = typer.Option( + "", help="List of <6 keywords, comma-separated", show_default=False + ), + version: str = typer.Option("0.1.0", help="Your project's semantic version"), + status: Optional[str] = typer.Option( + None, + help=f""" +PyPi classifier for dev status. + One of: {", ".join(DevStatus)} + [default: chosen by 'version'] +""".replace( + "\n", "" + ), + show_choices=False, + ), + track: bool = flag("track", "Track an empty remote repo"), + extras: bool = flag("extras", "Include uncommon files like codemeta.json"), + tyranno: str = typer.Option( + "current", + help=""" +Tyrannosaurus version to use as the template. +Choices: an exact version, 'current' (this version), 'stable', or 'latest'. +""".strip(), + ), + prompt: bool = flag("prompt", "Prompt for info"), + verbose: bool = flag("verbose", "Output more info"), ) -> None: # pragma: no cover """ - Creates a new project. - - Args: - name: The name of the project, including any dashes or capital letters - license: The name of the license. One of: apache2, cc0, ccby, ccbync, gpl3, lgpl3, mit - user: Github repository user or org name - authors: List of author names, comma-separated - description: A <100 char description for the project - keywords: A list of <= 5 keywords, comma-separated - version: A semantic version (for your project) - status: A PyPi classifier for development status; - if None, defaults to "alpha" if version<1.0 else "production" - track: Track a remote repo (should be an empty repo; otherwise there will be a merge conflict) - tyranno: Version of tyrannosaurus to use as the template; can be: - an exact version number, - 'current' for the currently installed version, - 'stable' for the latest stable version, - or 'latest' for the bleeding-edge version - prompt: Prompt for info - verbose: Output more information + Create a new project. """ state = CliState(verbose=verbose) if version.startswith("v"): version = version[1:] if status is None: status = DevStatus.guess_from_version(version) + else: + status = DevStatus[status] if prompt: name = typer.prompt("name", type=str, default=name) description = typer.prompt("description", type=str, default="A new project") @@ -193,12 +206,13 @@ def new( license_name=license, username=e.user, authors=e.authors, - description=description, + description=desc, keywords=keywords, version=version, status=status, should_track=track, tyranno_vr=tyranno.strip(" \r\n\t"), + extras=extras, debug=state.verbose, ).create(path) Msg.success(f"Done! Created a new repository under {name}") @@ -213,15 +227,11 @@ def new( @staticmethod @cli.command() def sync( - dry_run: bool = False, - verbose: bool = False, + dry_run: bool = flag("dry-run", "Don't write; just output"), + verbose: bool = flag("verbose", "Output more info"), ) -> None: # pragma: no cover """ - Syncs project metadata between configured files. - - Args: - dry_run: Don't write; just output what it would do - verbose: Output more information + Sync project metadata between configured files. """ state = CliState(dry_run=dry_run, verbose=verbose) context = Context(Path(os.getcwd()), dry_run=state.dry_run) @@ -233,23 +243,17 @@ def sync( @staticmethod @cli.command() def env( - path: Path = _ENV_YAML, - name: Optional[str] = None, - dev: bool = False, - extras: bool = False, - dry_run: bool = False, - verbose: bool = False, + path: Path = typer.Option(_ENV_YAML, help="Write to this path"), + name: Optional[str] = typer.Option( + None, help="Name of the environment. [default: project name]", show_default=False + ), + dev: bool = flag("dev", "Include dev/build dependencies"), + extras: bool = flag("extras", "Include optional dependencies"), + dry_run: bool = flag("dry-run", "Don't write; just output"), + verbose: bool = flag("verbose", "Output more info"), ) -> None: # pragma: no cover """ - Generates an Anaconda environment file. - - Args: - path: Write to his path - name: The name of the environment; defaults to the project name - dev: Include development/build dependencies - extras: Include optional dependencies - dry_run: Don't write; just output what it would do - verbose: Output more information + Generate an Anaconda environment file. """ state = CliState(dry_run=dry_run, verbose=verbose) typer.echo("Writing environment file...") @@ -262,15 +266,11 @@ def env( @staticmethod @cli.command() def recipe( - dry_run: bool = False, - verbose: bool = False, + dry_run: bool = flag("dry-run", "Don't write; just output"), + verbose: bool = flag("verbose", "Output more info"), ) -> None: # pragma: no cover """ - Generates a Conda recipe using grayskull. - - Args: - dry_run: Don't write; just output what it would do - verbose: Output more information + Generate a Conda recipe using grayskull. """ state = CliState(dry_run=dry_run, verbose=verbose) dry_run = state.dry_run @@ -282,11 +282,11 @@ def recipe( @staticmethod @cli.command() def update( - auto_fix=typer.Option("auto_fix", hidden=True), - verbose: bool = False, + auto_fix=flag("auto-fix", "Update dependencies in place (not supported yet)", hidden=True), + verbose: bool = flag("verbose", "Output more information"), ) -> None: # pragma: no cover """ - Finds and lists dependencies that could be updated. + Find and list dependencies that could be updated. Args: auto_fix: Update dependencies in place (not supported yet) @@ -307,23 +307,20 @@ def update( @staticmethod @cli.command() def clean( - dists: bool = False, - aggressive: bool = False, - hard_delete: bool = False, - dry_run: bool = False, - verbose: bool = False, + dists: bool = flag("dists", "Remove dists"), + aggressive: bool = flag( + "aggressive", "Delete additional files, including .swp and .ipython_checkpoints" + ), + hard_delete: bool = flag( + "hard-delete", "Use shutil.rmtree instead of moving to .tyrannosaurus" + ), + dry_run: bool = flag("dry-run", "Don't write; just output"), + verbose: bool = flag("verbose", "Output more information"), ) -> None: # pragma: no cover """ - Removes unwanted files. + Remove unwanted files. Deletes the contents of ``.tyrannosaurus``. Then trashes temporary and unwanted files and directories to a tree under ``.tyrannosaurus``. - - Args: - dists: Remove dists - aggressive: Delete additional files, including .swp and .ipython_checkpoints - hard_delete: If true, call shutil.rmtree instead of moving to .tyrannosaurus - dry_run: Don't write; just output what it would do - verbose: Output more information """ state = CliState(verbose=verbose, dry_run=dry_run) dry_run = state.dry_run @@ -334,16 +331,18 @@ def clean( @cli.command() def info() -> None: # pragma: no cover """ - Prints Tyrannosaurus info. + Print Tyrannosaurus info. """ Msg.write_info() @staticmethod @cli.command() def build( - bare: bool = False, - dry_run: bool = False, - verbose: bool = False, + bare: bool = flag("bare", "Don't use tox or virtualenv."), + dry_run: bool = flag( + "dry-run", "Don't run; just output. Useful for making a script template." + ), + verbose: bool = flag("verbose", "Output more info"), ) -> None: # pragma: no cover """ Syncs, builds, and tests your project. @@ -354,7 +353,8 @@ def build( - tox - tyrannosaurus clean - z----------------------------------------z + --------------------------------------------------------------- + If the ``bare`` IS set: Runs the commands without tox and without creating a new virtualenv. This can be useful if you're using Conda and have a dependency only available through Anaconda. @@ -376,12 +376,8 @@ def build( - sphinx-build -b html docs docs/html - tyrannosaurus clean - pip install . - z----------------------------------------z - Args: - bare: Do not use tox or virtualenv. See above. - dry_run: Just output the commands to stdout (don't run them). Useful for making a script template. - verbose: Output more information + --------------------------------------------------------------- """ state = CliState(dry_run=dry_run, verbose=verbose) CliCommands.build_internal(bare=bare, dry=state.dry_run) @@ -401,5 +397,28 @@ def build_internal(bare: bool = False, dry: bool = False) -> Sequence[str]: return cmds +def _fix_docstrings(commands): + for f in commands: + if "Args:" in [q.strip() for q in f.__doc__.splitlines()]: + continue + f.__doc__ += "\n" + " " * 8 + "Args:\n" + for p in inspect.signature(f).parameters.values(): + arg = p.default + if arg is not None: + d = arg.default + if isinstance(d, (OptionInfo, ArgumentInfo)) and hasattr(d, "default"): + d = d.default + try: + h = re.compile(" +").sub(arg.help.replace("\n", "").strip(), " ") + f.__doc__ += " " * 12 + p.name + ": " + h + "\n" + if d is not False: + f.__doc__ += " " * (12 + 1 + len(p.name)) + f" [default: {str(d)}]\n" + except (AttributeError, TypeError): + f.__doc__ += " " * 12 + p.name + " " + + if __name__ == "__main__": cli() +# else: +# _fix_docstrings(CliCommands.commands()) +# _fix_docstrings([tyranno_main]) diff --git a/tyrannosaurus/new.py b/tyrannosaurus/new.py index 507dc50..5749db0 100644 --- a/tyrannosaurus/new.py +++ b/tyrannosaurus/new.py @@ -46,6 +46,7 @@ def __init__( version: str, status: DevStatus, should_track: bool, + extras: bool, tyranno_vr: str, debug: bool = False, ): @@ -64,6 +65,7 @@ def __init__( self.version = version self.status = status self.should_track = should_track + self.extras = extras self.repo_to_track = f"https://github.com/{username}/{name.lower()}.git" self.tyranno_vr = str(tyranno_vr) self.parser = LiteralParser( @@ -97,9 +99,10 @@ def create(self, path: Path) -> None: Path(path / "LICENSE.txt").write_text(license_text, encoding="utf8") # copy resources, overwriting for source in (path / "tyrannosaurus" / "resources").iterdir(): - if not Path(source).is_file(): + source = Path(source) + if not source.is_file(): continue - resource = Path(source).name + resource = source.name # $dot so we can circumvent the .gitignore resource = resource.replace("$dot", ".") resource = resource.replace("$project", self.project_name) @@ -122,6 +125,16 @@ def create(self, path: Path) -> None: # remove unneeded tyrannosaurus source dir # we already copied the files in tyrannosaurus/resources/ shutil.rmtree(str(path / "tyrannosaurus")) + if not self.extras: + for f in { + "azure-pipelines.yml", + "CITATION.cff", + "codemeta.json", + "Vagrantfile", + "environment.yml", + ".travis.yml", + }: + (path / f).unlink(missing_ok=True) # track remote via git if self.should_track: self._track(path) diff --git a/tyrannosaurus/resources/pyproject.toml.txt b/tyrannosaurus/resources/pyproject.toml.txt index c94b544..fc975e2 100644 --- a/tyrannosaurus/resources/pyproject.toml.txt +++ b/tyrannosaurus/resources/pyproject.toml.txt @@ -69,11 +69,11 @@ classifiers = [ # if you detect that the user is running a newer version than they were using before. # If you don't need this, you can remove these entries. # (You might also be able to package this pyproject.toml file and read metadata from it.) -include = [ - "README.md", - "LICENSE.txt", - "CHANGELOG.md" -] +#include = [ +# "README.md", +# "LICENSE.txt", +# "CHANGELOG.md" +#] [tool.poetry.urls] # 'CI', 'Issues', and 'Download' seem to have special meanings @@ -116,7 +116,7 @@ coverage = {extras = ["toml"], version = "^5"} flake8 = "^3" flake8-bugbear = ">=21" flake8-docstrings = "^1" -pre-commit = ">=2.11, <3.0" +pre-commit = ">=2.12, <3.0" pre-commit-hooks = ">=3.4, <4.0" pytest = "^6" pytest-cov = "^2"