diff --git a/app/Static_site_generators.py b/app/Static_site_generators.py index 9099a6f..cabbc7b 100644 --- a/app/Static_site_generators.py +++ b/app/Static_site_generators.py @@ -15,7 +15,7 @@ def get_data(): st.session_state["url_csv"] = url_csv _df = st.session_state["df"] -n = len(_df) # FIXME: can use n in badge, without generating local file +n = len(_df) # FIXME: can use n in badge, without generating local file f""" [gh]: https://github.com/epogrebnyak/ssg-dataset diff --git a/app/ssg_count.svg b/app/ssg_count.svg index 43f9482..ed133f7 100644 Binary files a/app/ssg_count.svg and b/app/ssg_count.svg differ diff --git a/app/badge.py b/example/badge.py similarity index 100% rename from app/badge.py rename to example/badge.py diff --git a/example/update.py b/example/update.py index ec9bfa1..5533928 100644 --- a/example/update.py +++ b/example/update.py @@ -1,8 +1,8 @@ from pathlib import Path from ssg import yaml_to_csv -from ssg.metadata import write_metadata data_folder = Path(__name__).resolve().parent / "data" -yaml_to_csv(yaml_path=data_folder / "ssg.yaml", csv_path=data_folder / "ssg.csv") -write_metadata(data_folder) +yaml_path = data_folder / "ssg.yaml" +csv_path = data_folder / "ssg.csv" +yaml_to_csv(yaml_path, csv_path) diff --git a/justfile b/justfile index a151fe3..6634303 100644 --- a/justfile +++ b/justfile @@ -4,59 +4,63 @@ package := "ssg" list: just --list -# launch streamlit app (--server.enableCORS=false) +# Launch Streamlit app app: poetry run streamlit run app/Static_site_generators.py -# black and isort +# Use black and isort lint: black . isort . -# build documentation -docs: +# Build documentation files +docs-build: poetry run sphinx-build -a docs docs/site -# show documentation in browser -show: +# Show documentation in browser +docs-show: python -m http.server -d docs/site -# publish documentation to Github Pages -pages: +# Publish documentation to Github Pages +docs-publish: poetry run ghp-import docs/site -# create rst source for API documentation -apidoc: +# Create RST source file for API documentation +docs-create: poetry run sphinx-apidoc -o docs src/{{package}} -# git pull from remote and rebase -pull: - git pull --rebase - -update-all: +# Create new CSV file, patch version and make release +update-full: just update just patch just release -# update csv file (project-specific) +# Create new CSV file and SVG badge update: poetry run python example/update.py - poetry run python app/badge.py + just badge +# Bump 0.0.x version number patch: poetry version patch +# Make Github release using version from poetry.toml release: just version | xargs -I % gh release create % -# run pytest +# Run pytest and pyright test: poetry run pytest poetry run pyright src -# run precommit hook +# Run precommit hook precommit: - pre-commit run --all-files + pre-commit run --all-files +# Show package version version: - poetry version -s | tr -d '\r' | xargs -I % echo v% \ No newline at end of file + poetry version -s | tr -d '\r' | xargs -I % echo v% + +# Create brightgreen SVG badge with SSG count +badge: + wc -l data/ssg.csv | xargs -I % npx badge SSG % :brightgreen > app/ssg_count.svg \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 43f2e16..703e7c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,82 +1,54 @@ { - "name": "ssg-dataset", - "lockfileVersion": 2, "requires": true, - "packages": { - "": { - "devDependencies": { - "@prettier/plugin-xml": "^2.2.0", - "prettier": "^2.7.1" - } - }, - "node_modules/@prettier/plugin-xml": { + "lockfileVersion": 1, + "dependencies": { + "@prettier/plugin-xml": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-2.2.0.tgz", "integrity": "sha512-UWRmygBsyj4bVXvDiqSccwT1kmsorcwQwaIy30yVh8T+Gspx4OlC0shX1y+ZuwXZvgnafmpRYKks0bAu9urJew==", "dev": true, - "dependencies": { + "requires": { "@xml-tools/parser": "^1.0.11", "prettier": ">=2.4.0" } }, - "node_modules/@xml-tools/parser": { + "@xml-tools/parser": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@xml-tools/parser/-/parser-1.0.11.tgz", "integrity": "sha512-aKqQ077XnR+oQtHJlrAflaZaL7qZsulWc/i/ZEooar5JiWj1eLt0+Wg28cpa+XLney107wXqneC+oG1IZvxkTA==", "dev": true, - "dependencies": { + "requires": { "chevrotain": "7.1.1" } }, - "node_modules/chevrotain": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-7.1.1.tgz", - "integrity": "sha512-wy3mC1x4ye+O+QkEinVJkPf5u2vsrDIYW9G7ZuwFl6v/Yu0LwUuT2POsb+NUWApebyxfkQq6+yDfRExbnI5rcw==", - "dev": true, - "dependencies": { - "regexp-to-ast": "0.5.0" - } - }, - "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" + "anafanafo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anafanafo/-/anafanafo-2.0.0.tgz", + "integrity": "sha512-Nlfq7NC4AOkTJerWRIZcOAiMNtIDVIGWGvQ98O7Jl6Kr2Dk0dX5u4MqN778kSRTy5KRqchpLdF2RtLFEz9FVkQ==", + "requires": { + "char-width-table-consumer": "^1.0.0" } }, - "node_modules/regexp-to-ast": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz", - "integrity": "sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw==", - "dev": true - } - }, - "dependencies": { - "@prettier/plugin-xml": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-2.2.0.tgz", - "integrity": "sha512-UWRmygBsyj4bVXvDiqSccwT1kmsorcwQwaIy30yVh8T+Gspx4OlC0shX1y+ZuwXZvgnafmpRYKks0bAu9urJew==", - "dev": true, + "badge-maker": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/badge-maker/-/badge-maker-3.3.1.tgz", + "integrity": "sha512-OO/PS7Zg2E6qaUWzHEHt21Q5VjcFBAJVA8ztgT/fIdSZFBUwoyeo0ZhA6V5tUM8Vcjq8DJl6jfGhpjESssyqMQ==", "requires": { - "@xml-tools/parser": "^1.0.11", - "prettier": ">=2.4.0" + "anafanafo": "2.0.0", + "css-color-converter": "^2.0.0" } }, - "@xml-tools/parser": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@xml-tools/parser/-/parser-1.0.11.tgz", - "integrity": "sha512-aKqQ077XnR+oQtHJlrAflaZaL7qZsulWc/i/ZEooar5JiWj1eLt0+Wg28cpa+XLney107wXqneC+oG1IZvxkTA==", - "dev": true, + "binary-search": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/binary-search/-/binary-search-1.3.6.tgz", + "integrity": "sha512-nbE1WxOTTrUWIfsfZ4aHGYu5DOuNkbxGokjV6Z2kxfJK3uaAb8zNK1muzOeipoLHZjInT4Br88BHpzevc681xA==" + }, + "char-width-table-consumer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/char-width-table-consumer/-/char-width-table-consumer-1.0.0.tgz", + "integrity": "sha512-Fz4UD0LBpxPgL9i29CJ5O4KANwaMnX/OhhbxzvNa332h+9+nRKyeuLw4wA51lt/ex67+/AdsoBQJF3kgX2feYQ==", "requires": { - "chevrotain": "7.1.1" + "binary-search": "^1.3.5" } }, "chevrotain": { @@ -88,6 +60,31 @@ "regexp-to-ast": "0.5.0" } }, + "color-convert": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-0.5.3.tgz", + "integrity": "sha512-RwBeO/B/vZR3dfKL1ye/vx8MHZ40ugzpyfeVG5GsiuGnrlMWe2o8wxBbLCpw9CsxV+wHuzYlCiWnybrIA0ling==" + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "css-color-converter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/css-color-converter/-/css-color-converter-2.0.0.tgz", + "integrity": "sha512-oLIG2soZz3wcC3aAl/7Us5RS8Hvvc6I8G8LniF/qfMmrm7fIKQ8RIDDRZeKyGL2SrWfNqYspuLShbnjBMVWm8g==", + "requires": { + "color-convert": "^0.5.2", + "color-name": "^1.1.4", + "css-unit-converter": "^1.1.2" + } + }, + "css-unit-converter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.2.tgz", + "integrity": "sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA==" + }, "prettier": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", diff --git a/package.json b/package.json index 9faf4e9..a64b512 100644 --- a/package.json +++ b/package.json @@ -2,5 +2,8 @@ "devDependencies": { "@prettier/plugin-xml": "^2.2.0", "prettier": "^2.7.1" + }, + "dependencies": { + "badge-maker": "^3.3.1" } } diff --git a/tests/test_badge.py b/tests/test_badge.py index 58125c5..fe5993a 100644 --- a/tests/test_badge.py +++ b/tests/test_badge.py @@ -1,4 +1,4 @@ -from app.badge import Badge +from example.badge import Badge class TestBadge: