Skip to content

Commit

Permalink
Merge 4580951 into 352a4ef
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilo59 committed Jan 6, 2019
2 parents 352a4ef + 4580951 commit e629dd9
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 172 deletions.
2 changes: 1 addition & 1 deletion .prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mccabe:
max-complexity: 20

pyroma:
run: true
run: false

pep257:
run: false
6 changes: 4 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pytest-cov = "*"
coveralls = "*"
prospector = {extras = ["with_pyroma"],version = "*"}
# wily = {version = "*",markers = "python_version >= '3.7'"}
twine = "*"
readme-renderer = {extras = ["md"],version = "*"}
twine = ">=1.11.0"
wheel= ">=0.31.0"

[requires]
python_version = "3.7"
Expand All @@ -26,3 +26,5 @@ reqs = "sh scripts/update_reqs.sh"
pre = "pre-commit run --all-files"
lint = "prospector --output-format grouped"
test = "pytest -rpsf --cov-report term-missing --cov=mass_replace tests/"
build = "python setup.py sdist bdist_wheel"
publish = "python setup.py upload"
188 changes: 50 additions & 138 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ EVERY FILE OF THE SPECIFIED TYPE NESTED UNDERNEATH THE `root_folder` WILL BE SUB

## Installation and usage

### Install with pip

```
pip install mass-replace
```

### To run as a standalone `.exe`

1. Download `mass_replace_windows_executable.zip`
Expand Down
12 changes: 12 additions & 0 deletions mass_replace/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# -*- coding: utf-8 -*-
"""
mass_replace
~~~~~~~~~~~~
"Walkthrough" through a specified `root_folder` and perform find and replace
operations on every file of the specified type.
"""

from .mass_replace import *

VERSION = (0, 0, 3)

__version__ = ".".join(map(str, VERSION))
11 changes: 8 additions & 3 deletions mass_replace/mass_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"""
mass_replace.py
~~~~~~~~~~~~~~~
WIP
Python Application for multiple simultaneous find and replace operations in a directory.
"""
import pathlib
from sys import version_info
import os
import fileinput
Expand All @@ -12,6 +14,7 @@


PYTHON_VER = (version_info.major, version_info.minor)
ROOT = pathlib.Path(__file__).joinpath("..").resolve()


def resolve_wd(target_dir="mass_replace"):
Expand Down Expand Up @@ -74,13 +77,15 @@ def discover_filetypes(root_folder=None, hard_copy="file_exts.txt"):


def mass_replace(root_folder=None, config=None, verbose=False):
"""Peforms find and replace operations on files nested in a root direcotry
"""Performs find and replace operations on files nested in a root direcotry
according to settings in the `config.yaml` file."""
if not config:
try:
config = load_config("config.yaml")
except FileNotFoundError:
config = load_config("mass_replace/config.yaml")
raise FileNotFoundError(
"Could not find a 'config.yaml' file and no alternative config provided"
)
if not root_folder:
root_folder = config["root_folder"]
print("ROOT: {}".format(root_folder))
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[build-system]
requires = ["flit"]
build-backend = "flit.buildapi"

[tool.flit.metadata]
module = "mass_replace"
author = "Gabriel Gore"
author-email = "gabriel59kg@gmail.com"
home-page = "https://github.com/Kilo59/mass_replace"
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Development Status :: 2 - Pre-Alpha",
]
requires-python = ">=3.5"
requires = ["pyyaml"]

[tool.flit.scripts]
replace = "mass_replace.__main__:main"
25 changes: 0 additions & 25 deletions requirements.txt

This file was deleted.

9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pathlib
from setuptools import find_packages, setup

# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
# The directory containing this file
HERE = pathlib.Path(__file__).parent

import os
import sys
Expand All @@ -22,7 +24,7 @@
AUTHOR = "Gabriel Gore"
REQUIRES_PYTHON = ">=3.5.0"
# replace with __version__
VERSION = "0.0.2"
VERSION = "0.0.3"

# What packages are required for this module to be executed?
REQUIRED = ["pyaml"]
Expand Down Expand Up @@ -83,6 +85,7 @@ def run(self):
version=about["__version__"],
description=DESCRIPTION,
long_description=README,
long_description_content_type="text/markdown",
author=AUTHOR,
author_email=EMAIL,
python_requires=REQUIRES_PYTHON,
Expand Down

0 comments on commit e629dd9

Please sign in to comment.