Skip to content

Commit

Permalink
Merge rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
thesadru committed Apr 13, 2022
2 parents 5a5cec8 + 804f222 commit 9ed83cb
Show file tree
Hide file tree
Showing 120 changed files with 9,505 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[flake8]
exclude = tests, test.py
ignore =
A001, A002, A003, # `id` variable/parameter/attribute
C408, # dict() with keyword arguments
D105, # Missing docstring in magic method
D106, # Missing docstring Model.Config
S303, # Use of md5
S311, # Use of pseudo-random generators


# F401: unused import.
# F403: cannot detect unused vars if we use starred import
# D10*: docstrings
# S10*: hardcoded passwords
# F841: unused variable
per-file-ignores =
**/__init__.py: F401, F403
tests/**: D10, S10, F841

max-complexity = 20
max-function-length = 100
max-line-length = 130

accept-encodings = utf-8
docstring-convention = numpy
ignore-decorators = property
95 changes: 95 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Run checks

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: install nox
run: |
python -m pip install nox
- name: lint
run: |
python -m nox -s lint
test:
runs-on: ubuntu-latest
if: github.event_name == 'push'
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

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 nox
run: |
python -m pip install nox
- name: Run tests
env:
LTUID: ${{ secrets.LTUID }}
LTOKEN: ${{ secrets.LTOKEN }}
CN_LTUID: ${{ secrets.CN_LTUID }}
CN_LTOKEN: ${{ secrets.CN_LTOKEN }}
run: |
python -m nox -s test
type-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: install nox
run: |
python -m pip install nox
- name: Run type checker
run: |
python -m nox -s type-check
verify-types:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: install nox
run: |
python -m pip install nox
- name: Run type checker
run: |
python -m nox -s verify-types
prettier:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run prettier
run: |
npx prettier --check *.md docs/*.md *.yml
29 changes: 29 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build docs

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install nox mkdocs-material
- name: Generate API Documentation
run: |
python -m nox -s docs
- name: Deploy docs
run: |
mkdocs gh-deploy --force
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish to PyPI

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# PyCharm/IntelliJ-generated files
*.iml
.idea/

# Visual Studio Code-generated files
.settings/
.project
.vscode/
.vs/

# Distribution / packaging
build/
develop-eggs/
dist/
eggs/
sdist/
wheels/
*.egg-info/
*.egg
MANIFEST

# Temporary test files
test.py

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site
docs/pdoc

# mypy
.mypy_cache/
.dmypy.json
dmypy.json
120 changes: 120 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Changelog

# 1.0.0

## What's new

- Added honkai endpoints.
- Added login with username and password (`Client.login_with_password`)
- Made the entire project be mypy and pyright strict compliant.

## Changes

- Caching is now handled through `Client.cache`
- Moved `MultiCookieClient` functionality to `Client.cookie_manager`

## Fixes

- Reduced the amount of unexpected ratelimit exceptions
- Made every single model be re-serializable.

## Deprecation

- `GenshinClient.cookies` were removed in favor of `cookie_manager`
- `GenshinClient` and subclasses were merged into `Client`
- `genshin_accounts` -> `get_game_accounts`
- `get_record_card` -> `get_record_cards`
- `get_[partial|full]_user` -> `get_[partial|full]_genshin_user`

# 0.4.0 (2022-02-03)

## What's new

- Added Serenitea Pot's Jar of Riches to Real-Time Notes
- Implemented `set_top_characters`
- Added models for A Study in Potions

## Changes

- Made the Enhancement Progression Calculator use the builder pattern

# 0.3.1 (2022-01-10)

## Deprecation

- Removed all_characters since the API no longer supports this feature

## Fixes

- Images are now accounted for during character data completion
- Diary log no longer repeatedly returns the first page in some cases

# 0.3.0 (2021-12-25)

## What's new

- Added full support for the Genshin Impact Enhancement Progression Calculator
- Improved debug mode to be slightly more descriptive

## Fixes

- Fixed minor API inconsistencies including domain mismatches
- Ensured some specific models no longer break when being revalidated

# 0.2.0 (2021-12-03)

## What's new

- Added partial support for i18n
- Added a way to specify the characters you want to get with `get_user`
- Improved rate limit handling for certain endpoints
- Made paginators awaitable

## Fixes

- Fixed breaking API changes caused by the second banner
- Deprecated authkeys in support pages
- Fixed pydantic bug with ClassVar not being recognized properly

# 0.1.0 (2021-11-05)

## What's new

- Implemented the Traveler's Diary
- Cache uids for daily rewards and similar endpoints.
- Support artifact levels
- Add an `enabled` field for artifact set effects

## Fixes

- Migrate server domains in accordance with the recent HoYoLAB server migration
- Remove invalid authkey validation
- Make permanent caches persist
- No longer attempt to close non-existent sessions in `MultiCookieClient`
- Fix minor problems with model validation

# 0.0.2 (2021-10-25)

## What's new

- Implemented Real-Time notes
- Added Labyrinth Warriors to activities
- Made all `datetime` objects timezone aware.
- Added public privacy settings to record cards.
- Added basic support for Redis caches
- Added new CLI commands
- Added pdoc-generated API documentation
- Started using ReST-style docstrings
- Added module docstrings
- Made `debug` a property instead of an `__init__` param

## Fixes

- Chinese daily reward claiming will no longer consistently raise errors due to invalid headers.
- `get_banner_details` no longer requires gacha ids. They will be fetched from a user-maintained database from now on.
- `genshin.models.base.BaseCharacter` is now a string instead of `CharacterIcon`
- `genshin.models.base.GenshinModel.dict()` now also includes properties as it is immutable.

## Documentation

- Documented a large part of the library with at least simple examples
Loading

1 comment on commit 9ed83cb

@thesadru
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the merge commit for the full library rewrite to 1.0.0

I have no idea how to make this merge prettier

Please sign in to comment.