improve file organisation

This commit is contained in:
Ivan Schaller 2022-06-25 14:29:09 +02:00
parent 5725c75868
commit f493d81fb6
6 changed files with 115 additions and 31 deletions

View file

@ -224,10 +224,12 @@ This will download the chapter and save it as a zip archive.
For suggestions for improvement, just open a pull request. For suggestions for improvement, just open a pull request.
If you want to add support for a new site, there is an api [template file](./contrib/api_template.py) which you can use. If you want to add support for a new site, there is an api [template file](./contrib/api_template.py) which you can use.
And more infos and tools in the contrib [README.md](contrib/README.md)
Otherwise you can open a issue with the name of the site which you want support for. (not guaranteed to be implemented) Otherwise, you can open am issue with the name of the site which you want support for. (not guaranteed to be
implemented)
If you encounter any bugs, also just open a issue with a description of the problem. If you encounter any bugs, also just open an issue with a description of the problem.
## TODO's ## TODO's

16
contrib/README.md Normal file
View file

@ -0,0 +1,16 @@
# contribute
### install dev requirements
```sh
python3 -m pip install -r requirements_dev.txt
```
### setup asdf with all needed tools and versions
> you may need to install just first: [link](https://github.com/casey/just)
```sh
just prepare_workspace
```

69
contrib/justfile Executable file
View file

@ -0,0 +1,69 @@
#!/usr/bin/env just --justfile
default: show_receipts
set shell := ["bash", "-uc"]
set dotenv-load := true
#set export
# aliases
alias s := show_receipts
alias p := prepare_workspace
# variables
export asdf_version := "v0.10.2"
# default recipe to display help information
show_receipts:
@just --list
show_system_info:
@echo "os : {{os()}}"
@echo "arch: {{arch()}}"
@echo "home: ${HOME}"
check_asdf:
@if ! asdf --version; then \
just install_asdf \
;else \
echo "asdf already installed" \
;fi
just install_asdf_bins
install_asdf:
@echo "installing asdf"
@echo "asdf version: ${asdf_version}"
@git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch "${asdf_version}"
@echo "adding asdf to .bashrc"
@if ! grep -q ".asdf/asdf.sh" "${HOME}/.bashrc"; then \
echo -e '\n# source asdf' >> "${HOME}/.bashrc" \
;echo 'source "${HOME}/.asdf/asdf.sh"' >> "${HOME}/.bashrc" \
;echo -e 'source "${HOME}/.asdf/completions/asdf.bash"\n' >> "${HOME}/.bashrc" \
;fi
@echo "to load asdf either restart your shell or do: 'source \${HOME}/.bashrc'"
setup_asdf:
@echo "installing asdf bins"
# add plugins
@if ! asdf plugin add python; then :; fi
@if ! asdf plugin add shfmt; then :; fi
@if ! asdf plugin add shellcheck; then :; fi
@if ! asdf plugin add just https://github.com/franklad/asdf-just; then :; fi
@if ! asdf plugin add direnv; then :; fi
# install bins
@if ! asdf install; then :; fi
# setup direnv
@if ! asdf direnv setup --shell bash --version latest; then :; fi
create_venv:
@echo "creating venv"
@python3 -m pip install --upgrade pip setuptools wheel
@python3 -m venv venv
# install dependecies and set everything up
prepare_workspace:
just show_system_info
just check_asdf
just setup_asdf
just create_venv

View file

@ -39,7 +39,25 @@ Source = "https://github.com/olofvndrhr/manga-dlp"
mangadlp = "mangadlp.input:main" mangadlp = "mangadlp.input:main"
manga-dlp = "mangadlp.input:main" manga-dlp = "mangadlp.input:main"
# isort config [tool.hatch.build]
ignore-vcs = true
[tool.hatch.build.targets.sdist]
include = ["mangadlp"]
exclude = [
"docker",
".tox",
".mypy_cache"
]
[tool.hatch.build.targets.wheel]
include = ["mangadlp"]
exclude = [
"docker",
".tox",
".mypy_cache"
]
[tool.isort] [tool.isort]
py_version = 39 py_version = 39
skip_gitignore = true skip_gitignore = true
@ -49,7 +67,6 @@ multi_line_output = 3
include_trailing_comma = true include_trailing_comma = true
use_parentheses = true use_parentheses = true
# mypy config
[tool.mypy] [tool.mypy]
python_version = "3.9" python_version = "3.9"
disallow_untyped_defs = false disallow_untyped_defs = false
@ -62,7 +79,11 @@ show_column_numbers = true
show_error_codes = true show_error_codes = true
pretty = true pretty = true
# coverage.py config [tool.pytest.ini_options]
pythonpath = [
"."
]
[tool.coverage.run] [tool.coverage.run]
source = ["mangadlp"] source = ["mangadlp"]
branch = true branch = true
@ -86,27 +107,3 @@ exclude_lines = [
"@(abc.)?abstractmethod", "@(abc.)?abstractmethod",
] ]
ignore_errors = true ignore_errors = true
[tool.hatch.build]
ignore-vcs = true
[tool.hatch.build.targets.sdist]
include = ["mangadlp"]
exclude = [
"docker",
".tox",
".mypy_cache"
]
[tool.hatch.build.targets.wheel]
include = ["mangadlp"]
exclude = [
"docker",
".tox",
".mypy_cache"
]
[tool.pytest.ini_options]
pythonpath = [
"."
]

View file

@ -4,14 +4,14 @@ isolated_build = True
[testenv] [testenv]
deps = deps =
-rrequirements_dev.txt -rcontrib/requirements_dev.txt
commands = commands =
pytest -x --basetemp="{envtmpdir}" {posargs} pytest -x --basetemp="{envtmpdir}" {posargs}
[testenv:coverage] [testenv:coverage]
deps = deps =
-rrequirements_dev.txt -rcontrib/requirements_dev.txt
commands = commands =
coverage erase coverage erase