Skip to content

Commit

Permalink
create badge with npm
Browse files Browse the repository at this point in the history
  • Loading branch information
epogrebnyak committed Jan 30, 2023
1 parent f28cc11 commit f48a4e5
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 82 deletions.
2 changes: 1 addition & 1 deletion app/Static_site_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified app/ssg_count.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
6 changes: 3 additions & 3 deletions example/update.py
Original file line number Diff line number Diff line change
@@ -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)
46 changes: 25 additions & 21 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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%
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
109 changes: 53 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"devDependencies": {
"@prettier/plugin-xml": "^2.2.0",
"prettier": "^2.7.1"
},
"dependencies": {
"badge-maker": "^3.3.1"
}
}
2 changes: 1 addition & 1 deletion tests/test_badge.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app.badge import Badge
from example.badge import Badge


class TestBadge:
Expand Down

0 comments on commit f48a4e5

Please sign in to comment.