Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from cubenlp/dev
files generate by cookiecutter
- Loading branch information
Showing
15 changed files
with
370 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
* hf-mirror-fetch version: | ||
* Python version: | ||
* Operating System: | ||
|
||
### Description | ||
|
||
Describe what you were trying to get done. | ||
Tell us what happened, what went wrong, and what you expected to happen. | ||
|
||
### What I Did | ||
|
||
``` | ||
Paste the command(s) you ran and the output. | ||
If there was a crash, please include the traceback here. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Publish Package | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Verify tag matches setup.py version | ||
run: | | ||
if [[ "$(git describe --tags)" != "$(grep "^VERSION" setup.py | cut -d"'" -f2)" ]]; then echo "Tag does not match setup.py version"; exit 0; fi | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish to PyPI | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine check dist/* | ||
twine upload dist/* --skip-existing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Python Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- python-version: "3.9" | ||
os: ubuntu-latest | ||
- python-version: "3.9" | ||
os: macos-latest | ||
# - python-version: "3.9" | ||
# os: window | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install .[test] | ||
python -m pip install -r requirements_dev.txt | ||
- name: Test with pytest and coverage | ||
run: | | ||
pip install coverage | ||
coverage run -m pytest tests/ | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
flags: unittests | ||
name: codecov-umbrella | ||
fail_ci_if_error: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
.venv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# IDE settings | ||
.vscode/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Credits | ||
|
||
## Development Lead | ||
|
||
- Qing <aqsz2526@outlook.com> | ||
|
||
## Contributors | ||
|
||
- Rex Wang <1073853456@qq.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024, Qing | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# hf-mirror-download | ||
A command-line tool designed to streamline the process of downloading machine learning models and related files from the Hugging Face model hub mirror site. | ||
|
||
https://hf-mirror.com/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"""Top-level package for hf-mirror-fetch.""" | ||
|
||
__author__ = """Qing""" | ||
__email__ = 'aqsz2526@outlook.com' | ||
__version__ = '0.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Console script for hf_mirror_fetch.""" | ||
import sys | ||
import click | ||
|
||
|
||
@click.command() | ||
def main(args=None): | ||
"""Console script for hf_mirror_fetch.""" | ||
click.echo("Replace this message by putting your code into " | ||
"hf_mirror_fetch.cli.main") | ||
click.echo("See click documentation at https://click.palletsprojects.com/") | ||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) # pragma: no cover |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
pip==19.2.3 | ||
bump2version==0.5.11 | ||
wheel==0.33.6 | ||
watchdog==0.9.0 | ||
flake8==3.7.8 | ||
tox==3.14.0 | ||
coverage==4.5.4 | ||
Sphinx==1.8.5 | ||
twine==1.14.0 | ||
pytest==6.2.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = True | ||
tag = True | ||
|
||
[bumpversion:file:setup.py] | ||
search = version='{current_version}' | ||
replace = version='{new_version}' | ||
|
||
[bumpversion:file:hf_mirror_fetch/__init__.py] | ||
search = __version__ = '{current_version}' | ||
replace = __version__ = '{new_version}' | ||
|
||
[bdist_wheel] | ||
universal = 1 | ||
|
||
[flake8] | ||
exclude = docs | ||
[tool:pytest] | ||
addopts = --ignore=setup.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env python | ||
|
||
"""The setup script.""" | ||
|
||
from setuptools import setup, find_packages | ||
|
||
VERSION = "0.1.0" | ||
|
||
with open('README.md') as readme_file: | ||
readme = readme_file.read() | ||
|
||
requirements = ['Click>=7.0', ] | ||
|
||
test_requirements = ['pytest>=3', ] | ||
|
||
setup( | ||
author="Qing", | ||
author_email='aqsz2526@outlook.com', | ||
python_requires='>=3.6', | ||
classifiers=[ | ||
'Development Status :: 2 - Pre-Alpha', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Natural Language :: English', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
], | ||
description="A command-line tool designed to streamline the process of downloading machine learning models and related files from the Hugging Face model hub mirror site.", | ||
entry_points={ | ||
'console_scripts': [ | ||
'hf_mirror_fetch=hf_mirror_fetch.cli:main', | ||
], | ||
}, | ||
install_requires=requirements, | ||
license="MIT license", | ||
long_description=readme, | ||
include_package_data=True, | ||
keywords='hf_mirror_fetch', | ||
name='hf_mirror_fetch', | ||
packages=find_packages(include=['hf_mirror_fetch', 'hf_mirror_fetch.*']), | ||
test_suite='tests', | ||
tests_require=test_requirements, | ||
url='https://github.com/Qing25/hf_mirror_fetch', | ||
version=VERSION, | ||
zip_safe=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Unit test package for hf_mirror_fetch.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Tests for `hf_mirror_fetch` package.""" | ||
|
||
import pytest | ||
|
||
from click.testing import CliRunner | ||
|
||
from hf_mirror_fetch import cli | ||
|
||
|
||
@pytest.fixture | ||
def response(): | ||
"""Sample pytest fixture. | ||
See more at: http://doc.pytest.org/en/latest/fixture.html | ||
""" | ||
# import requests | ||
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage') | ||
|
||
|
||
def test_content(response): | ||
"""Sample pytest test function with the pytest fixture as an argument.""" | ||
# from bs4 import BeautifulSoup | ||
# assert 'GitHub' in BeautifulSoup(response.content).title.string | ||
|
||
|
||
def test_command_line_interface(): | ||
"""Test the CLI.""" | ||
runner = CliRunner() | ||
result = runner.invoke(cli.main) | ||
assert result.exit_code == 0 | ||
assert 'hf_mirror_fetch.cli.main' in result.output | ||
help_result = runner.invoke(cli.main, ['--help']) | ||
assert help_result.exit_code == 0 | ||
assert '--help Show this message and exit.' in help_result.output |