Browse Source

Use pre-commit

pull/7/head
/dev/null 6 days ago
parent
commit
870e45dd67
  1. 33
      .pre-commit-config.yaml
  2. 12
      .woodpecker.yml
  3. 7
      Makefile
  4. 5
      Pipfile
  5. 206
      Pipfile.lock
  6. 21
      README.md
  7. 24
      setup.cfg
  8. 18
      src/sporestack/api.py
  9. 6
      src/sporestack/cli.py

33
.pre-commit-config.yaml

@ -0,0 +1,33 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 8fe62d14e0b4d7d845a7022c5c2c3ae41bdd3f26 # frozen: v4.1.0
hooks:
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: f1d4e742c91dd5179d742b0db9293c4472b765f8 # frozen: 21.12b0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: c5e8fa75dda5f764d20f66a215d71c21cfa198e1 # frozen: 5.10.1
hooks:
- id: isort
- repo: https://github.com/myint/autoflake
rev: 7a53fdafc82c33f446915b60fcac947c51279260 # frozen: v1.4
hooks:
- id: autoflake
- repo: https://github.com/asottile/pyupgrade
rev: e695ecd365119ab4e5463f6e49bea5f4b7ca786b # frozen: v2.31.0
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: 58b14248db425913ea7502c0b1af9d6653403e07 # frozen: v1.20.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/jackdewinter/pymarkdown
rev: cf71b3c9cb0c361c4a17eacb80ed52432b57b420 # frozen: 0.9.4
hooks:
- id: pymarkdown
args: [--disable-rules=MD013, scan]

12
.woodpecker.yml

@ -1,9 +1,9 @@
pipeline:
python-3.7:
group: test
image: python:3.7-slim # Alpine doesn't work for 3.7
image: python:3.7
commands:
- pip install pipenv==2021.11.23
- pip install pipenv==2022.1.8
- pipenv install --dev --deploy
- pipenv run almake test-pytest # We only test with pytest on 3.7
@ -20,9 +20,9 @@ pipeline:
python-3.9:
group: test
image: python:3.9-slim # Alpine image times out for some reason with 3.9
image: python:3.9
commands:
- pip install pipenv==2021.11.23
- pip install pipenv==2022.1.8
- pipenv install --dev --deploy
- pipenv run almake test
- pipenv run almake build-dist
@ -30,9 +30,9 @@ pipeline:
python-3.10:
group: test
image: python:3.10-alpine
image: python:3.10
commands:
- pip install pipenv==2021.11.23
- pip install pipenv==2022.1.8
- pipenv install --dev --deploy
- pipenv run almake test
- pipenv run almake build-dist

7
Makefile

@ -1,10 +1,5 @@
format:
python -m black .
python -m isort .
test:
python -m black --check .
python -m isort --check .
python -m pre_commit run --all-files
python -m pflake8 .
python -m mypy --strict .
$(MAKE) test-pytest

5
Pipfile

@ -7,8 +7,6 @@ name = "pypi"
sporestack = {editable = true, path = "."}
[dev-packages]
# Have to do == because it's a pre-release.
black = "==21.12b0"
flake8 = "~=4.0"
pyproject-flake8 = "==0.0.1a2"
flake8-noqa = "~=1.2"
@ -16,7 +14,6 @@ pep8-naming = "~=0.12.1"
mypy = "==0.930"
pytest = "~=6.2"
pytest-cov = "~=3.0"
isort = "~=5.8"
types-requests = "~=2.25"
@ -31,3 +28,5 @@ pdoc = "~=8.0"
# Python `make` implementation
almost-make = "~=0.5.1"
pre-commit = "~=2.16"

