Skip to content

Commit fbbcceb

Browse files
committed
Merge branch 'master' into copilot/fix-1
2 parents d8c1d9c + eb69bb8 commit fbbcceb

12 files changed

Lines changed: 691 additions & 80 deletions

File tree

.github/copilot-instructions.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copilot Instructions
2+
3+
This repository contains an interactive sorting utility that allows users to sort lines of text with various options similar to the Unix `sort` command.
4+
5+
## Project Overview
6+
7+
The `interactive-sort` tool provides:
8+
- Interactive line-by-line sorting as users type
9+
- Multiple sorting modes (alphabetical, numeric, human-readable numbers, month-based)
10+
- Various options like case-insensitive sorting, unique filtering, reverse sorting
11+
- Field separator support for structured data
12+
13+
## Development Guidelines
14+
15+
### Code Style
16+
- Follow PEP 8 Python style guidelines
17+
- Use ruff for code formatting with 120 character line length
18+
- Keep functions focused and well-documented
19+
- Use type hints where appropriate
20+
21+
### Testing
22+
- Use tox for testing across multiple Python versions (3.8+)
23+
- Write unit tests for new functionality
24+
- Ensure all tests pass before submitting changes
25+
- Test interactive functionality manually when possible
26+
27+
### Project Structure
28+
- Keep the project simple and focused
29+
- Main functionality should remain in a single module for simplicity
30+
- Package properly for pip installation
31+
- Use standard Python packaging tools (setuptools, pyproject.toml)
32+
33+
### CI/CD
34+
- All changes are tested via GitHub Actions
35+
- tox runs on every push to master branch
36+
- Code formatting is checked with ruff
37+
- Tests must pass for all supported Python versions
38+
39+
### Making Changes
40+
- Make minimal, focused changes
41+
- Preserve existing functionality unless specifically changing it
42+
- Update documentation if adding new features
43+
- Ensure backward compatibility for command-line interface
44+
45+
### Interactive Sorting Algorithm
46+
The core functionality uses:
47+
- `bisect.insort_left()` for efficient insertion into sorted lists
48+
- Custom comparison functions for different sorting modes
49+
- Real-time display updates after each input line
50+
51+
### Dependencies
52+
- Keep external dependencies minimal
53+
- Use only standard library when possible
54+
- Document any new dependencies clearly
55+
56+
## Supported Features
57+
- Case-insensitive sorting (`-f`, `--ignore-case`)
58+
- Ignore non-printing characters (`-i`, `--ignore-nonprinting`)
59+
- Month-based sorting (`-M`, `--month-sort`)
60+
- Human-readable numeric sorting (`-H`, `--human-numeric-sort`)
61+
- Standard numeric sorting (`-n`, `--numeric-sort`)
62+
- Reverse sorting (`-r`, `--reverse`)
63+
- Unique filtering (`-u`, `--unique`)
64+
- Field separator support (`-t`, `--field-separator`)
65+
66+
## Installation and Usage
67+
Users can install via pip and run as a command-line tool. See README.md for detailed installation and usage instructions.

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install tox tox-gh-actions
28+
29+
- name: Test with tox
30+
run: tox
31+
32+
lint-and-format:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v4
40+
with:
41+
python-version: "3.12"
42+
43+
- name: Install dependencies
44+
run: |
45+
python -m pip install --upgrade pip
46+
pip install tox
47+
48+
- name: Lint with ruff
49+
run: tox -e lint
50+
51+
- name: Check formatting with ruff
52+
run: tox -e format-check

.gitignore

Lines changed: 79 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,93 @@
1-
# Python
2-
__pycache__/
3-
*.py[cod]
41
*$py.class
2+
*$py.class
3+
*.cover
4+
*.egg
5+
*.egg-info/
6+
*.log
7+
*.manifest
8+
*.manifest
9+
*.mo
10+
*.pot
11+
*.py,cover
12+
*.py[cod]
13+
*.py[cod]
14+
*.sage.py
515
*.so
16+
*.so
17+
*.spec
18+
*.spec
19+
*.swo
20+
*.swp
21+
*~
22+
.DS_Store
623
.Python
24+
.cache
25+
.coverage
26+
.coverage.*
27+
.dmypy.json
28+
.eggs/
29+
.env
30+
.hypothesis/
31+
.hypothesis/
32+
.idea/
33+
.installed.cfg
34+
.ipynb_checkpoints
35+
.mypy_cache/
36+
.nox/
37+
.pdm.toml
38+
.pybuilder/
39+
.pyre/
40+
.pytest_cache/
41+
.pytest_cache/
42+
.pytype/
43+
.ropeproject
44+
.scrapy
45+
.spyderproject
46+
.spyproject
47+
.tox/
48+
.tox/
49+
.venv
50+
.vscode/
51+
.webassets-cache
52+
/site
53+
ENV/
54+
MANIFEST
55+
Thumbs.db
56+
__pycache__/
57+
__pycache__/
58+
__pypackages__/
759
build/
60+
celerybeat-schedule
61+
celerybeat.pid
62+
cover/
63+
coverage.xml
64+
cython_debug/
65+
db.sqlite3
66+
db.sqlite3-journal
867
develop-eggs/
968
dist/
69+
dmypy.json
70+
docs/_build/
1071
downloads/
1172
eggs/
12-
.eggs/
73+
env.bak/
74+
env/
75+
htmlcov/
76+
htmlcov/
77+
instance/
78+
ipython_config.py
1379
lib/
1480
lib64/
81+
local_settings.py
82+
nosetests.xml
1583
parts/
84+
pip-delete-this-directory.txt
85+
pip-log.txt
86+
profile_default/
1687
sdist/
88+
share/python-wheels/
89+
target/
1790
var/
18-
wheels/
19-
*.egg-info/
20-
.installed.cfg
21-
*.egg
22-
MANIFEST
23-
24-
# PyInstaller
25-
*.manifest
26-
*.spec
27-
28-
# Unit test / coverage reports
29-
htmlcov/
30-
.tox/
31-
.coverage
32-
.coverage.*
33-
.cache
34-
nosetests.xml
35-
coverage.xml
36-
*.cover
37-
.hypothesis/
38-
.pytest_cache/
39-
40-
# Environments
41-
.env
42-
.venv
43-
env/
44-
venv/
45-
ENV/
46-
env.bak/
4791
venv.bak/
48-
49-
# IDE
50-
.vscode/
51-
.idea/
52-
*.swp
53-
*.swo
54-
*~
55-
56-
# OS
57-
.DS_Store
58-
Thumbs.db
92+
venv/
93+
wheels/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 MightyHelper
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)