From bbe8c86a9ea561dd6799b21417538d3da46dff82 Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 13:55:22 -0500 Subject: [PATCH 01/16] chore: update project configuration to meet modern standards --- .flake8 | 9 --- .pre-commit-config.yaml | 48 ++++++------ pyproject.toml | 157 ++++++++++++++++++++++++++++------------ setup.cfg | 48 ------------ setup.py | 10 --- 5 files changed, 136 insertions(+), 136 deletions(-) delete mode 100644 .flake8 delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 65055a8..0000000 --- a/.flake8 +++ /dev/null @@ -1,9 +0,0 @@ -[flake8] -max-complexity = 10 -max-line-length = 127 - -select = C,E,F,W,B,B9 -per-file-ignores = - __init__.py:F401 - test*.py:E501,B950,W503 -show-source = true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2eacacc..9701279 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,33 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - - repo: https://github.com/PyCQA/autoflake - rev: 'v1.7.8' - hooks: - - id: autoflake - args: - - "--in-place" - - - repo: https://github.com/PyCQA/isort - rev: '5.11.5' - hooks: - - id: isort - - - repo: https://github.com/psf/black - rev: '22.12.0' - hooks: - - id: black - - - repo: https://github.com/PyCQA/flake8 - rev: '5.0.4' - hooks: - - id: flake8 - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 'v4.5.0' + rev: 'v4.6.0' hooks: - id: trailing-whitespace - id: end-of-file-fixer - - id: check-yaml - id: check-ast - id: check-toml + - id: check-yaml + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.2 + hooks: + # run the linter + - id: ruff + # run the formatter + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index 61244c4..8b17910 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,58 +1,129 @@ [build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" +requires = ['setuptools>=64', 'wheel'] +build-backend = 'setuptools.build_meta' -[tool.autoflake] -check = true -expand-star-imports = true -remove-all-unused-imports = true +[project] +name = 'aoc' +dynamic = ['version'] +description = 'Advent of Code programming puzzles by Rudy Puig.' +license = { file = 'LICENSE.txt' } +readme = 'README.md' +authors = [{ name = 'Rodolfo Puig', email = 'rodolfo@puig.io' }] +requires-python = '~= 3.10' +dependencies = [] -[tool.isort] -profile = "black" -line_length = 120 -lines_between_types = 1 -lines_after_imports = 2 -combine_as_imports = true -force_single_line = true -known_first_party = ["aoc", "tests"] -single_line_exclusions = ["typing"] +[project.optional-dependencies] +dev = [ + 'ruff ~= 0.4.7', + 'mypy ~= 1.10.0', +] +test = [ + 'pytest >= 6.0, != 8.1.*', + 'pytest-checkdocs >= 2.4', + 'pytest-cov', + 'pytest-mypy', + 'pytest-ruff', + 'docutils', +] + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +version = {attr = 'aoc.__version__'} + +[tool.setuptools.packages.find] +where = ['src'] +exclude = ['docs', 'tests'] +namespaces = false + +[tool.mypy] +check_untyped_defs = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_untyped_defs = true +no_implicit_optional = true +warn_unused_ignores = true -[tool.black] +[tool.ruff] line-length = 120 -target-version = ["py310"] -include = "\\.pyi?$" -exclude = ''' -/( - \.eggs - | \.git - | \.hg - | \.mypy_cache - | \.pytest_cache - | \.tox - | \.venv - | __pycache__ - | _build - | build - | dist -)/ -''' +indent-width = 4 +target-version = 'py310' + +[tool.ruff.lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +ignore = [] +select = [ + 'B904', + 'E4', + 'E7', + 'E9', + 'F', + 'PT009', + 'TRY201', + 'RUF200', +] +extend-select = ['I'] +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ['ALL'] +unfixable = [] +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = '^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$' + +[tool.ruff.lint.isort] +case-sensitive = false +combine-as-imports = false +force-sort-within-sections = false +# force-single-line = true +known-first-party = ['aoc'] +known-third-party = [] +lines-after-imports = 2 +lines-between-types = 1 +# order-by-type = false +no-lines-before = ['future', 'standard-library'] +single-line-exclusions = ['typing'] +section-order = [ + 'future', + 'standard-library', + 'third-party', + 'first-party', + 'local-folder', +] + +[tool.ruff.format] +# Like Black, use double quotes for strings. +quote-style = 'double' +# Like Black, indent with spaces, rather than tabs. +indent-style = 'space' +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false +# Like Black, automatically detect the appropriate line ending. +line-ending = 'auto' +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +docstring-code-format = false +# Set the line length limit used when formatting code snippets in +# docstrings. +docstring-code-line-length = 'dynamic' [tool.pytest.ini_options] -minversion = "6.0" -addopts = ["--strict-config", "--strict-markers", "-rpfE", "-q"] -testpaths = ["tests"] +minversion = '6.0' +addopts = ['--strict-config', '--strict-markers', '-rpfE', '-q'] +testpaths = ['tests'] xfail_strict = true [tool.coverage.run] branch = true parallel = true -plugins = ["covdefaults"] -source = ["aoc", "tests"] +plugins = ['covdefaults'] +source = ['aoc', 'tests'] [tool.coverage.paths] build = [ - "src", - "*/site-packages", + 'src', + '*/site-packages', '*\site-packages', ] @@ -63,13 +134,9 @@ show_missing = true skip_covered = true skip_empty = true omit = [ - "tests/*", + 'tests/*', ] exclude_lines = [] [tool.coverage.html] show_contexts = true - -[tool.pyright] -include = ["src"] -ignore = ["setup.py", "tests/*"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6222201..0000000 --- a/setup.cfg +++ /dev/null @@ -1,48 +0,0 @@ -[metadata] -name = aoc -version = 1.0.0 -author = Rodolfo Puig -author_email = rodolfo@puig.io -description = Advent of Code is an Advent calendar of small programming puzzles. -long_description = file: README.md -long_description_content_type = text/markdown -license = MIT -license_files = LICENSE.txt -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Developers - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Utilities - -[options] -packages = find_namespace: -python_requires = >=3.7, <4 -package_dir = - =src -include_package_data = True -zip_safe = False - -[options.packages.find] -where = src - -[options.extras_require] -dev = - autoflake>=1.7.0,<2.0.0 - black>=22.1.0,<23.0.0 - flake8>=5.0.0,<6.0.0 - flake8-black>=0.3.0,<1.0.0 - flake8-isort>=5.0.0,<6.0.0 - isort>=5.10.1,<6.0.0 - pep8-naming>=0.13.2,<1.0.0 - pre-commit -test = - covdefaults - coverage[toml]>=5.1,<7.0.0 - pytest>=6.2.0,<7.0.0 - pytest-cov>=2.10.0,<3.0.0 - pytest-mock>=3.6.0,<4.0.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index 0bfa545..0000000 --- a/setup.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python -import os - -from setuptools import setup - - -if __name__ == "__main__": - BASEDIR = os.path.dirname(__file__) - BASEDIR and os.chdir(BASEDIR) - setup() From 315f75262027155780d1da986ed7c73d01881191 Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 13:57:24 -0500 Subject: [PATCH 02/16] docs: relocate notes and update README --- README.md | 9 ++------- {notes => docs}/2022/day-01.md | 0 {notes => docs}/2022/day-02.md | 0 {notes => docs}/2022/day-03.md | 0 {notes => docs}/2022/day-04.md | 0 {notes => docs}/2023/day-01.md | 0 {notes => docs}/2024/day-01.md | 0 7 files changed, 2 insertions(+), 7 deletions(-) rename {notes => docs}/2022/day-01.md (100%) rename {notes => docs}/2022/day-02.md (100%) rename {notes => docs}/2022/day-03.md (100%) rename {notes => docs}/2022/day-04.md (100%) rename {notes => docs}/2023/day-01.md (100%) rename {notes => docs}/2024/day-01.md (100%) diff --git a/README.md b/README.md index 93e6dc2..9d2a905 100644 --- a/README.md +++ b/README.md @@ -13,19 +13,14 @@ Create a virtual environment: ```bash python3 -m venv .venv source .venv/bin/activate -``` - -Install dependencies: - -```bash python3 -m pip install -U pip setuptools python3 -m pip install -e '.[test]' ``` -Check all answers for 2022: +Check all answers for 2024: ```bash -pytest --cov=. -k 2022 +python3 -m pytest --cov=. -k 2024 ``` ## License diff --git a/notes/2022/day-01.md b/docs/2022/day-01.md similarity index 100% rename from notes/2022/day-01.md rename to docs/2022/day-01.md diff --git a/notes/2022/day-02.md b/docs/2022/day-02.md similarity index 100% rename from notes/2022/day-02.md rename to docs/2022/day-02.md diff --git a/notes/2022/day-03.md b/docs/2022/day-03.md similarity index 100% rename from notes/2022/day-03.md rename to docs/2022/day-03.md diff --git a/notes/2022/day-04.md b/docs/2022/day-04.md similarity index 100% rename from notes/2022/day-04.md rename to docs/2022/day-04.md diff --git a/notes/2023/day-01.md b/docs/2023/day-01.md similarity index 100% rename from notes/2023/day-01.md rename to docs/2023/day-01.md diff --git a/notes/2024/day-01.md b/docs/2024/day-01.md similarity index 100% rename from notes/2024/day-01.md rename to docs/2024/day-01.md From 068bf7af78b32332b3591b759ff0d9e5b3f67f2a Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 13:58:19 -0500 Subject: [PATCH 03/16] chore: apply formatting rules to entire project --- src/aoc/2022/day_03.py | 3 +-- src/aoc/2023/day_01.py | 1 - src/aoc/2024/day_01.py | 5 +---- tests/conftest.py | 2 +- tests/unit/test_solutions_2022.py | 2 +- tests/unit/test_solutions_2023.py | 2 +- tests/unit/test_solutions_2024.py | 2 +- 7 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/aoc/2022/day_03.py b/src/aoc/2022/day_03.py index c240598..b969d7f 100644 --- a/src/aoc/2022/day_03.py +++ b/src/aoc/2022/day_03.py @@ -1,10 +1,9 @@ from __future__ import annotations - from string import ascii_letters from typing import List, Set, Tuple -PRIORITY_TABLE = {l: p for p, l in enumerate(ascii_letters, 1)} +PRIORITY_TABLE = {c: i for i, c in enumerate(ascii_letters, 1)} class RuckSack: diff --git a/src/aoc/2023/day_01.py b/src/aoc/2023/day_01.py index 061c5e3..1691869 100644 --- a/src/aoc/2023/day_01.py +++ b/src/aoc/2023/day_01.py @@ -1,5 +1,4 @@ from __future__ import annotations - from string import digits from typing import List diff --git a/src/aoc/2024/day_01.py b/src/aoc/2024/day_01.py index 20b170a..62581c4 100644 --- a/src/aoc/2024/day_01.py +++ b/src/aoc/2024/day_01.py @@ -1,9 +1,6 @@ from __future__ import annotations - from functools import reduce -from operator import countOf -from operator import mul -from operator import sub +from operator import countOf, mul, sub from typing import Iterable, Iterator, List diff --git a/tests/conftest.py b/tests/conftest.py index 70e1190..82d874e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -54,7 +54,7 @@ def wrapper(year: Union[str, int], day: Union[str, int], part: Union[str, int], with open(fixture) as fp: samples = fp.read().split("--EXPECT--\n") yield (samples[0].splitlines(), samples[part].strip()) - except (IndexError): + except IndexError: yield ([], None) if not fixture_files: pytest.skip(f"fixture not found: {fixture_glob}") diff --git a/tests/unit/test_solutions_2022.py b/tests/unit/test_solutions_2022.py index e12d450..cb22275 100644 --- a/tests/unit/test_solutions_2022.py +++ b/tests/unit/test_solutions_2022.py @@ -18,6 +18,6 @@ def parametrize_fixtures(year, dates, fixtures) -> Iterator[ParameterSet]: @pytest.mark.year(FIXTURE_YEAR) @pytest.mark.parametrize("year,day,part,fixtures", parametrize_fixtures(FIXTURE_YEAR, FIXTURE_DATES, FIXTURE_NAMES)) def test_solve_puzzle_answers(year: str, day: int, part: int, fixtures: List[str], load_fixtures, solve_puzzle) -> None: - for (fixture_data, expected_output) in load_fixtures(year, day, part, fixtures): + for fixture_data, expected_output in load_fixtures(year, day, part, fixtures): output = solve_puzzle(year, day, part, fixture_data) assert output == expected_output diff --git a/tests/unit/test_solutions_2023.py b/tests/unit/test_solutions_2023.py index 84c1fb6..5746090 100644 --- a/tests/unit/test_solutions_2023.py +++ b/tests/unit/test_solutions_2023.py @@ -22,6 +22,6 @@ def parametrize_fixtures(year, components) -> Iterator[ParameterSet]: def test_solve_puzzle_answers( year: str, day: int, part: int, solver: int, fixture: str, load_fixtures, solve_puzzle ) -> None: - for (fixture_data, expected_output) in load_fixtures(year, day, part, [fixture]): + for fixture_data, expected_output in load_fixtures(year, day, part, [fixture]): output = solve_puzzle(year, day, solver, fixture_data) assert output == expected_output diff --git a/tests/unit/test_solutions_2024.py b/tests/unit/test_solutions_2024.py index c2c9a40..a35c4a3 100644 --- a/tests/unit/test_solutions_2024.py +++ b/tests/unit/test_solutions_2024.py @@ -18,6 +18,6 @@ def parametrize_fixtures(year, dates, fixtures) -> Iterator[ParameterSet]: @pytest.mark.year(FIXTURE_YEAR) @pytest.mark.parametrize("year,day,part,fixtures", parametrize_fixtures(FIXTURE_YEAR, FIXTURE_DATES, FIXTURE_NAMES)) def test_solve_puzzle_answers(year: str, day: int, part: int, fixtures: List[str], load_fixtures, solve_puzzle) -> None: - for (fixture_data, expected_output) in load_fixtures(year, day, part, fixtures): + for fixture_data, expected_output in load_fixtures(year, day, part, fixtures): output = solve_puzzle(year, day, part, fixture_data) assert output == expected_output From 24ef357da536b2b0bb32fc219cc92dca968fd047 Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:04:28 -0500 Subject: [PATCH 04/16] chore: update github workflow to use ruff --- .github/workflows/build.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6064c9b..d8631fc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,9 +4,6 @@ on: pull_request: branches: - 'main' - push: - branches: - - main jobs: build: @@ -28,7 +25,8 @@ jobs: pip install .[dev,test] - name: Run linting run: | - python -m flake8 -v --config .flake8 --black-config pyproject.toml --show-source + python -m ruff check -q --diff --output-format=full . + python -m ruff format -q --diff --check . continue-on-error: true - name: Run unit tests run: | From 90ff7e5260c40a1733958bd2e9155a0a6a8263cb Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:06:57 -0500 Subject: [PATCH 05/16] chore: fix workflow installation --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d8631fc..fd38bfd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,7 +22,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[dev,test] + python -m pip install '.[dev,test]' - name: Run linting run: | python -m ruff check -q --diff --output-format=full . From 5026b364ebf8feaca2d8157cfe4d035b4e3c10dd Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:08:31 -0500 Subject: [PATCH 06/16] chore: fix workflow installation (2) --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fd38bfd..b891450 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,6 +11,7 @@ jobs: strategy: matrix: python-version: + - "3.9" - "3.10" - "3.11" steps: @@ -21,7 +22,6 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip python -m pip install '.[dev,test]' - name: Run linting run: | From 5c651999c76876c57492cd5f921429f47f3f83d4 Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:11:03 -0500 Subject: [PATCH 07/16] chore: fix workflow installation (doh) --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b891450..e8132a4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,7 +22,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install '.[dev,test]' + python -m pip install -e '.[dev,test]' - name: Run linting run: | python -m ruff check -q --diff --output-format=full . From b5d3c1c875475516640668517556ab695957a79d Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:13:55 -0500 Subject: [PATCH 08/16] chore: fix workflow installation (hmm) --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e8132a4..209054a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,7 +11,6 @@ jobs: strategy: matrix: python-version: - - "3.9" - "3.10" - "3.11" steps: @@ -22,7 +21,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install -e '.[dev,test]' + python -m pip install --quiet --upgrade pip setuptools + python -m pip install --editable '.[dev,test]' - name: Run linting run: | python -m ruff check -q --diff --output-format=full . From 5735b7cd13218b55b7a2359f1b75062622b5b937 Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:18:27 -0500 Subject: [PATCH 09/16] chore: fix workflow installation (ouch) --- .github/workflows/build.yaml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 209054a..8172c6b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,15 +19,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --quiet --upgrade pip setuptools - python -m pip install --editable '.[dev,test]' - - name: Run linting - run: | - python -m ruff check -q --diff --output-format=full . - python -m ruff format -q --diff --check . + cache: 'pip' + - run: python -m pip install --quiet --upgrade pip setuptools + - run: python -m pip install --editable '.[dev,test]' + - run: python -m ruff check -q --diff --output-format=full . + - run: python -m ruff format -q --diff --check . continue-on-error: true - - name: Run unit tests - run: | - python -m pytest -vvv --cov --cov-context=test --cov-report=xml + - run: python -m pytest -vvv --cov --cov-context=test --cov-report=xml From cfa497a94dd3914a847c7dcd979f38dba7cd2b6c Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:19:20 -0500 Subject: [PATCH 10/16] chore: fix workflow installation (wat) --- .github/workflows/build.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8172c6b..e181c22 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,9 +20,9 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pip' - - run: python -m pip install --quiet --upgrade pip setuptools - - run: python -m pip install --editable '.[dev,test]' - - run: python -m ruff check -q --diff --output-format=full . - - run: python -m ruff format -q --diff --check . + - run: python3 -m pip install --quiet --upgrade pip setuptools + - run: python3 -m pip install --editable '.[dev,test]' + - run: python3 -m ruff check -q --diff --output-format=full . + - run: python3 -m ruff format -q --diff --check . continue-on-error: true - - run: python -m pytest -vvv --cov --cov-context=test --cov-report=xml + - run: python3 -m pytest -vvv --cov --cov-context=test --cov-report=xml From f786cfbc3cb48880961f95a23fd37127d6a0d401 Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:26:57 -0500 Subject: [PATCH 11/16] chore: fix workflow installation (come on) --- pyproject.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8b17910..ccbbdaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,16 +27,18 @@ test = [ ] [tool.setuptools] +package-dir = {'' = 'src'} include-package-data = true -[tool.setuptools.dynamic] -version = {attr = 'aoc.__version__'} - [tool.setuptools.packages.find] where = ['src'] +include = ['aoc*'] exclude = ['docs', 'tests'] namespaces = false +[tool.setuptools.dynamic] +version = {attr = 'aoc.__version__'} + [tool.mypy] check_untyped_defs = true disallow_any_generics = true From b2f1e7cb843f790cc3badd0340d6d1b5e90503d6 Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:30:29 -0500 Subject: [PATCH 12/16] chore: fix workflow installation (dood) --- .github/workflows/build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e181c22..d71748f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: 'pip' + architecture: x64 + cache: pip + - run: python3 --version - run: python3 -m pip install --quiet --upgrade pip setuptools - run: python3 -m pip install --editable '.[dev,test]' - run: python3 -m ruff check -q --diff --output-format=full . From 6251e5e6f706eeb10b5e317df89c633058223c93 Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:34:20 -0500 Subject: [PATCH 13/16] chore: fix workflow installation (sigh) --- .github/workflows/build.yaml | 10 +++++----- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d71748f..030d160 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,9 +22,9 @@ jobs: architecture: x64 cache: pip - run: python3 --version - - run: python3 -m pip install --quiet --upgrade pip setuptools - - run: python3 -m pip install --editable '.[dev,test]' - - run: python3 -m ruff check -q --diff --output-format=full . - - run: python3 -m ruff format -q --diff --check . + - run: pip install --quiet --upgrade pip setuptools + - run: pip install --editable '.[dev,test]' + - run: ruff check -q --diff --output-format=full . + - run: ruff format -q --diff --check . continue-on-error: true - - run: python3 -m pytest -vvv --cov --cov-context=test --cov-report=xml + - run: pytest -vvv --cov --cov-context=test --cov-report=xml diff --git a/pyproject.toml b/pyproject.toml index ccbbdaa..296f8b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,6 @@ license = { file = 'LICENSE.txt' } readme = 'README.md' authors = [{ name = 'Rodolfo Puig', email = 'rodolfo@puig.io' }] requires-python = '~= 3.10' -dependencies = [] [project.optional-dependencies] dev = [ From 500befb25aa669db004c955444d69475b42fc9bd Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:38:00 -0500 Subject: [PATCH 14/16] chore: fix workflow installation (hngggg) --- pyproject.toml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 296f8b6..9123770 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'aoc' -dynamic = ['version'] +version = '2.0.0' description = 'Advent of Code programming puzzles by Rudy Puig.' license = { file = 'LICENSE.txt' } readme = 'README.md' @@ -27,17 +27,13 @@ test = [ [tool.setuptools] package-dir = {'' = 'src'} -include-package-data = true [tool.setuptools.packages.find] where = ['src'] -include = ['aoc*'] +include = ['aoc'] exclude = ['docs', 'tests'] namespaces = false -[tool.setuptools.dynamic] -version = {attr = 'aoc.__version__'} - [tool.mypy] check_untyped_defs = true disallow_any_generics = true From 2037c6a4acf9c4cf768aafaef7f94c1d6dfd53ff Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:39:55 -0500 Subject: [PATCH 15/16] chore: fix workflow installation (ok) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 9123770..f5906ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ test = [ 'pytest-cov', 'pytest-mypy', 'pytest-ruff', + 'covdefaults', 'docutils', ] From 65d6ef5eff8c5db770c217fa780e8cdf2155273e Mon Sep 17 00:00:00 2001 From: Rudy Puig Date: Thu, 5 Dec 2024 14:44:07 -0500 Subject: [PATCH 16/16] chore: fix workflow installation (yesss) --- .github/workflows/build.yaml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 030d160..7c94b5f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,12 +19,17 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - architecture: x64 cache: pip - - run: python3 --version - - run: pip install --quiet --upgrade pip setuptools - - run: pip install --editable '.[dev,test]' - - run: ruff check -q --diff --output-format=full . - - run: ruff format -q --diff --check . + - name: Install dependencies + run: | + python -m pip install --quiet --upgrade pip setuptools + python -m pip install --editable '.[dev,test]' + + - name: Run linting continue-on-error: true - - run: pytest -vvv --cov --cov-context=test --cov-report=xml + run: | + python -m ruff check -q --diff --output-format=full . + python -m ruff format -q --diff --check . + - name: Run unit tests + run: | + python -m pytest -vvv --cov --cov-context=test --cov-report=xml