206
Pipfile.lock

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "332e87d408920da810397e416c5ae36ae0ce33237a903534140537ace099c76d"
"sha256": "2cf2975515ad77967e5e47f08449225f237994d287b80b01b466d5ea6aefdcbe"
},
"pipfile-spec": 6,
"requires": {},
@ -23,11 +23,11 @@
},
"charset-normalizer": {
"hashes": [
"sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721",
"sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c"
"sha256:876d180e9d7432c5d1dfd4c5d26b72f099d503e8fcc0feb7532c9289be60fcbd",
"sha256:cb957888737fc0bbcd78e3df769addb41fd1ff8cf950dc9e7ad7793f1bf44455"
],
"markers": "python_version >= '3'",
"version": "==2.0.9"
"version": "==2.0.10"
},
"click": {
"hashes": [
@ -99,11 +99,11 @@
"socks"
],
"hashes": [
"sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24",
"sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"
"sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61",
"sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
"version": "==2.26.0"
"version": "==2.27.1"
},
"segno": {
"hashes": [
@ -135,11 +135,11 @@
},
"urllib3": {
"hashes": [
"sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece",
"sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844"
"sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed",
"sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==1.26.7"
"version": "==1.26.8"
}
},
"develop": {
@ -167,14 +167,6 @@
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==21.4.0"
},
"black": {
"hashes": [
"sha256:77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3",
"sha256:a615e69ae185e08fdd73e4715e260e2479c861b5740057fde6e8b4e3b7dd589f"
],
"index": "pypi",
"version": "==21.12b0"
},
"bleach": {
"hashes": [
"sha256:0900d8b37eba61a802ee40ac0061f8c2b5dee29c1927dd1d233e075ebf5a71da",
@ -198,21 +190,21 @@
],
"version": "==2021.10.8"
},
"charset-normalizer": {
"cfgv": {
"hashes": [
"sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721",
"sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c"
"sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426",
"sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"
],
"markers": "python_version >= '3'",
"version": "==2.0.9"
"markers": "python_full_version >= '3.6.1'",
"version": "==3.3.1"
},
"click": {
"charset-normalizer": {
"hashes": [
"sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3",
"sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"
"sha256:876d180e9d7432c5d1dfd4c5d26b72f099d503e8fcc0feb7532c9289be60fcbd",
"sha256:cb957888737fc0bbcd78e3df769addb41fd1ff8cf950dc9e7ad7793f1bf44455"
],
"markers": "python_version >= '3.6'",
"version": "==8.0.3"
"markers": "python_version >= '3'",
"version": "==2.0.10"
},
"colorama": {
"hashes": [
@ -278,6 +270,13 @@
"markers": "python_version >= '3.6'",
"version": "==6.2"
},
"distlib": {
"hashes": [
"sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b",
"sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"
],
"version": "==0.3.4"
},
"docutils": {
"hashes": [
"sha256:23010f129180089fbcd3bc08cfefccb3b890b0050e1ca00c867036e9d161b98c",
@ -286,6 +285,14 @@
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==0.18.1"
},
"filelock": {
"hashes": [
"sha256:38b4f4c989f9d06d44524df1b24bd19e167d851f19b50bf3e3559952dddc5b80",
"sha256:cf0fc6a2f8d26bd900f19bf33915ca70ba4dd8c56903eeb14e1e7a2fd7590146"
],
"markers": "python_version >= '3.7'",
"version": "==3.4.2"
},
"flake8": {
"hashes": [
"sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d",
@ -308,6 +315,14 @@
],
"version": "==1.0.2"
},
"identify": {
"hashes": [
"sha256:8d80d877441073e7222ff272da45ca5ca1d901412790544b446e7d363ad5e9f0",
"sha256:ac9c919c8ac5b90d03f8e1bce6dedcbd8a3b2a59c46737c04ed852e2d307af29"
],
"markers": "python_full_version >= '3.6.1'",
"version": "==2.4.3"
},
"idna": {
"hashes": [
"sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
@ -331,14 +346,6 @@
],
"version": "==1.1.1"
},
"isort": {
"hashes": [
"sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7",
"sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"
],
"index": "pypi",
"version": "==5.10.1"
},
"jinja2": {
"hashes": [
"sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8",
@ -349,11 +356,11 @@
},
"keyring": {
"hashes": [
"sha256:3dc0f66062a4f8f6f2ce30d6a516e6e623e6c3c2e76864204ceaf64695408f07",
"sha256:88f206024295e3c6fb16bb0a60fb4bb7ec1185629dc5a729f12aa7c236d01387"
"sha256:9012508e141a80bd1c0b6778d5c610dd9f8c464d75ac6774248500503f972fb9",
"sha256:b0d28928ac3ec8e42ef4cc227822647a19f1d544f21f96457965dc01cf555261"
],
"markers": "python_version >= '3.6'",
"version": "==23.4.0"
"markers": "python_version >= '3.7'",
"version": "==23.5.0"
},
"markupsafe": {
"hashes": [
@ -470,6 +477,13 @@
],
"version": "==0.4.3"
},
"nodeenv": {
"hashes": [
"sha256:3ef13ff90291ba2a4a7a4ff9a979b63ffdd00a464dbe04acf0ea6471517a4c2b",
"sha256:621e6b7076565ddcacd2db0294c0381e01fd28945ab36bcf00f41c5daf63bef7"
],
"version": "==1.6.0"
},
"packaging": {
"hashes": [
"sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb",
@ -478,19 +492,12 @@
"markers": "python_version >= '3.6'",
"version": "==21.3"
},
"pathspec": {
"hashes": [
"sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a",
"sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"
],
"version": "==0.9.0"
},
"pdoc": {
"hashes": [
"sha256:8d6cdf6f28ac57fe9a28aaab7db3a982f0c9b3f3edad6d3cd148cb3111bcda78"
"sha256:d06c3854d039e603e5b1047c91763f23c092a66873cd1b61653f62bb2506c360"
],
"index": "pypi",
"version": "==8.1.0"
"version": "==8.2.0"
},
"pep517": {
"hashes": [
@ -530,6 +537,14 @@
"markers": "python_version >= '3.6'",
"version": "==1.0.0"
},
"pre-commit": {
"hashes": [
"sha256:758d1dc9b62c2ed8881585c254976d66eae0889919ab9b859064fc2fe3c7743e",
"sha256:fe9897cac830aa7164dbd02a4e7b90cae49630451ce88464bca73db486ba9f65"
],
"index": "pypi",
"version": "==2.16.0"
},
"py": {
"hashes": [
"sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719",
@ -556,11 +571,11 @@
},
"pygments": {
"hashes": [
"sha256:59b895e326f0fb0d733fd28c6839bd18ad0687ba20efc26d4277fd1d30b971f4",
"sha256:9135c1af61eec0f650cd1ea1ed8ce298e54d56bcd8cc2ef46edd7702c171337c"
"sha256:44238f1b60a76d78fc8ca0528ee429702aae011c265fe6a8dd8b63049ae41c65",
"sha256:4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a"
],
"markers": "python_version >= '3.5'",
"version": "==2.11.1"
"version": "==2.11.2"
},
"pyparsing": {
"hashes": [
@ -594,6 +609,45 @@
"index": "pypi",
"version": "==3.0.0"
},
"pyyaml": {
"hashes": [
"sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293",
"sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b",
"sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57",
"sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b",
"sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4",
"sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07",
"sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba",
"sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9",
"sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287",
"sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513",
"sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0",
"sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0",
"sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92",
"sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f",
"sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2",
"sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc",
"sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c",
"sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86",
"sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4",
"sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c",
"sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34",
"sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b",
"sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c",
"sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb",
"sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737",
"sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3",
"sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d",
"sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53",
"sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78",
"sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803",
"sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a",
"sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174",
"sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"
],
"markers": "python_version >= '3.6'",
"version": "==6.0"
},
"readme-renderer": {
"hashes": [
"sha256:a50a0f2123a4c1145ac6f420e1a348aafefcc9211c846e3d51df05fe3d865b7d",
@ -607,11 +661,11 @@
"socks"
],
"hashes": [
"sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24",
"sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"
"sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61",
"sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
"version": "==2.26.0"
"version": "==2.27.1"
},
"requests-toolbelt": {
"hashes": [
@ -622,10 +676,11 @@
},
"rfc3986": {
"hashes": [
"sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835",
"sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"
"sha256:50b1502b60e289cb37883f3dfd34532b8873c7de9f49bb546641ce9cbd256ebd",
"sha256:97aacf9dbd4bfd829baad6e6309fa6573aaf1be3f6fa735c8ab05e46cecb261c"
],
"version": "==1.5.0"
"markers": "python_version >= '3.7'",
"version": "==2.0.0"
},
"six": {
"hashes": [
@ -645,11 +700,11 @@
},
"tomli": {
"hashes": [
"sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f",
"sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c"
"sha256:b5bde28da1fed24b9bd1d4d2b8cba62300bfb4ec9a6187a957e8ddb9434c5224",
"sha256:c292c34f58502a1eb2bbb9f5bbc9a5ebc37bee10ffb8c2d6bbdfa8eb13cc14e1"
],
"markers": "python_version >= '3.6'",
"version": "==1.2.3"
"markers": "python_version >= '3.7'",
"version": "==2.0.0"
},
"tqdm": {
"hashes": [
@ -669,11 +724,18 @@
},
"types-requests": {
"hashes": [
"sha256:ad18284931c5ddbf050ccdd138f200d18fd56f88aa3567019d8da9b2d4fe0344",
"sha256:d63fa617846dcefff5aa2d59e47ab4ffd806e4bb0567115f7adbb5e438302fe4"
"sha256:9c9390b18b222956155af6678570f452edafa3bb94bd5a4efe67da1105aa128c",
"sha256:a67dc1a8512312b8cb89f3ba95f9a0e69ef3436ae77c9bd4f328cd88f17adda2"
],
"index": "pypi",
"version": "==2.26.3"
"version": "==2.27.5"
},
"types-urllib3": {
"hashes": [
"sha256:35c17be09e1bcef3b1e2101c5172b97cdb78330915973c741f4c1979d8405ef9",
"sha256:61a0099899b1472bfbae8ee6ad196950aac46705b99216188aa962ad1e514ed5"
],
"version": "==1.26.4"
},
"typing-extensions": {
"hashes": [
@ -685,11 +747,19 @@
},
"urllib3": {
"hashes": [
"sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece",
"sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844"
"sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed",
"sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==1.26.7"
"version": "==1.26.8"
},
"virtualenv": {
"hashes": [
"sha256:339f16c4a86b44240ba7223d0f93a7887c3ca04b5f9c8129da7958447d079b09",
"sha256:d8458cf8d59d0ea495ad9b34c2599487f8a7772d796f9910858376d1600dd2dd"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==20.13.0"
},
"webencodings": {
"hashes": [

21
README.md

@ -2,18 +2,18 @@
## Requirements
* Python 3.7-3.10 (or maybe newer)
* Python 3.7-3.10 (or maybe newer)
## Installation
* `python3 -m pip install sporestack`
* Recommended: Create a virtual environment, first. Can use `pipenv`, as well.
* `pip install sporestack`
* Recommended: Create a virtual environment, first. Can use `pipenv`, as well.
## Running without installing (preferred)
* Make sure `pipx` is installed.
* `pipx run sporestack`
* Make sure you're on the latest version with `sporestack version`.
* Make sure `pipx` is installed.
* `pipx run sporestack`
* Make sure you're on the latest version with `sporestack version`.
## Screenshot
@ -37,13 +37,14 @@ More examples on the [website](https://sporestack.com).
## Notes
* You can use `--settlement-token` if you don't want to pay with QR codes all the time.
* If using a .onion API endpoint, will try to use a local Tor proxy if connecting to a .onion URL. (127.0.0.1:9050)
* You can use `--settlement-token` if you don't want to pay with QR codes all the time.
* If using a .onion API endpoint, will try to use a local Tor proxy if connecting to a .onion URL. (127.0.0.1:9050)
## Developing
* `pipenv install --deploy --dev`
* `pipenv run make test` (If you don't have `make`, use `almake`)
* `pipenv install --deploy --dev`
* `pipenv run make test` (If you don't have `make`, use `almake`)
* Hint: `pre-commit run` is a faster way to run some of the tests/autofixers.
## Licence

24
setup.cfg

@ -1,11 +1,21 @@
[metadata]
name = sporestack
version = 5.1.2
author = SporeStack
author_email = admin@sporestack.com
description = SporeStack.com library and client. Launch servers with Monero or Bitcoin.
long_description = file: README.md
long_description_content_type = text/markdown
url = https://sporestack.com/
author = SporeStack
author_email = admin@sporestack.com
license = Unlicense
license_file = LICENSE.txt
classifiers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
keywords =
bitcoin
bitcoincash
@ -15,19 +25,17 @@ keywords =
infrastructure
vps
virtual private server
license = Unlicense
url = https://sporestack.com/
[options]
python_requires = >=3.7
packages = find:
package_dir = =src
install_requires =
segno
pydantic
requests[socks]>=2.22.0
segno
typer
pydantic
importlib-metadata;python_version<"3.8"
python_requires = >=3.7
package_dir = =src
zip_safe = False
[options.packages.find]

18
src/sporestack/api.py

@ -12,7 +12,7 @@ from pydantic import BaseModel
from .models import NetworkInterface, Payment
class TokenEnable(object):
class TokenEnable:
url = "/token/{token}/enable"
method = "POST"
@ -25,7 +25,7 @@ class TokenEnable(object):
payment: Payment
class TokenAdd(object):
class TokenAdd:
url = "/token/{token}/add"
method = "POST"
@ -38,7 +38,7 @@ class TokenAdd(object):
payment: Payment
class TokenBalance(object):
class TokenBalance:
url = "/token/{token}/balance"
method = "GET"
@ -48,7 +48,7 @@ class TokenBalance(object):
usd: str
class ServerLaunch(object):
class ServerLaunch:
url = "/server/{machine_id}/launch"
method = "POST"
@ -81,7 +81,7 @@ class ServerLaunch(object):
flavor: str
class ServerTopup(object):
class ServerTopup:
url = "/server/{machine_id}/topup"
method = "POST"
@ -103,7 +103,7 @@ class ServerTopup(object):
latest_api_version: int
class ServerInfo(object):
class ServerInfo:
url = "/server/{machine_id}/info"
method = "GET"
@ -116,16 +116,16 @@ class ServerInfo(object):
region: str
class ServerStart(object):
class ServerStart:
url = "/server/{machine_id}/start"
method = "POST"
class ServerStop(object):
class ServerStop:
url = "/server/{machine_id}/stop"
method = "POST"
class ServerDelete(object):
class ServerDelete:
url = "/server/{machine_id}/delete"
method = "POST"

6
src/sporestack/cli.py

@ -344,10 +344,10 @@ def pretty_machine_info(info: Dict[str, Any]) -> str:
human_expiration = time.strftime("%Y-%m-%d %H:%M:%S %z", time.localtime(expiration))
if "running" in info:
msg += "Running: {}\n".format(info["running"])
msg += "Expiration: {} ({})\n".format(expiration, human_expiration)
msg += f"Expiration: {expiration} ({human_expiration})\n"
time_to_live = expiration - int(time.time())
hours = time_to_live // 3600
msg += "Server will be deleted in {} hours.".format(hours)
msg += f"Server will be deleted in {hours} hours."
return msg
@ -374,7 +374,7 @@ def list() -> None:
"%Y-%m-%d %H:%M:%S %z", time.localtime(expiration)
)
msg = hostname
msg += " expired ({} {}): ".format(expiration, human_expiration)
msg += f" expired ({expiration} {human_expiration}): "
msg += str(e)
typer.echo(msg)

Loading…
Cancel
Save