Skip to content

Commit

Permalink
Merge pull request #421 from xxyzz/pages
Browse files Browse the repository at this point in the history
Add JSON schema files to GitHub Pages
  • Loading branch information
xxyzz authored Dec 7, 2023
2 parents ecb5e11 + 4620fc8 commit c7094e7
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 2,082 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ jobs:
cache: 'pip'
- run: |
python -m pip install -U pip
python -m pip install --use-pep517 '.[dev]'
- run: make test
python -m pip install --use-pep517 -e '.[dev]'
- run: make test_coverage
env:
PYTHONWARNINGS: default
- name: Remove huge file taxondata_py.html
run: rm -f htmlcov/*_taxondata_py.html
- run: |
make coverage_report
make github_pages REPO=${{ github.repository }} SHA=${{ github.sha }}
if: github.ref_name == 'master' && matrix.python-version == '3.12'
- uses: actions/upload-pages-artifact@v2
if: github.ref_name == 'master' && matrix.python-version == '3.12'
with:
path: htmlcov

deploy:
if: github.ref_name == 'master'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ usertools/data/
bac-wikt-*
pagesbac/
wikt-db*

# GitHub Pages
_site
23 changes: 16 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# Run "make test" to run tests (with coverage analysis left in ./htmlcov)
# Run "make test" to run tests
# Run "make clean" to remove automatically generated files
REPO ?= tatuylonen/wiktextract
SHA ?= HEAD

test:
rm -rf .coverage htmlcov
python -m nose2 --output-buffer --pretty-assert --with-coverage --coverage-report=html
quicktest:
python -m nose2 --output-buffer --pretty-assert
python -m unittest discover -b -s tests
test_coverage:
python -m coverage erase
python -m coverage run -m unittest discover -b -s tests
coverage_report:
python -m coverage combine
python -m coverage html
github_pages:
python tools/generate_schema.py
cp json_schema/*.json _site
python tools/github_pages.py $(REPO) $(SHA)
clean:
rm -rf __pycache__
rm -rf .coverage* htmlcov*
python -m coverage erase
rm -rf __pycache__ _site
22 changes: 2 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,11 @@ python -m pip install -U pip
python -m pip install --use-pep517 .
```

This software requires Python 3.

### Running tests

This package includes tests written using the `unittest` framework.
They can be run using, for example, `nose2`, which can be installed
using `python -m pip install --use-pep517 -e ".[dev]"`.
The test dependencies can be installed with command
`python -m pip install --use-pep517 -e ".[dev]"`.

To run the tests, use the following command in the top-level directory:

Expand Down Expand Up @@ -358,22 +356,6 @@ updated regularly with the latest Wiktionary dump. Using the
pre-extracted data may be the easiest option unless you have special
needs or want to modify the code.

### Installing and running tests on Windows with VS Code

Tested with Python 3.9.4.

- Create [a Python virtual environment](https://code.visualstudio.com/docs/python/environments#_creating-environments)
(venv) in the VS Code workspace with the cloned repo. It should automatically install the package.

- Open a new terminal. It should be PowerShell. You may need to [fix terminal permissions](https://stackoverflow.com/questions/56199111/visual-studio-code-cmd-error-cannot-be-loaded-because-running-scripts-is-disabl/67420296#67420296)
in order for it to pick up the virtual environment correclty.

- In the terminal run this command:

```
py -m nose2 -B
```

## Using the command-line tool

The ``wiktwords`` script is the easiest way to extract data from
Expand Down
Loading

0 comments on commit c7094e7

Please sign in to comment.