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

base architecture with .docx support #19

Merged
merged 49 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7c863dc
add `metadoc.utils` to setup.py
AHReccese Jan 12, 2024
bcecd85
add init to `utils` folder
AHReccese Jan 12, 2024
b29d336
add `zip_and_extract` function to `util.py`
AHReccese Jan 12, 2024
7eca85e
add dev-requirements for metadoc test
AHReccese Jan 13, 2024
62cc169
Bump numpy from 1.26.2 to 1.26.3
dependabot[bot] Jan 15, 2024
1e11b0b
Merge pull request #11 from openscilab/dependabot/pip/dev/numpy-1.26.3
AHReccese Jan 16, 2024
67ca2f8
Bump scikit-learn from 1.3.2 to 1.4.0 (#15)
dependabot[bot] Jan 22, 2024
ffb76c2
Bump numpy from 1.26.3 to 1.26.4 (#16)
dependabot[bot] Feb 13, 2024
371e9f0
update package name
AHReccese Apr 14, 2024
70f7f8f
update package name
AHReccese Apr 14, 2024
91cc49c
add personal fields correspondence dict in xml files
AHReccese Apr 14, 2024
c44dd91
remove scikit dependancy
AHReccese Apr 15, 2024
8a77b50
apply refactorings
AHReccese Apr 27, 2024
f4be153
init dmeta
AHReccese Apr 27, 2024
87c1399
add CLI handler
AHReccese Apr 27, 2024
6b576fa
implement `extract_namespaces` function
AHReccese Apr 27, 2024
6d1768a
implement `remove_format` function
AHReccese Apr 27, 2024
93b5d81
implement `extract_docx` function
AHReccese Apr 27, 2024
65a389a
implement `read_json` function
AHReccese Apr 27, 2024
4e829a7
init dmeta params
AHReccese Apr 27, 2024
232d8ed
add `PERSONAL_FIELDS_CORE_XML_CORRESPONDENCES` params
AHReccese Apr 27, 2024
4881f68
add `PERSONAL_FIELDS_APP_XML_CORRESPONDENCES` params
AHReccese Apr 27, 2024
add9ef9
refactoring util.py
AHReccese Apr 27, 2024
ea284cc
add clear functionality
AHReccese Apr 27, 2024
65a6910
add clear all functionality
AHReccese Apr 27, 2024
b3f632b
add update functionality
AHReccese Apr 27, 2024
63f4805
add update all functionality
AHReccese Apr 27, 2024
5c954fa
CLI arg parser added
AHReccese Apr 27, 2024
e3db5c5
remove numpy & add art
AHReccese Apr 28, 2024
7f32f48
add art
AHReccese Apr 28, 2024
44ad8af
enhance CLI handler
AHReccese Apr 28, 2024
73b5af6
apply refactorings
AHReccese Apr 28, 2024
8cbabcc
add overview, shorten some variables
AHReccese Apr 28, 2024
4bdb339
implement `dmeta_help` function
AHReccese Apr 28, 2024
e5410ec
apply refactorings
AHReccese Apr 28, 2024
93e8f41
change `Dmeta` to `dmeta`
AHReccese Apr 28, 2024
72ca835
`CHANGELOG.md` updated
AHReccese Apr 28, 2024
c4c34cf
add space
AHReccese Apr 28, 2024
8bb8c1a
`CHANGELOG.md` updated
AHReccese Apr 28, 2024
ed2b11b
update classifiers
AHReccese May 1, 2024
ac6b181
add docstring to `read_json` function
AHReccese May 1, 2024
ac95cda
`CHANGELOG.md` updated
AHReccese May 1, 2024
9ecf5cf
update `dmeta` to `DMeta`
AHReccese May 2, 2024
e1d33e9
update namings
AHReccese May 2, 2024
94914de
update packages
AHReccese May 2, 2024
bdebeef
comment `pytest` job
AHReccese May 8, 2024
fd646d1
update name to `DMeta`
AHReccese May 8, 2024
eaa0e9f
`autopep8.sh` applied
AHReccese May 8, 2024
a6cd49f
fix runner version
AHReccese May 8, 2024
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
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__`)
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ jobs:
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
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