diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0f58873 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: main + +on: + push: + branches: + - main + pull_request: {} + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: extractions/setup-just@v2 + - uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + cache-dependency-glob: "**/pyproject.toml" + - run: uv python install 3.10 + - run: just install lint-ci + + pytest: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + steps: + - uses: actions/checkout@v4 + - uses: extractions/setup-just@v2 + - uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + cache-dependency-glob: "**/pyproject.toml" + - run: uv python install ${{ matrix.python-version }} + - run: just install + - run: just test . --cov=. --cov-report xml + - uses: codecov/codecov-action@v4.0.1 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: ./coverage.xml + flags: unittests + name: codecov-${{ matrix.python-version }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b637272 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,17 @@ +name: Publish Package + +on: + release: + types: + - published + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: extractions/setup-just@v2 + - uses: astral-sh/setup-uv@v3 + - run: just publish + env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml deleted file mode 100644 index 42df28d..0000000 --- a/.github/workflows/workflow.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: CI Pipeline - -on: - push: - branches: - - main - pull_request: - branches: - - main - release: - types: - - published - -jobs: - ci: - uses: community-of-python/community-workflow/.github/workflows/preset.yml@main - with: - python-version: '["3.10","3.11","3.12","3.13","3.14"]' - os: '["ubuntu-latest"]' - secrets: inherit diff --git a/AGENTS.md b/AGENTS.md index ee788e0..cc935cc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,19 +49,19 @@ just lint # Includes auto-formatting ### Using the Tool ```bash # Fix files in a directory (modifies files) -python -m end_of_file_fixer.main /path/to/directory +python -m eof_fixer.main /path/to/directory # Check files in a directory (dry run) -python -m end_of_file_fixer.main /path/to/directory --check +python -m eof_fixer.main /path/to/directory --check ``` Or using the installed script: ```bash # Fix files -end-of-file-fixer /path/to/directory +eof-fixer /path/to/directory # Check files -end-of-file-fixer /path/to/directory --check +eof-fixer /path/to/directory --check ``` ## Development Conventions @@ -79,7 +79,7 @@ end-of-file-fixer /path/to/directory --check ### Project Structure ``` -end-of-file-fixer/ +eof-fixer/ ├── end_of_file_fixer/ # Main package │ ├── __init__.py # Package initializer │ └── main.py # Main CLI implementation diff --git a/README.md b/README.md index 97c0fe4..e76f37a 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,13 @@ Many POSIX systems expect text files to end with a newline character. Having con ### Using uv ```bash -uv add end-of-file-fixer +uv add eof-fixer ``` ### Using pip ```bash -pip install end-of-file-fixer +pip install eof-fixer ``` ## Usage @@ -41,18 +41,18 @@ pip install end-of-file-fixer To fix all files in the current directory and subdirectories: ```bash -end-of-file-fixer . +eof-fixer . ``` To check which files would be modified without making changes: ```bash -end-of-file-fixer . --check +eof-fixer . --check ``` ## How It Works -The end-of-file-fixer processes files in the following way: +The eof-fixer processes files in the following way: 1. **Files with no trailing newline**: Adds exactly one newline at the end 2. **Files with exactly one trailing newline**: Leaves unchanged @@ -89,8 +89,8 @@ The tool automatically respects patterns in your `.gitignore` file, so it won't ```bash # Clone the repository -git clone https://github.com/community-of-python/end-of-file-fixer.git -cd end-of-file-fixer +git clone https://github.com/modern-python/eof-fixer.git +cd eof-fixer # Install dependencies just install diff --git a/end_of_file_fixer/__init__.py b/eof_fixer/__init__.py similarity index 100% rename from end_of_file_fixer/__init__.py rename to eof_fixer/__init__.py diff --git a/end_of_file_fixer/main.py b/eof_fixer/main.py similarity index 100% rename from end_of_file_fixer/main.py rename to eof_fixer/main.py diff --git a/end_of_file_fixer/py.typed b/eof_fixer/py.typed similarity index 100% rename from end_of_file_fixer/py.typed rename to eof_fixer/py.typed diff --git a/pyproject.toml b/pyproject.toml index a4dfd64..e3cd485 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "end-of-file-fixer" +name = "eof-fixer" description = "A command-line tool that ensures all your text files end with exactly one newline character" readme = "README.md" requires-python = ">=3.10,<4" @@ -7,7 +7,7 @@ dependencies = [ "pathspec", ] version = "0" -authors = [{ name = "community-of-python" }] +authors = [{ name = "modern-python" }] keywords = [ "python", ] @@ -21,12 +21,12 @@ classifiers = [ ] [project.urls] -Repository = "https://github.com/community-of-python/end-of-file-fixer" -Issues = "https://github.com/community-of-python/end-of-file-fixer/issues" -Changelogs = "https://github.com/community-of-python/end-of-file-fixer/releases" +Repository = "https://github.com/modern-python/eof-fixer" +Issues = "https://github.com/modern-python/eof-fixer/issues" +Changelogs = "https://github.com/modern-python/eof-fixer/releases" [project.scripts] -end-of-file-fixer = "end_of_file_fixer.main:main" +eof-fixer = "eof_fixer.main:main" [dependency-groups] dev = [ @@ -41,7 +41,7 @@ requires = ["uv_build"] build-backend = "uv_build" [tool.uv.build-backend] -module-name = "end_of_file_fixer" +module-name = "eof_fixer" module-root = "" [tool.mypy] diff --git a/tests/test_end_of_file_fixer.py b/tests/test_end_of_file_fixer.py index 3115492..7b01dd4 100644 --- a/tests/test_end_of_file_fixer.py +++ b/tests/test_end_of_file_fixer.py @@ -5,7 +5,7 @@ from io import StringIO from pathlib import Path -from end_of_file_fixer.main import main +from eof_fixer.main import main def test_end_of_file_fixer_command_with_check_false() -> None: @@ -26,10 +26,10 @@ def test_end_of_file_fixer_command_with_check_false() -> None: try: os.chdir(temp_dir) - sys.argv = ["end-of-file-fixer", "."] + sys.argv = ["eof-fixer", "."] sys.stdout = captured_output - # Run end-of-file-fixer . command + # Run eof-fixer . command result = main() # Should exit with code 1 (since some files needed fixing) @@ -90,10 +90,10 @@ def test_end_of_file_fixer_command_with_check_true() -> None: try: os.chdir(temp_dir) - sys.argv = ["end-of-file-fixer", ".", "--check"] + sys.argv = ["eof-fixer", ".", "--check"] sys.stdout = captured_output - # Run end-of-file-fixer . --check command + # Run eof-fixer . --check command result = main() # Should exit with code 1 (since some files need fixing) @@ -150,10 +150,10 @@ def test_end_of_file_fixer_with_gitignore() -> None: try: os.chdir(temp_dir) - sys.argv = ["end-of-file-fixer", "."] + sys.argv = ["eof-fixer", "."] sys.stdout = captured_output - # Run end-of-file-fixer . command + # Run eof-fixer . command result = main() # Should exit with code 1 (since some files needed fixing) @@ -216,10 +216,10 @@ def test_end_of_file_fixer_skips_binary_files() -> None: try: os.chdir(temp_dir) - sys.argv = ["end-of-file-fixer", "."] + sys.argv = ["eof-fixer", "."] sys.stdout = captured_output - # Run end-of-file-fixer . command + # Run eof-fixer . command result = main() # Should exit with code 1 (since the text file needed fixing)