Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Repo updates #2

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ repos:
- id: mixed-line-ending
args: ["--fix=lf"]
- id: name-tests-test
args: ["--pytest-test-first"]
# Do not allow direct push to main/master branches
- id: no-commit-to-branch
# - id: pretty-format-json
Expand All @@ -63,7 +64,7 @@ repos:
hooks:
- id: prettier
args:
['--ignore-unknown', '--no-error-on-unmatched-pattern', '!chart/**']
['--ignore-unknown']

# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
Expand Down Expand Up @@ -97,7 +98,7 @@ repos:
rev: 2.1.1
hooks:
- id: bashate
args: ["--ignore=E006"]
args: ["--ignore=E006,E011"]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
Expand All @@ -121,6 +122,7 @@ repos:
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
Expand Down Expand Up @@ -159,4 +161,4 @@ repos:
- id: mypy
verbose: true
args: [--show-error-codes]
additional_dependencies: ["types-requests"]
additional_dependencies: ["pytest", "types-requests"]
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from sphinx import apidoc

output_dir = os.path.join(__location__, "api")
module_dir = os.path.join(__location__, "../src/osc_data_extractor")
module_dir = os.path.join(__location__, "../src/osc-rule-based-extractor")
try:
shutil.rmtree(output_dir)
except FileNotFoundError:
Expand Down Expand Up @@ -99,7 +99,7 @@
# If you don’t need the separation provided between version and release,
# just set them both to the same value.
try:
from osc_data_extractor import __version__ as version
from osc-rule-based-extractor import __version__ as version
except ImportError:
version = ""

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ build-backend = "pdm.backend"
license-files = ["LICENSES.txt"]

[project.scripts]
osc-data-extractor = "osc_data_extractor.skeleton:run"
osc-data-extractor = "osc-rule-based-extractor.skeleton:run"

[project.optional-dependencies]
dev = [
Expand Down
16 changes: 11 additions & 5 deletions scripts/template-to-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,35 @@ file_content_substitution() {
else
FILENAME="$1"
fi
COUNT=0
if (grep "$TEMPLATE_NAME" "$FILENAME" > /dev/null 2>&1); then
MATCHES=$(grep -c "$TEMPLATE_NAME" "$FILENAME")
if [ "$MATCHES" -eq 1 ]; then
echo "1 content substitution required: $FILENAME"
echo "1 content substitution required: $FILENAME (dashes)"
COUNT=$((COUNT++))
else
echo "$MATCHES content substitutions required: $FILENAME"
echo "$MATCHES content substitutions required: $FILENAME (dashes)"
COUNT=$((COUNT+MATCHES))
fi
sed -i "s/$TEMPLATE_NAME/$REPO_NAME/g" "$FILENAME"
fi
if (grep "$ALT_TEMPLATE_NAME" "$FILENAME" > /dev/null 2>&1); then
MATCHES=$(grep -c "$ALT_TEMPLATE_NAME" "$FILENAME")
if [ "$MATCHES" -eq 1 ]; then
echo "1 content substitution required: $FILENAME"
echo "1 content substitution required: $FILENAME (underscores)"
COUNT=$((COUNT++))
else
echo "$MATCHES content substitutions required: $FILENAME"
echo "$MATCHES content substitutions required: $FILENAME (underscores)"
COUNT=$((COUNT+MATCHES))
fi
sed -i "s/$ALT_TEMPLATE_NAME/$ALT_REPO_NAME/g" "$FILENAME"
fi
echo "$COUNT total substitution(s) made in file: $FILENAME"
}

### Main script entry point

TEMPLATE_NAME=osc-python-template
TEMPLATE_NAME=osc-rule-based-extractor
ALT_TEMPLATE_NAME="${TEMPLATE_NAME//-/_}"

if ! (git rev-parse --show-toplevel > /dev/null); then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
``[options.entry_points]`` section in ``setup.cfg``::

console_scripts =
fibonacci = osc_data_extractor.skeleton:run
fibonacci = osc_rule_based_extractor.skeleton:run

Then run ``pip install .`` (or ``pip install -e .`` for editable mode)
which will install the command ``fibonacci`` inside your current environment.
Expand All @@ -24,7 +24,7 @@
import logging
import sys

from osc_data_extractor import __version__
from osc_rule_based_extractor import __version__

__author__ = "Matthew Watkins"
__copyright__ = "Matthew Watkins"
Expand All @@ -36,7 +36,7 @@
# ---- Python API ----
# The functions defined in this section can be imported by users in their
# Python scripts/interactive interpreter, e.g. via
# `from osc_data_extractor.skeleton import fib`,
# `from osc_rule_based_extractor.skeleton import fib`,
# when using this Python module as a library.


Expand Down Expand Up @@ -142,6 +142,6 @@ def run():
# After installing your project with pip, users can also run your Python
# modules as scripts via the ``-m`` flag, as defined in PEP 338::
#
# python -m osc_data_extractor.skeleton 42
# python -m osc_rule_based_extractor.skeleton 42
#
run()
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Dummy conftest.py for osc_data_extractor.
Dummy conftest.py for osc-rule-based-extractor.

If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest

from osc_data_extractor.skeleton import fib, main

__author__ = "Matthew Watkins"
Expand Down
Loading