Skip to content

Commit

Permalink
base architecture with .docx support (#19)
Browse files Browse the repository at this point in the history
* add `metadoc.utils` to setup.py

* add init to `utils` folder

* add `zip_and_extract` function to `util.py`

* add dev-requirements for metadoc test
update metadoc project's description

* Bump numpy from 1.26.2 to 1.26.3

Bumps [numpy](https://github.com/numpy/numpy) from 1.26.2 to 1.26.3.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](numpy/numpy@v1.26.2...v1.26.3)

---
updated-dependencies:
- dependency-name: numpy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump scikit-learn from 1.3.2 to 1.4.0 (#15)

Bumps [scikit-learn](https://github.com/scikit-learn/scikit-learn) from 1.3.2 to 1.4.0.
- [Release notes](https://github.com/scikit-learn/scikit-learn/releases)
- [Commits](scikit-learn/scikit-learn@1.3.2...1.4.0)

---
updated-dependencies:
- dependency-name: scikit-learn
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump numpy from 1.26.3 to 1.26.4 (#16)

Bumps [numpy](https://github.com/numpy/numpy) from 1.26.3 to 1.26.4.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](numpy/numpy@v1.26.3...v1.26.4)

---
updated-dependencies:
- dependency-name: numpy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update package name

* update package name

* add personal fields correspondence dict in xml files

* remove scikit dependancy

* apply refactorings

* init dmeta

* add CLI handler

* implement `extract_namespaces` function

* implement `remove_format` function

* implement `extract_docx` function

* implement `read_json` function

* init dmeta params

* add `PERSONAL_FIELDS_CORE_XML_CORRESPONDENCES` params

* add `PERSONAL_FIELDS_APP_XML_CORRESPONDENCES` params

* refactoring util.py

* add clear functionality

* add clear all functionality

* add update functionality

* add update all functionality

* CLI arg parser added

* remove numpy & add art

* add art

* enhance CLI handler

* apply refactorings

* add overview, shorten some variables

* implement `dmeta_help` function

* apply refactorings

* change `Dmeta` to `dmeta`

* `CHANGELOG.md` updated

* add space

* `CHANGELOG.md` updated

* update classifiers

* add docstring to `read_json` function

* `CHANGELOG.md` updated

* update `dmeta` to `DMeta`

* update namings

* update packages

* comment `pytest` job

* update name to `DMeta`

* `autopep8.sh` applied

* fix runner version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
AHReccese and dependabot[bot] authored May 13, 2024
1 parent 9a4ad10 commit 4ce9039
Show file tree
Hide file tree
Showing 23 changed files with 444 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[run]
branch = True
omit =
*/metadoc/__main__.py
*/dmeta/__main__.py
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

#### Python Version

#### MetaDoc Version (Use : `metadoc.__version__`)
#### DMeta Version (Use : `dmeta.__version__`)
2 changes: 1 addition & 1 deletion .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
deploy:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macOS-latest]
os: [ubuntu-20.04, windows-2022, macOS-13]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0, 3.12.0]
steps:
- uses: actions/checkout@v2
Expand All @@ -31,18 +31,18 @@ jobs:
run: |
python otherfiles/requirements-splitter.py
pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt
- name: Test with pytest
run: |
python -m pytest . --cov=metadoc --cov-report=term
# - name: Test with pytest
# run: |
# python -m pytest . --cov=dmeta --cov-report=term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
if: matrix.python-version == env.TEST_PYTHON_VERSION && matrix.os == env.TEST_OS
- name: Other tests
run: |
python -m vulture metadoc/ otherfiles/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
python -m bandit -r metadoc -s B311
python -m vulture dmeta/ otherfiles/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
python -m bandit -r dmeta -s B311
python -m pydocstyle -v
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Version check
Expand Down
23 changes: 15 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.1] - 2022-08-17
### Added
- `.docx` file support
- `update` metadata functionality
- `update all` metadata functionality
- `clear` metadata functionality
- `clear all` metadata functionality
- `main` function in `__main__.py`
- `README.md`
- `clear` function `functions.py`
- `clear_all` function in `functions.py`
- `update` function `functions.py`
- `update_all` function `functions.py`
- `run_dmeta` function `functions.py`
- `dmeta_help` function `functions.py`
- `extract_namespaces` function in `util.py`
- `remove_format` function in `util.py`
- `extract_docx` function in `util.py`
- `read_json` function in `util.py`

[Unreleased]: https://github.com/openscilab/metadoc/compare/v0.1...dev
[0.1]: https://github.com/openscilab/metadoc/compare/3598e8b...v0.1

[Unreleased]: https://github.com/openscilab/dmeta/compare/v0.1...dev
[0.1]: https://github.com/openscilab/dmeta/compare/9a4ad10 ...v0.1
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div align="center">
<img src="https://github.com/openscilab/metadoc/raw/main/otherfiles/logo.png" width="280" height="400">
<img src="https://github.com/openscilab/dmeta/raw/main/otherfiles/logo.png" width="280" height="400">
<br/>
<br/>
<a href="https://codecov.io/gh/openscilab/metadoc">
<img src="https://codecov.io/gh/openscilab/metadoc/branch/main/graph/badge.svg" alt="Codecov"/>
<a href="https://codecov.io/gh/openscilab/dmeta">
<img src="https://codecov.io/gh/openscilab/dmeta/branch/main/graph/badge.svg" alt="Codecov"/>
</a>
<a href="TODO">
<img src="TODO" alt="PyPI version" height="18">
Expand All @@ -20,22 +20,22 @@

## Table of contents

* [Overview](https://github.com/openscilab/metadoc#overview)
* [Installation](https://github.com/openscilab/metadoc#installation)
* [Usage](https://github.com/openscilab/metadoc#usage)
* [Issues & Bug Reports](https://github.com/openscilab/metadoc#issues--bug-reports)
* [Todo](https://github.com/openscilab/metadoc/blob/main/TODO.md)
* [Contribution](https://github.com/openscilab/metadoc/blob/main/.github/CONTRIBUTING.md)
* [Authors](https://github.com/openscilab/metadoc/blob/main/AUTHORS.md)
* [License](https://github.com/openscilab/metadoc/blob/main/LICENSE)
* [Show Your Support](https://github.com/openscilab/metadoc#show-your-support)
* [Changelog](https://github.com/openscilab/metadoc/blob/main/CHANGELOG.md)
* [Code of Conduct](https://github.com/openscilab/metadoc/blob/main/.github/CODE_OF_CONDUCT.md)
* [Overview](https://github.com/openscilab/dmeta#overview)
* [Installation](https://github.com/openscilab/dmeta#installation)
* [Usage](https://github.com/openscilab/dmeta#usage)
* [Issues & Bug Reports](https://github.com/openscilab/dmeta#issues--bug-reports)
* [Todo](https://github.com/openscilab/dmeta/blob/main/TODO.md)
* [Contribution](https://github.com/openscilab/dmeta/blob/main/.github/CONTRIBUTING.md)
* [Authors](https://github.com/openscilab/dmeta/blob/main/AUTHORS.md)
* [License](https://github.com/openscilab/dmeta/blob/main/LICENSE)
* [Show Your Support](https://github.com/openscilab/dmeta#show-your-support)
* [Changelog](https://github.com/openscilab/dmeta/blob/main/CHANGELOG.md)
* [Code of Conduct](https://github.com/openscilab/dmeta/blob/main/.github/CODE_OF_CONDUCT.md)


## Overview
<p align="justify">
MetaDoc is an open source Python package that provides ... TODO
DMeta is an open source Python package that provides ... TODO
</p>
<table>
<tr>
Expand All @@ -49,7 +49,7 @@ MetaDoc is an open source Python package that provides ... TODO
<tr>
<td align="center">Github Stars</td>
<td align="center">
<a href="https://github.com/openscilab/metadoc">
<a href="https://github.com/openscilab/dmeta">
<img src="TODO">
</a>
</td>
Expand All @@ -64,10 +64,10 @@ MetaDoc is an open source Python package that provides ... TODO
<tr>
<td align="center">CI</td>
<td align="center">
<img src="https://github.com/openscilab/metadoc/workflows/CI/badge.svg?branch=main">
<img src="https://github.com/openscilab/dmeta/workflows/CI/badge.svg?branch=main">
</td>
<td align="center">
<img src="https://github.com/openscilab/metadoc/workflows/CI/badge.svg?branch=dev">
<img src="https://github.com/openscilab/dmeta/workflows/CI/badge.svg?branch=dev">
</td>
</tr>
</table>
Expand All @@ -78,9 +78,9 @@ MetaDoc is an open source Python package that provides ... TODO
### PyPI

- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- Run `pip install metadoc==0.1`
- Run `pip install dmeta==0.1`
### Source code
- Download [Version 0.1](https://github.com/openscilab/metadoc/archive/v0.1.zip) or [Latest Source](https://github.com/openscilab/metadoc/archive/dev.zip)
- Download [Version 0.1](https://github.com/openscilab/dmeta/archive/v0.1.zip) or [Latest Source](https://github.com/openscilab/dmeta/archive/dev.zip)
- Run `pip install .`

## Usage
Expand Down Expand Up @@ -131,4 +131,4 @@ Give a ⭐️ if this project helped you!
### Donate to our project
If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .

<a href="https://openscilab.com/#donation" target="_blank"><img src="https://github.com/openscilab/metadoc/raw/main/otherfiles/donation.png" height="90px" width="270px" alt="MetaDoc Donation"></a>
<a href="https://openscilab.com/#donation" target="_blank"><img src="https://github.com/openscilab/dmeta/raw/main/otherfiles/donation.png" height="90px" width="270px" alt="DMeta Donation"></a>
2 changes: 1 addition & 1 deletion autopep8.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
python -m autopep8 metadoc --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 dmeta --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 otherfiles --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 setup.py --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose
2 changes: 1 addition & 1 deletion autopep8.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
python -m autopep8 metadoc --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 dmeta --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 otherfiles --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 setup.py --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose
7 changes: 7 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
art==6.1
setuptools>=40.8.0
vulture>=1.0
bandit>=1.5.1
pydocstyle>=3.0.0
pytest>=4.3.1
pytest-cov>=2.6.1
4 changes: 4 additions & 0 deletions dmeta/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
"""DMeta modules."""
from .params import DMETA_VERSION
__version__ = DMETA_VERSION
63 changes: 63 additions & 0 deletions dmeta/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""DMeta main."""
import argparse
from art import tprint
from dmeta.functions import run_dmeta, dmeta_help
from dmeta.params import DMETA_VERSION


def main():
"""
CLI main function.
:return: None
"""
tprint("DMeta")
tprint("V:" + DMETA_VERSION)
dmeta_help()
parser = argparse.ArgumentParser()
parser.add_argument(
'--clear',
nargs=1,
metavar=".docx file",
type=str,
help="the `clear` command clears all matadata in the given `.docx` file.",
)
parser.add_argument(
'--clear-all',
action="store_true",
default=False,
help='the `clear-all` command clears all metadata in any `.docx` file in the current directory.',
)
parser.add_argument(
'--update',
nargs=1,
metavar=".docx file",
type=str,
help="the `update` command updates the given .docx file's metadata according to the given .json config file."
)
parser.add_argument(
'--update-all',
action="store_true",
default=False,
help='the `update-all` command updates all metadata in any `.docx` file in the current directory according to the given .json config file.',
)
parser.add_argument(
'--config',
nargs=1,
metavar=".json config file",
type=str,
help="the `config` command specifices the way metadata in the .docx files get updated."
)
# parse the arguments from the standard input
args = parser.parse_args()
run_dmeta(args)


if __name__ == "__main__":
main()

# testcases:
# dmeta --clear "test.docx"
# dmeta --clear-all
# dmeta --update "test.docx" --config "cnf.json"
# dmeta --update-all --config "cnf.json"
Loading

0 comments on commit 4ce9039

Please sign in to comment.