Skip to content

Commit

Permalink
Drop support for Python < 3.10, add py.typed and switch to uv/ruff/py…
Browse files Browse the repository at this point in the history
…right (#14)

* Updates

* add release workflow

* ruff fix

* just sync

* format

* update gitignore
  • Loading branch information
sciyoshi authored Mar 2, 2025
1 parent 53831de commit fa52300
Show file tree
Hide file tree
Showing 11 changed files with 282 additions and 502 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

51 changes: 21 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,27 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: 3.11

- name: cache poetry install
uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
path: ~/.local
key: poetry-0
python-version: ${{ matrix.python-version }}
- run: pip install uv
- run: uv venv
- run: uv sync
- run: uv run pytest

- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: cache deps
id: cache-deps
uses: actions/cache@v3
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'

- run: poetry install --no-interaction

- run: poetry run pytest tests.py
- run: poetry run black mudder.py tests.py
- run: poetry run flake8 mudder.py
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install uv
- run: uv venv
- run: uv sync
- run: uv run ruff format --check .
- run: uv run ruff check .
- run: uv run pyright .
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release

on:
release:
types:
- created

jobs:
build:
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: pip install uv
- run: uv build
- run: uv publish
129 changes: 125 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,125 @@
.mypy_cache
**/__pycache__
*.egg-info
dist
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
.DS_Store
.vscode/
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ This library is a port of [fasiha/mudderjs][1] to Python.

From the original readme:

> Generate lexicographically-spaced strings between two strings from
> pre-defined alphabets.
> Generate lexicographically-spaced strings between two strings from pre-defined
> alphabets.
[1]: https://github.com/fasiha/mudderjs
This technique is also known as
[_fractional indexing_](https://observablehq.com/@dgreensp/implementing-fractional-indexing).

[1]: https://github.com/fasiha/mudderjs

## Example

Expand All @@ -17,7 +19,6 @@ Usage is nearly identical to the original:
```python
from mudder import SymbolTable


hex_ = SymbolTable('0123456789abcdef')
hexstrings = hex_.mudder('ffff', 'fe0f', num_strings=3)
print(hexstrings)
Expand Down
Loading

0 comments on commit fa52300

Please sign in to comment.