Commit Graph

101 Commits

Author SHA1 Message Date
Jon Grace-Cox
5dd8ac7fe3 chore: Add github workflows
Add github workflows for running pre-commit hooks on all files and
running pytests.
2024-12-30 07:11:12 -05:00
Jon Grace-Cox
9d4470a1a0 Allow badges with no value or no label (#89)
This commit allows badges to be generated with only a label or only
a value.

Badges must provide at least a label or a value, so it is not valid
to create a badge with no label and no value. This will result in
a `ValueError` being raised.
2024-12-30 06:53:33 -05:00
Jon Grace-Cox
a076a4867a chore: Update pre-commit hooks
Update pre-commit hooks to latest version and apply fixes for
mypy type checking and linting.
2024-12-30 06:46:24 -05:00
Jon Grace-Cox
cc5a757663 Add 3.11 to travis ci (#85)
Switch to Ubuntu jammy release, and add 3.11 testing.
2023-03-27 10:30:29 -07:00
Jon Grace-Cox
65ee5a2578 Update pypi deploy to use token (#84) 2022-08-25 17:10:44 -04:00
Jon Grace-Cox
f4fbb70d87 Add pepy.tech total downloads badge to readme (#83) 2022-08-24 18:52:28 -04:00
Jon Grace-Cox
bc1ff41348 Fix readme and contribution guide (#82) 2022-08-24 18:44:22 -04:00
Jon Grace-Cox
ea180efc1e Add snyk health badge to readme (#81) v1.14.0 2022-08-24 18:36:59 -04:00
Jon Grace-Cox
cb40df6d11 Refactor invoke tasks (#80)
- Add `--version` to cli
- Add invoke tasks:
  - `package.build`
  - `package.install`
  - `test.cli`
- Refactor invoke task implementation
- Refactor `run_pypi_tests.sh`
- Split into separate files to support running locally
2022-08-24 17:05:55 -04:00
Jannis Mainczyk
2bd52f41cd anybadge cli accessible via python -m (#79)
* anybadge cli can be called via python -m

* fix: anybadge should be shown in cli usage string

* also allow executing anybadge.server as module

* test: same output regardless of how cli is called
2022-08-24 15:08:08 -04:00
Jon Grace-Cox
2af319bc6b Add standard color names (#76)
Closes #56
v1.13.0
2022-08-15 14:43:27 -04:00
Jon Grace-Cox
406138d08e Add example emoji svg files (#75)
* Stop ignoring `example/*.svg` files
* Add emoji example svg files
2022-08-14 13:02:41 -04:00
Jon Grace-Cox
34374dbc2b Add emoji examples to documentation (#74)
Closes #43
2022-08-14 12:33:12 -04:00
Jon Grace-Cox
ea2eccd948 Add testing for PyPi releases (#72) v1.12.0 2022-08-13 15:35:46 -04:00
Jon Grace-Cox
ff0ee0d5e0 Fix pypi deploy (#71)
Ensure deploy happens from project root directory
v1.11.2rc2
2022-08-13 14:57:10 -04:00
Jon Grace-Cox
1c986d4ad8 Add package testing to CI (#68)
* Make `build_examples.py` callable from python
* Allow tests to run from outside project directory
* Add invoke tasks
* Add server tests
* Run travis tests against wheel package instead of local code
* Update `badge.write_badge()` to support `pathlib.Path`
* Update `CONTRIBUTING.md`
v1.11.2rc1
2022-08-13 13:22:15 -04:00
Jon Grace-Cox
9b7318417d Fix broken server import (#70)
Closes #66
2022-08-13 12:12:19 -04:00
Jon Grace-Cox
b891c596d6 Allow template as pathlib.Path (#69) 2022-08-13 12:07:55 -04:00
Jon Grace-Cox
54fa6a40c2 Add Python 3.10 testing to ci (#67)
Update Travis CI config to use later Ubuntu worker
Add Python 3.10 testing
2022-08-09 19:01:52 -04:00
Jon Grace-Cox
27b25f7a26 Fix backage build missing templates submodule (#63) (#64) v1.11.1 2022-08-09 08:22:05 -04:00
Jon Grace-Cox
8a434d95b5 Drop <3.7 support and add type hints (#59)
- Drop support for Python <3.7
- Bump the pre-commit version used in CI
- Add type hinting and docstrings
- Add mypy to pre-commit config
- Fix typing issues
- Update colors module
  - Update colors module to use uppercase hex codes
  - Add `__lt__` to allow sorting colors by name
- Fix `build_examples.py` to work with color Enum
- Update example badges in `README.md`
- Fix typing issues in server
- Update travis links in `README.md`
- Fix PyPi deployment bug (#60)
v1.11.0
2022-08-08 23:19:50 -04:00
Jon Grace-Cox
f16867114a Add pre-commit config and apply changes (#54)
- Add .pre-commit-config.yaml with initial config.
- Add python black pre-commit config
- Apply pre-commit code changes
- Add information to CONTRIBUTING.md
- Add pre-commit to build requirements
- Run pre-commit during travis CI build
- Use a travis build matrix to control when pre-commit runs
  in the CI process. Use explicit include to only run
  pre-commit on Python 3.9.
v1.10.0
2022-08-08 19:02:02 -04:00
Jon Grace-Cox
217555a155 Fix typo in readme (#49) (#58) 2022-08-08 18:38:04 -04:00
Jon Grace-Cox
efab2f6f79 Add missing example svg files (#53) 2022-03-10 07:34:48 -05:00
Jon Grace-Cox
b6ca345ebe Drop py27 support and refactor (#51) (#52)
Python version support
======================
- Drop Python 2.7 support
- Add testing for Python 3.4 and 3.9
- Set python version requirements in setup.py

Package changes
===============
- Split module up into a package with submodules
- Break templates out into package resources
- Incorporate server into same package
- Use Enum for colors
- Refresh example badges
- Simplify documentation - Remove cli options and python api
  documentation from the README as it is hard to maintain, and
  often goes out-of-date
- Add CONTRIBUTING.md
2022-03-10 07:26:46 -05:00
Matt Calvert
6de2da8d58 Add style support and add GitLab Scoped labels (#50)
- Add new `--style` argument
- Add new **GitLab Scoped** label style
- Update documentation to reflect new argument
v1.9.0 v1.9.0rc1
2022-02-22 08:52:24 -05:00
Karthikeyan Singaravelan
17b4addc37 Use assertRaisesRegex for Python 3.11 compatibility (#48)
Use `assertRaisesRegex` instead of `assertRaisesRegexp` for Python 3.11 compatibility.
v1.8.0
2021-11-09 10:49:24 -05:00
Jon Grace-Cox
fa351616e1 Add buymeacoffee link to README.md 2021-11-04 14:45:58 -04:00
Fabian Affolter
6fbc545fad Remove unittest (#47) 2021-08-26 15:40:54 -04:00
Jon Grace-Cox
eec5a0c1bc Update issue templates 2021-05-26 09:40:07 -04:00
Jon Grace-Cox
a5ff4f0dfe Add semantic version support (#45) (#46)
Allow value and thresholds to be interpreted as semantic version numbers
by passing --semver (cli) or semver=True (python).

Add docs, unittests, import error handling, cli updates, requirements updates.
1.8.0rc1
2021-05-25 18:22:43 -04:00
Jon Grace-Cox
0f8dfbb695 Add label and value padding char command line options. (#40)
Also fixes command line usage with args defaulting to None on main function.
v1.7.0rc3 v1.7.0
2020-03-15 13:29:08 -04:00
Jon Grace-Cox
d38230ce3a Fix command line argument passing to main. (#39) v1.7.0rc2 2020-03-15 13:12:41 -04:00
Jon Grace-Cox
aeedfbb93d Fix padding issues (#38)
* Set default padding chars to 0.5.
* Split num_padding_chars into num_label_padding_chars and num_value_padding_chars
  to allow better control. Retain num_padding_chars as an input parameter, but
  internally it is dropped.
* Remove padding multipliers.
* Add measurements image for developers. Helps show what each of the internal
  measurements are.
* Add script to build example badges.
* Update example badges.

Reliability
=======

* Raise a value error if an invalid font is passed.
* Handle labels that are not passed as str.
* Raise a value error if an invalid color name is passed.

Testing
=======

* Expand doctests to increase test coverage.
* Add Arial size 11 font and extra font sizes (mainly for testing).
* Make parse_args and main more testable by taking args as an input parameter.
* Use useful badge text in unittest badges.
* Add template svg file for testing.
* Add HTML coverage generation to travis yaml.
v1.7.0rc1
2020-03-15 12:51:34 -04:00
deeplook
c6af09f82b Render badges inside notebook cells. (#37) 2020-01-27 17:32:05 -05:00
Jon Grace-Cox
b7387b9f1e Fix README code used to generate color examples table 2019-11-16 23:39:46 -05:00
Jon Grace-Cox
32935bd204 Add github cdn url prefixes to README color examples (#35) v1.6.2 2019-11-16 23:34:34 -05:00
Jon Grace-Cox
1cb03dcab9 33 fix setup readme issue (#34)
* Add bash prefixes to README code sections
* Switch to providing long description as markdown in setup.py

Closes #33
v1.6.1
2019-11-16 23:19:38 -05:00
Jon Grace-Cox
c4d06f3e05 Add extra colors and update docs (#31)
* Add a wider set of color names.
* Add better documentation in readme to show use of colors and
  custom colors.
* Add example color badges.
v1.6.0
2019-08-12 09:41:50 -04:00
Jon Grace-Cox
fdf66043a0 Add unittest to validate handling of float values with .00 (#29) v1.5.1 2019-07-16 17:48:24 -04:00
Krukov D
77cd93e79a X.0 is not int (#28) 2019-07-16 17:46:05 -04:00
Jon Grace-Cox
aebea09340 Fix int and float value detection (#26)
* Fix int and float value detection (Closes #25)
* Fix badge_width doctest
* Ignore all svg files across the whole project.  This is mainly to prevent
  accidentally adding them after tests run.
v1.5.0
2019-07-11 21:43:48 -04:00
Jon Grace-Cox
6465c451c4 Fix widths (#24)
* Update badge widths

Switch to using get_text_width(' ') to get padding width.
This results in a more compact badge as the font_width that was used before
was the guesstimated font width that was too large.

* Update default num padding chars

This commit updates the number of padding characters to zero.  Many issues have been
raised around producing more compact badges, so it feels like the most common usage would be
with this option defaulted to zero.
2019-07-11 21:17:28 -04:00
Jon Grace-Cox
b394b47cc2 Adding all the badges to README (#23) 2019-06-21 01:12:01 -04:00
Jon Grace-Cox
086a2960aa Merge pull request #22 from jongracecox/add-download-stats
Add downloads stats to README
2019-06-21 00:24:42 -04:00
Jon Grace-Cox
6b232b1e9b Add downloads stats to README 2019-06-21 00:24:17 -04:00
Jon Grace-Cox
a284b4f32e Add demo repl to README.md 2019-06-02 00:28:34 -04:00
Jon Grace-Cox
c5fc1a6c61 Merge pull request #20 from jongracecox/10-fix-mutltiple-badge-width-issue
Use different SVG mask ids for each generated badge
v1.4.0
2019-06-01 23:52:10 -04:00
Jon Grace-Cox
3d24ecba0f Use different SVG mask ids for each generated badge
Within a single Python session anybadge will use different SVG mask IDs.
This is an attempt to fix the issue where SVG files displayed in the same
HTML will re-use the same mask, and therefore appear with the same dimensions.

Uses a singleton on the class to maintain a sequence of mask ids.

Includes unittests to ensure new ID is used for each badge.
2019-06-01 23:49:13 -04:00
Jon Grace-Cox
a4b20c60d1 Merge pull request #19 from jongracecox/add-repr-and-str-dunders
Add repr and str dunder functions
v1.3.0
2019-06-01 23:18:33 -04:00