Skip to content

Commit

Permalink
Merge pull request #190 from SINTEF/cwa/fix-141-utilize-ignore
Browse files Browse the repository at this point in the history
Handle version specifiers.

Utilize the `packaging` package to parse the version specifier
set and generate "ignore" rules to utilize the existing logic for
handling "ignore" rules.

In this way, it's more of a "minimum implementation" and
should be easier and more straight forward. However, what may
really be happening, is simply just making the reading and
understanding of the "ignore" rules implementation the point at
which one may struggle to understand the implementation.
But again, since this logic already exists, this does not add
additional complexity.

In addition to parsing the dependency-specific version specifier
set as "ignore" rules, support for the 'python_version' marker is also
implemented, although be it in a limited capacity - mainly due to
not over-complicating the logic further.

Also, the utils.py file has been split up into it's separate parts and
moved into dedicated files under a new utils folder - effectively
changing the `ci-cd` package's Python API.

Finally, some formatting options have been added when printing
to the console. These options include colorization and general
formatting (bold, italic, etc.). Note, these are only displayed in any
given terminal if the terminal supports it.
These options have only been implemented for the update-deps
task, since this is the only one being touched properly by this PR.

Note, the Python API changes mentioned above has also resulted
in a change in the test files structure.
Because all utility functions previously found in
ci_cd.tasks.update_deps have been moved to the new
ci_cd.utils.versions module, some tests have also been moved,
accordingly.
  • Loading branch information
CasperWA authored Nov 10, 2023
2 parents 2cf64e4 + 6c71755 commit 67d5ac4
Show file tree
Hide file tree
Showing 21 changed files with 3,534 additions and 1,977 deletions.
5 changes: 5 additions & 0 deletions ci_cd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
"""CI/CD Tools. Tiny package to run invoke tasks as a standalone program."""
import logging

__version__ = "2.5.3"
__author__ = "Casper Welzel Andersen"
__author_email__ = "casper.w.andersen@sintef.no"


logging.getLogger("ci_cd").setLevel(logging.DEBUG)
4 changes: 4 additions & 0 deletions ci_cd/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ class InputError(ValueError, CICDException):

class InputParserError(InputError):
"""The input could not be parsed, it may be wrongly formatted."""


class UnableToResolve(CICDException):
"""Unable to resolve a task or sub-task."""
4 changes: 2 additions & 2 deletions ci_cd/tasks/api_reference_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from invoke import Context, Result


LOGGER = logging.getLogger(__file__)
LOGGER.setLevel(logging.DEBUG)
# Get logger
LOGGER = logging.getLogger(__name__)


@task(
Expand Down
4 changes: 2 additions & 2 deletions ci_cd/tasks/setver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

from ci_cd.utils import Emoji, SemanticVersion, update_file

LOGGER = logging.getLogger(__file__)
LOGGER.setLevel(logging.DEBUG)
# Get logger
LOGGER = logging.getLogger(__name__)


@task(
Expand Down
Loading

0 comments on commit 67d5ac4

Please sign in to comment.