diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 11d97695..edda7961 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,60 +1,62 @@ name: 'Test' -on: [push, pull_request, workflow_dispatch] +on: + push: + paths: + - /**/*.py + - /**/*.pyi + - pyproject.toml + - .github/workflows/test.yml + pull_request: + workflow_dispatch: jobs: test: - runs-on: ubuntu-18.04 + runs-on: ${{ matrix.os }} timeout-minutes: 10 + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ['3.8', '3.9', '3.10'] steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: "3.9" - - - name: Cache pip - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Install dependencies - run: - python -m pip install -r tests/requirements.txt - - - name: Run pyright tests - uses: gramster/pyright-action@main - with: - project: pyrighttestconfig.json - warn-partial: true - - - name: Run pytest - run: - pytest tests/pandas - - - name: Run mypy - run: - mypy tests/pandas typings/pandas - - - name: Build wheel and install and remove typings - run: | - python setup.py build bdist_wheel - find ./dist/*.whl | xargs pip install - rm -rf typings - pip install pyright - - - name: Run pyright against dist - uses: gramster/pyright-action@main - with: - project: pyrightdistconfig.json - warn-partial: true - - - name: Run mypy against dist - run: - mypy tests/pandas + + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Upgrade pip + run: python -m pip install --upgrade pip + + - name: Install Poetry + run: pip install poetry + + - name: Install project dependencies + run: poetry install -vvv --no-root + + - name: Run MyPy Against Source Code + run: poetry run poe run_mypy_src + + - name: Run Pyright Against Source Code + run: poetry run poe run_pyright_src + + - name: Run Pytest Against Source Code + run: poetry run poe run_pytest_src + + - name: Build Distribution + run: poetry run poe build_dist + + - name: Install Distribution + run: poetry run poe install_dist + + - name: Remove Source Code + run: poetry run poe remove_src + + - name: Run Pyright Against Distribution + run: poetry run poe run_pyright_dist + + - name: Run MyPy Against Distribution + run: poetry run poe run_mypy_dist \ No newline at end of file diff --git a/.gitignore b/.gitignore index b6e47617..175cf16f 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,5 @@ dmypy.json # Pyre type checker .pyre/ +/poetry.lock +.ideia \ No newline at end of file diff --git a/README.md b/README.md index e3c3326f..eb25d828 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,13 @@ This is the home for pandas typing stubs supported by the pandas core team. The To contribute changes to the stubs, you must include an appropriate test. See `pandas-stubs/tests` for examples. -## Build instructions +## Documentation -Use `python setup.py build bdist_wheel` to build the wheel. NOTE: `setuptools 62.3.2` is required! +- [How to set up the environment](docs/1%20-%20setup.md) +- [How to test the project](docs/2%20-%20tests.md) +- [How to follow the code style](docs/3%20-%20style.md) +- [Security stuffs](docs/4%20-%20security.md) +- [How to publish](docs/5%20-%20publish.md) ## Evolution diff --git a/docs/1 - setup.md b/docs/1 - setup.md new file mode 100644 index 00000000..a3cf2983 --- /dev/null +++ b/docs/1 - setup.md @@ -0,0 +1,8 @@ +## Set Up Environment + +- Make sure you have `python >= 3.8` installed.

+- Install poetry if you still don't have:
`pip install poetry`

+- Install the project dependencies with:
`poetry update -vvv`

+- Enter the virtual environment:
`poetry shell`

+- Run all tests to make sure the project is ok:
`poe test_all`

+- Do you want to add a new dependency?
`poetry add --dev foo-pkg `

diff --git a/docs/2 - tests.md b/docs/2 - tests.md new file mode 100644 index 00000000..c517bda5 --- /dev/null +++ b/docs/2 - tests.md @@ -0,0 +1,15 @@ +## Test + +- Run local tests against source code.
`poe test_src`

+ - Profiles:
+ - Default: Runs only mypy and pyright tests
`poe test_src --profile=default`
+ - Pytest: Runs only pytest
`poe test_src --profile=pytest`
+ - Full: Run all tests (mypy, pyright and pytests)
`poe test_src --profiel=full`

+ +- Run local tests against distribution:
`poe test_dist`

+ +- Run all local tests:
`poe test_all`

+ +- Forgot some command?
`poe --help`

+ +- These tests originally came from https://github.com/VirtusLab/pandas-stubs. \ No newline at end of file diff --git a/docs/3 - style.md b/docs/3 - style.md new file mode 100644 index 00000000..2b5c7f7c --- /dev/null +++ b/docs/3 - style.md @@ -0,0 +1,5 @@ +## Code style + +- It's important to follow the code style from the project: + - poetry run black pandas-stubs tests scripts + - poetry run isort pandas-stubs tests scripts \ No newline at end of file diff --git a/docs/4 - security.md b/docs/4 - security.md new file mode 100644 index 00000000..cfa26205 --- /dev/null +++ b/docs/4 - security.md @@ -0,0 +1,3 @@ +## Security + +- \ No newline at end of file diff --git a/docs/5 - publish.md b/docs/5 - publish.md new file mode 100644 index 00000000..7fa609f5 --- /dev/null +++ b/docs/5 - publish.md @@ -0,0 +1,3 @@ +## Publish + +You know ... just type "poetry publish pandas-stubs" \ No newline at end of file diff --git a/typings/pandas/__init__.pyi b/pandas-stubs/__init__.pyi similarity index 100% rename from typings/pandas/__init__.pyi rename to pandas-stubs/__init__.pyi diff --git a/typings/pandas/_config/__init__.pyi b/pandas-stubs/_config/__init__.pyi similarity index 100% rename from typings/pandas/_config/__init__.pyi rename to pandas-stubs/_config/__init__.pyi diff --git a/typings/pandas/_config/config.pyi b/pandas-stubs/_config/config.pyi similarity index 100% rename from typings/pandas/_config/config.pyi rename to pandas-stubs/_config/config.pyi diff --git a/typings/pandas/_libs/__init__.pyi b/pandas-stubs/_libs/__init__.pyi similarity index 100% rename from typings/pandas/_libs/__init__.pyi rename to pandas-stubs/_libs/__init__.pyi diff --git a/typings/pandas/_libs/interval.pyi b/pandas-stubs/_libs/interval.pyi similarity index 100% rename from typings/pandas/_libs/interval.pyi rename to pandas-stubs/_libs/interval.pyi diff --git a/typings/pandas/_libs/json.pyi b/pandas-stubs/_libs/json.pyi similarity index 100% rename from typings/pandas/_libs/json.pyi rename to pandas-stubs/_libs/json.pyi diff --git a/typings/pandas/_libs/missing.pyi b/pandas-stubs/_libs/missing.pyi similarity index 100% rename from typings/pandas/_libs/missing.pyi rename to pandas-stubs/_libs/missing.pyi diff --git a/typings/pandas/_libs/properties.pyi b/pandas-stubs/_libs/properties.pyi similarity index 100% rename from typings/pandas/_libs/properties.pyi rename to pandas-stubs/_libs/properties.pyi diff --git a/typings/pandas/_libs/tslibs/__init__.pyi b/pandas-stubs/_libs/tslibs/__init__.pyi similarity index 100% rename from typings/pandas/_libs/tslibs/__init__.pyi rename to pandas-stubs/_libs/tslibs/__init__.pyi diff --git a/typings/pandas/_libs/tslibs/nattype.pyi b/pandas-stubs/_libs/tslibs/nattype.pyi similarity index 100% rename from typings/pandas/_libs/tslibs/nattype.pyi rename to pandas-stubs/_libs/tslibs/nattype.pyi diff --git a/typings/pandas/_libs/tslibs/np_datetime.pyi b/pandas-stubs/_libs/tslibs/np_datetime.pyi similarity index 100% rename from typings/pandas/_libs/tslibs/np_datetime.pyi rename to pandas-stubs/_libs/tslibs/np_datetime.pyi diff --git a/typings/pandas/_libs/tslibs/offsets.pyi b/pandas-stubs/_libs/tslibs/offsets.pyi similarity index 100% rename from typings/pandas/_libs/tslibs/offsets.pyi rename to pandas-stubs/_libs/tslibs/offsets.pyi diff --git a/typings/pandas/_libs/tslibs/period.pyi b/pandas-stubs/_libs/tslibs/period.pyi similarity index 100% rename from typings/pandas/_libs/tslibs/period.pyi rename to pandas-stubs/_libs/tslibs/period.pyi diff --git a/typings/pandas/_libs/tslibs/timedeltas.pyi b/pandas-stubs/_libs/tslibs/timedeltas.pyi similarity index 100% rename from typings/pandas/_libs/tslibs/timedeltas.pyi rename to pandas-stubs/_libs/tslibs/timedeltas.pyi diff --git a/typings/pandas/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi similarity index 100% rename from typings/pandas/_libs/tslibs/timestamps.pyi rename to pandas-stubs/_libs/tslibs/timestamps.pyi diff --git a/typings/pandas/_testing/__init__.pyi b/pandas-stubs/_testing/__init__.pyi similarity index 100% rename from typings/pandas/_testing/__init__.pyi rename to pandas-stubs/_testing/__init__.pyi diff --git a/typings/pandas/_typing.pyi b/pandas-stubs/_typing.pyi similarity index 100% rename from typings/pandas/_typing.pyi rename to pandas-stubs/_typing.pyi diff --git a/typings/pandas/api/__init__.pyi b/pandas-stubs/api/__init__.pyi similarity index 100% rename from typings/pandas/api/__init__.pyi rename to pandas-stubs/api/__init__.pyi diff --git a/typings/pandas/api/extensions/__init__.pyi b/pandas-stubs/api/extensions/__init__.pyi similarity index 100% rename from typings/pandas/api/extensions/__init__.pyi rename to pandas-stubs/api/extensions/__init__.pyi diff --git a/typings/pandas/api/indexers/__init__.pyi b/pandas-stubs/api/indexers/__init__.pyi similarity index 100% rename from typings/pandas/api/indexers/__init__.pyi rename to pandas-stubs/api/indexers/__init__.pyi diff --git a/typings/pandas/api/types/__init__.pyi b/pandas-stubs/api/types/__init__.pyi similarity index 100% rename from typings/pandas/api/types/__init__.pyi rename to pandas-stubs/api/types/__init__.pyi diff --git a/typings/pandas/compat/__init__.pyi b/pandas-stubs/compat/__init__.pyi similarity index 100% rename from typings/pandas/compat/__init__.pyi rename to pandas-stubs/compat/__init__.pyi diff --git a/typings/pandas/compat/_optional.pyi b/pandas-stubs/compat/_optional.pyi similarity index 100% rename from typings/pandas/compat/_optional.pyi rename to pandas-stubs/compat/_optional.pyi diff --git a/typings/pandas/compat/numpy/__init__.pyi b/pandas-stubs/compat/numpy/__init__.pyi similarity index 100% rename from typings/pandas/compat/numpy/__init__.pyi rename to pandas-stubs/compat/numpy/__init__.pyi diff --git a/typings/pandas/compat/pickle_compat.pyi b/pandas-stubs/compat/pickle_compat.pyi similarity index 100% rename from typings/pandas/compat/pickle_compat.pyi rename to pandas-stubs/compat/pickle_compat.pyi diff --git a/typings/pandas/core/__init__.pyi b/pandas-stubs/core/__init__.pyi similarity index 100% rename from typings/pandas/core/__init__.pyi rename to pandas-stubs/core/__init__.pyi diff --git a/typings/pandas/core/accessor.pyi b/pandas-stubs/core/accessor.pyi similarity index 100% rename from typings/pandas/core/accessor.pyi rename to pandas-stubs/core/accessor.pyi diff --git a/typings/pandas/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi similarity index 100% rename from typings/pandas/core/algorithms.pyi rename to pandas-stubs/core/algorithms.pyi diff --git a/typings/pandas/core/api.pyi b/pandas-stubs/core/api.pyi similarity index 100% rename from typings/pandas/core/api.pyi rename to pandas-stubs/core/api.pyi diff --git a/typings/pandas/core/arraylike.pyi b/pandas-stubs/core/arraylike.pyi similarity index 100% rename from typings/pandas/core/arraylike.pyi rename to pandas-stubs/core/arraylike.pyi diff --git a/typings/pandas/core/arrays/__init__.pyi b/pandas-stubs/core/arrays/__init__.pyi similarity index 100% rename from typings/pandas/core/arrays/__init__.pyi rename to pandas-stubs/core/arrays/__init__.pyi diff --git a/typings/pandas/core/arrays/_arrow_utils.pyi b/pandas-stubs/core/arrays/_arrow_utils.pyi similarity index 100% rename from typings/pandas/core/arrays/_arrow_utils.pyi rename to pandas-stubs/core/arrays/_arrow_utils.pyi diff --git a/typings/pandas/core/arrays/_ranges.pyi b/pandas-stubs/core/arrays/_ranges.pyi similarity index 100% rename from typings/pandas/core/arrays/_ranges.pyi rename to pandas-stubs/core/arrays/_ranges.pyi diff --git a/typings/pandas/core/arrays/base.pyi b/pandas-stubs/core/arrays/base.pyi similarity index 100% rename from typings/pandas/core/arrays/base.pyi rename to pandas-stubs/core/arrays/base.pyi diff --git a/typings/pandas/core/arrays/boolean.pyi b/pandas-stubs/core/arrays/boolean.pyi similarity index 100% rename from typings/pandas/core/arrays/boolean.pyi rename to pandas-stubs/core/arrays/boolean.pyi diff --git a/typings/pandas/core/arrays/categorical.pyi b/pandas-stubs/core/arrays/categorical.pyi similarity index 100% rename from typings/pandas/core/arrays/categorical.pyi rename to pandas-stubs/core/arrays/categorical.pyi diff --git a/typings/pandas/core/arrays/datetimelike.pyi b/pandas-stubs/core/arrays/datetimelike.pyi similarity index 100% rename from typings/pandas/core/arrays/datetimelike.pyi rename to pandas-stubs/core/arrays/datetimelike.pyi diff --git a/typings/pandas/core/arrays/datetimes.pyi b/pandas-stubs/core/arrays/datetimes.pyi similarity index 100% rename from typings/pandas/core/arrays/datetimes.pyi rename to pandas-stubs/core/arrays/datetimes.pyi diff --git a/typings/pandas/core/arrays/integer.pyi b/pandas-stubs/core/arrays/integer.pyi similarity index 100% rename from typings/pandas/core/arrays/integer.pyi rename to pandas-stubs/core/arrays/integer.pyi diff --git a/typings/pandas/core/arrays/interval.pyi b/pandas-stubs/core/arrays/interval.pyi similarity index 100% rename from typings/pandas/core/arrays/interval.pyi rename to pandas-stubs/core/arrays/interval.pyi diff --git a/typings/pandas/core/arrays/masked.pyi b/pandas-stubs/core/arrays/masked.pyi similarity index 100% rename from typings/pandas/core/arrays/masked.pyi rename to pandas-stubs/core/arrays/masked.pyi diff --git a/typings/pandas/core/arrays/numpy_.pyi b/pandas-stubs/core/arrays/numpy_.pyi similarity index 100% rename from typings/pandas/core/arrays/numpy_.pyi rename to pandas-stubs/core/arrays/numpy_.pyi diff --git a/typings/pandas/core/arrays/period.pyi b/pandas-stubs/core/arrays/period.pyi similarity index 100% rename from typings/pandas/core/arrays/period.pyi rename to pandas-stubs/core/arrays/period.pyi diff --git a/typings/pandas/core/arrays/sparse/__init__.pyi b/pandas-stubs/core/arrays/sparse/__init__.pyi similarity index 100% rename from typings/pandas/core/arrays/sparse/__init__.pyi rename to pandas-stubs/core/arrays/sparse/__init__.pyi diff --git a/typings/pandas/core/arrays/sparse/accessor.pyi b/pandas-stubs/core/arrays/sparse/accessor.pyi similarity index 100% rename from typings/pandas/core/arrays/sparse/accessor.pyi rename to pandas-stubs/core/arrays/sparse/accessor.pyi diff --git a/typings/pandas/core/arrays/sparse/array.pyi b/pandas-stubs/core/arrays/sparse/array.pyi similarity index 100% rename from typings/pandas/core/arrays/sparse/array.pyi rename to pandas-stubs/core/arrays/sparse/array.pyi diff --git a/typings/pandas/core/arrays/sparse/dtype.pyi b/pandas-stubs/core/arrays/sparse/dtype.pyi similarity index 100% rename from typings/pandas/core/arrays/sparse/dtype.pyi rename to pandas-stubs/core/arrays/sparse/dtype.pyi diff --git a/typings/pandas/core/arrays/sparse/scipy_sparse.pyi b/pandas-stubs/core/arrays/sparse/scipy_sparse.pyi similarity index 100% rename from typings/pandas/core/arrays/sparse/scipy_sparse.pyi rename to pandas-stubs/core/arrays/sparse/scipy_sparse.pyi diff --git a/typings/pandas/core/arrays/string_.pyi b/pandas-stubs/core/arrays/string_.pyi similarity index 100% rename from typings/pandas/core/arrays/string_.pyi rename to pandas-stubs/core/arrays/string_.pyi diff --git a/typings/pandas/core/arrays/timedeltas.pyi b/pandas-stubs/core/arrays/timedeltas.pyi similarity index 100% rename from typings/pandas/core/arrays/timedeltas.pyi rename to pandas-stubs/core/arrays/timedeltas.pyi diff --git a/typings/pandas/core/base.pyi b/pandas-stubs/core/base.pyi similarity index 100% rename from typings/pandas/core/base.pyi rename to pandas-stubs/core/base.pyi diff --git a/typings/pandas/core/computation/__init__.pyi b/pandas-stubs/core/computation/__init__.pyi similarity index 100% rename from typings/pandas/core/computation/__init__.pyi rename to pandas-stubs/core/computation/__init__.pyi diff --git a/typings/pandas/core/computation/align.pyi b/pandas-stubs/core/computation/align.pyi similarity index 100% rename from typings/pandas/core/computation/align.pyi rename to pandas-stubs/core/computation/align.pyi diff --git a/typings/pandas/core/computation/api.pyi b/pandas-stubs/core/computation/api.pyi similarity index 100% rename from typings/pandas/core/computation/api.pyi rename to pandas-stubs/core/computation/api.pyi diff --git a/typings/pandas/core/computation/common.pyi b/pandas-stubs/core/computation/common.pyi similarity index 100% rename from typings/pandas/core/computation/common.pyi rename to pandas-stubs/core/computation/common.pyi diff --git a/typings/pandas/core/computation/engines.pyi b/pandas-stubs/core/computation/engines.pyi similarity index 100% rename from typings/pandas/core/computation/engines.pyi rename to pandas-stubs/core/computation/engines.pyi diff --git a/typings/pandas/core/computation/expressions.pyi b/pandas-stubs/core/computation/expressions.pyi similarity index 100% rename from typings/pandas/core/computation/expressions.pyi rename to pandas-stubs/core/computation/expressions.pyi diff --git a/typings/pandas/core/computation/parsing.pyi b/pandas-stubs/core/computation/parsing.pyi similarity index 100% rename from typings/pandas/core/computation/parsing.pyi rename to pandas-stubs/core/computation/parsing.pyi diff --git a/typings/pandas/core/config_init.pyi b/pandas-stubs/core/config_init.pyi similarity index 100% rename from typings/pandas/core/config_init.pyi rename to pandas-stubs/core/config_init.pyi diff --git a/typings/pandas/core/dtypes/__init__.pyi b/pandas-stubs/core/dtypes/__init__.pyi similarity index 100% rename from typings/pandas/core/dtypes/__init__.pyi rename to pandas-stubs/core/dtypes/__init__.pyi diff --git a/typings/pandas/core/dtypes/api.pyi b/pandas-stubs/core/dtypes/api.pyi similarity index 100% rename from typings/pandas/core/dtypes/api.pyi rename to pandas-stubs/core/dtypes/api.pyi diff --git a/typings/pandas/core/dtypes/base.pyi b/pandas-stubs/core/dtypes/base.pyi similarity index 100% rename from typings/pandas/core/dtypes/base.pyi rename to pandas-stubs/core/dtypes/base.pyi diff --git a/typings/pandas/core/dtypes/cast.pyi b/pandas-stubs/core/dtypes/cast.pyi similarity index 100% rename from typings/pandas/core/dtypes/cast.pyi rename to pandas-stubs/core/dtypes/cast.pyi diff --git a/typings/pandas/core/dtypes/common.pyi b/pandas-stubs/core/dtypes/common.pyi similarity index 100% rename from typings/pandas/core/dtypes/common.pyi rename to pandas-stubs/core/dtypes/common.pyi diff --git a/typings/pandas/core/dtypes/concat.pyi b/pandas-stubs/core/dtypes/concat.pyi similarity index 100% rename from typings/pandas/core/dtypes/concat.pyi rename to pandas-stubs/core/dtypes/concat.pyi diff --git a/typings/pandas/core/dtypes/dtypes.pyi b/pandas-stubs/core/dtypes/dtypes.pyi similarity index 100% rename from typings/pandas/core/dtypes/dtypes.pyi rename to pandas-stubs/core/dtypes/dtypes.pyi diff --git a/typings/pandas/core/dtypes/generic.pyi b/pandas-stubs/core/dtypes/generic.pyi similarity index 100% rename from typings/pandas/core/dtypes/generic.pyi rename to pandas-stubs/core/dtypes/generic.pyi diff --git a/typings/pandas/core/dtypes/inference.pyi b/pandas-stubs/core/dtypes/inference.pyi similarity index 100% rename from typings/pandas/core/dtypes/inference.pyi rename to pandas-stubs/core/dtypes/inference.pyi diff --git a/typings/pandas/core/dtypes/missing.pyi b/pandas-stubs/core/dtypes/missing.pyi similarity index 100% rename from typings/pandas/core/dtypes/missing.pyi rename to pandas-stubs/core/dtypes/missing.pyi diff --git a/typings/pandas/core/frame.pyi b/pandas-stubs/core/frame.pyi similarity index 100% rename from typings/pandas/core/frame.pyi rename to pandas-stubs/core/frame.pyi diff --git a/typings/pandas/core/generic.pyi b/pandas-stubs/core/generic.pyi similarity index 100% rename from typings/pandas/core/generic.pyi rename to pandas-stubs/core/generic.pyi diff --git a/typings/pandas/core/groupby/__init__.pyi b/pandas-stubs/core/groupby/__init__.pyi similarity index 100% rename from typings/pandas/core/groupby/__init__.pyi rename to pandas-stubs/core/groupby/__init__.pyi diff --git a/typings/pandas/core/groupby/base.pyi b/pandas-stubs/core/groupby/base.pyi similarity index 100% rename from typings/pandas/core/groupby/base.pyi rename to pandas-stubs/core/groupby/base.pyi diff --git a/typings/pandas/core/groupby/categorical.pyi b/pandas-stubs/core/groupby/categorical.pyi similarity index 100% rename from typings/pandas/core/groupby/categorical.pyi rename to pandas-stubs/core/groupby/categorical.pyi diff --git a/typings/pandas/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi similarity index 100% rename from typings/pandas/core/groupby/generic.pyi rename to pandas-stubs/core/groupby/generic.pyi diff --git a/typings/pandas/core/groupby/groupby.pyi b/pandas-stubs/core/groupby/groupby.pyi similarity index 100% rename from typings/pandas/core/groupby/groupby.pyi rename to pandas-stubs/core/groupby/groupby.pyi diff --git a/typings/pandas/core/groupby/grouper.pyi b/pandas-stubs/core/groupby/grouper.pyi similarity index 100% rename from typings/pandas/core/groupby/grouper.pyi rename to pandas-stubs/core/groupby/grouper.pyi diff --git a/typings/pandas/core/groupby/ops.pyi b/pandas-stubs/core/groupby/ops.pyi similarity index 100% rename from typings/pandas/core/groupby/ops.pyi rename to pandas-stubs/core/groupby/ops.pyi diff --git a/typings/pandas/core/indexes/__init__.pyi b/pandas-stubs/core/indexes/__init__.pyi similarity index 100% rename from typings/pandas/core/indexes/__init__.pyi rename to pandas-stubs/core/indexes/__init__.pyi diff --git a/typings/pandas/core/indexes/accessors.pyi b/pandas-stubs/core/indexes/accessors.pyi similarity index 100% rename from typings/pandas/core/indexes/accessors.pyi rename to pandas-stubs/core/indexes/accessors.pyi diff --git a/typings/pandas/core/indexes/api.pyi b/pandas-stubs/core/indexes/api.pyi similarity index 100% rename from typings/pandas/core/indexes/api.pyi rename to pandas-stubs/core/indexes/api.pyi diff --git a/typings/pandas/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi similarity index 100% rename from typings/pandas/core/indexes/base.pyi rename to pandas-stubs/core/indexes/base.pyi diff --git a/typings/pandas/core/indexes/datetimelike.pyi b/pandas-stubs/core/indexes/datetimelike.pyi similarity index 100% rename from typings/pandas/core/indexes/datetimelike.pyi rename to pandas-stubs/core/indexes/datetimelike.pyi diff --git a/typings/pandas/core/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi similarity index 100% rename from typings/pandas/core/indexes/datetimes.pyi rename to pandas-stubs/core/indexes/datetimes.pyi diff --git a/typings/pandas/core/indexes/extension.pyi b/pandas-stubs/core/indexes/extension.pyi similarity index 100% rename from typings/pandas/core/indexes/extension.pyi rename to pandas-stubs/core/indexes/extension.pyi diff --git a/typings/pandas/core/indexes/frozen.pyi b/pandas-stubs/core/indexes/frozen.pyi similarity index 100% rename from typings/pandas/core/indexes/frozen.pyi rename to pandas-stubs/core/indexes/frozen.pyi diff --git a/typings/pandas/core/indexes/interval.pyi b/pandas-stubs/core/indexes/interval.pyi similarity index 100% rename from typings/pandas/core/indexes/interval.pyi rename to pandas-stubs/core/indexes/interval.pyi diff --git a/typings/pandas/core/indexes/multi.pyi b/pandas-stubs/core/indexes/multi.pyi similarity index 100% rename from typings/pandas/core/indexes/multi.pyi rename to pandas-stubs/core/indexes/multi.pyi diff --git a/typings/pandas/core/indexes/numeric.pyi b/pandas-stubs/core/indexes/numeric.pyi similarity index 100% rename from typings/pandas/core/indexes/numeric.pyi rename to pandas-stubs/core/indexes/numeric.pyi diff --git a/typings/pandas/core/indexes/timedeltas.pyi b/pandas-stubs/core/indexes/timedeltas.pyi similarity index 100% rename from typings/pandas/core/indexes/timedeltas.pyi rename to pandas-stubs/core/indexes/timedeltas.pyi diff --git a/typings/pandas/core/indexing.pyi b/pandas-stubs/core/indexing.pyi similarity index 100% rename from typings/pandas/core/indexing.pyi rename to pandas-stubs/core/indexing.pyi diff --git a/typings/pandas/core/internals/__init__.pyi b/pandas-stubs/core/internals/__init__.pyi similarity index 100% rename from typings/pandas/core/internals/__init__.pyi rename to pandas-stubs/core/internals/__init__.pyi diff --git a/typings/pandas/core/internals/blocks.pyi b/pandas-stubs/core/internals/blocks.pyi similarity index 100% rename from typings/pandas/core/internals/blocks.pyi rename to pandas-stubs/core/internals/blocks.pyi diff --git a/typings/pandas/core/internals/concat.pyi b/pandas-stubs/core/internals/concat.pyi similarity index 100% rename from typings/pandas/core/internals/concat.pyi rename to pandas-stubs/core/internals/concat.pyi diff --git a/typings/pandas/core/internals/construction.pyi b/pandas-stubs/core/internals/construction.pyi similarity index 100% rename from typings/pandas/core/internals/construction.pyi rename to pandas-stubs/core/internals/construction.pyi diff --git a/typings/pandas/core/internals/managers.pyi b/pandas-stubs/core/internals/managers.pyi similarity index 100% rename from typings/pandas/core/internals/managers.pyi rename to pandas-stubs/core/internals/managers.pyi diff --git a/typings/pandas/core/ops/__init__.pyi b/pandas-stubs/core/ops/__init__.pyi similarity index 100% rename from typings/pandas/core/ops/__init__.pyi rename to pandas-stubs/core/ops/__init__.pyi diff --git a/typings/pandas/core/ops/array_ops.pyi b/pandas-stubs/core/ops/array_ops.pyi similarity index 100% rename from typings/pandas/core/ops/array_ops.pyi rename to pandas-stubs/core/ops/array_ops.pyi diff --git a/typings/pandas/core/ops/dispatch.pyi b/pandas-stubs/core/ops/dispatch.pyi similarity index 100% rename from typings/pandas/core/ops/dispatch.pyi rename to pandas-stubs/core/ops/dispatch.pyi diff --git a/typings/pandas/core/ops/docstrings.pyi b/pandas-stubs/core/ops/docstrings.pyi similarity index 100% rename from typings/pandas/core/ops/docstrings.pyi rename to pandas-stubs/core/ops/docstrings.pyi diff --git a/typings/pandas/core/ops/invalid.pyi b/pandas-stubs/core/ops/invalid.pyi similarity index 100% rename from typings/pandas/core/ops/invalid.pyi rename to pandas-stubs/core/ops/invalid.pyi diff --git a/typings/pandas/core/ops/mask_ops.pyi b/pandas-stubs/core/ops/mask_ops.pyi similarity index 100% rename from typings/pandas/core/ops/mask_ops.pyi rename to pandas-stubs/core/ops/mask_ops.pyi diff --git a/typings/pandas/core/ops/methods.pyi b/pandas-stubs/core/ops/methods.pyi similarity index 100% rename from typings/pandas/core/ops/methods.pyi rename to pandas-stubs/core/ops/methods.pyi diff --git a/typings/pandas/core/ops/missing.pyi b/pandas-stubs/core/ops/missing.pyi similarity index 100% rename from typings/pandas/core/ops/missing.pyi rename to pandas-stubs/core/ops/missing.pyi diff --git a/typings/pandas/core/ops/roperator.pyi b/pandas-stubs/core/ops/roperator.pyi similarity index 100% rename from typings/pandas/core/ops/roperator.pyi rename to pandas-stubs/core/ops/roperator.pyi diff --git a/typings/pandas/core/resample.pyi b/pandas-stubs/core/resample.pyi similarity index 100% rename from typings/pandas/core/resample.pyi rename to pandas-stubs/core/resample.pyi diff --git a/typings/pandas/core/reshape/__init__.pyi b/pandas-stubs/core/reshape/__init__.pyi similarity index 100% rename from typings/pandas/core/reshape/__init__.pyi rename to pandas-stubs/core/reshape/__init__.pyi diff --git a/typings/pandas/core/reshape/api.pyi b/pandas-stubs/core/reshape/api.pyi similarity index 100% rename from typings/pandas/core/reshape/api.pyi rename to pandas-stubs/core/reshape/api.pyi diff --git a/typings/pandas/core/reshape/concat.pyi b/pandas-stubs/core/reshape/concat.pyi similarity index 100% rename from typings/pandas/core/reshape/concat.pyi rename to pandas-stubs/core/reshape/concat.pyi diff --git a/typings/pandas/core/reshape/melt.pyi b/pandas-stubs/core/reshape/melt.pyi similarity index 100% rename from typings/pandas/core/reshape/melt.pyi rename to pandas-stubs/core/reshape/melt.pyi diff --git a/typings/pandas/core/reshape/merge.pyi b/pandas-stubs/core/reshape/merge.pyi similarity index 100% rename from typings/pandas/core/reshape/merge.pyi rename to pandas-stubs/core/reshape/merge.pyi diff --git a/typings/pandas/core/reshape/pivot.pyi b/pandas-stubs/core/reshape/pivot.pyi similarity index 100% rename from typings/pandas/core/reshape/pivot.pyi rename to pandas-stubs/core/reshape/pivot.pyi diff --git a/typings/pandas/core/reshape/util.pyi b/pandas-stubs/core/reshape/util.pyi similarity index 100% rename from typings/pandas/core/reshape/util.pyi rename to pandas-stubs/core/reshape/util.pyi diff --git a/typings/pandas/core/series.pyi b/pandas-stubs/core/series.pyi similarity index 100% rename from typings/pandas/core/series.pyi rename to pandas-stubs/core/series.pyi diff --git a/typings/pandas/core/sorting.pyi b/pandas-stubs/core/sorting.pyi similarity index 100% rename from typings/pandas/core/sorting.pyi rename to pandas-stubs/core/sorting.pyi diff --git a/typings/pandas/core/strings.pyi b/pandas-stubs/core/strings.pyi similarity index 100% rename from typings/pandas/core/strings.pyi rename to pandas-stubs/core/strings.pyi diff --git a/typings/pandas/core/tools/__init__.pyi b/pandas-stubs/core/tools/__init__.pyi similarity index 100% rename from typings/pandas/core/tools/__init__.pyi rename to pandas-stubs/core/tools/__init__.pyi diff --git a/typings/pandas/core/tools/datetimes.pyi b/pandas-stubs/core/tools/datetimes.pyi similarity index 100% rename from typings/pandas/core/tools/datetimes.pyi rename to pandas-stubs/core/tools/datetimes.pyi diff --git a/typings/pandas/core/tools/numeric.pyi b/pandas-stubs/core/tools/numeric.pyi similarity index 100% rename from typings/pandas/core/tools/numeric.pyi rename to pandas-stubs/core/tools/numeric.pyi diff --git a/typings/pandas/core/tools/timedeltas.pyi b/pandas-stubs/core/tools/timedeltas.pyi similarity index 100% rename from typings/pandas/core/tools/timedeltas.pyi rename to pandas-stubs/core/tools/timedeltas.pyi diff --git a/typings/pandas/core/window/__init__.pyi b/pandas-stubs/core/window/__init__.pyi similarity index 100% rename from typings/pandas/core/window/__init__.pyi rename to pandas-stubs/core/window/__init__.pyi diff --git a/typings/pandas/core/window/common.pyi b/pandas-stubs/core/window/common.pyi similarity index 100% rename from typings/pandas/core/window/common.pyi rename to pandas-stubs/core/window/common.pyi diff --git a/typings/pandas/core/window/ewm.pyi b/pandas-stubs/core/window/ewm.pyi similarity index 100% rename from typings/pandas/core/window/ewm.pyi rename to pandas-stubs/core/window/ewm.pyi diff --git a/typings/pandas/core/window/expanding.pyi b/pandas-stubs/core/window/expanding.pyi similarity index 100% rename from typings/pandas/core/window/expanding.pyi rename to pandas-stubs/core/window/expanding.pyi diff --git a/typings/pandas/core/window/indexers.pyi b/pandas-stubs/core/window/indexers.pyi similarity index 100% rename from typings/pandas/core/window/indexers.pyi rename to pandas-stubs/core/window/indexers.pyi diff --git a/typings/pandas/core/window/numba_.pyi b/pandas-stubs/core/window/numba_.pyi similarity index 100% rename from typings/pandas/core/window/numba_.pyi rename to pandas-stubs/core/window/numba_.pyi diff --git a/typings/pandas/core/window/rolling.pyi b/pandas-stubs/core/window/rolling.pyi similarity index 100% rename from typings/pandas/core/window/rolling.pyi rename to pandas-stubs/core/window/rolling.pyi diff --git a/typings/pandas/io/__init__.pyi b/pandas-stubs/io/__init__.pyi similarity index 100% rename from typings/pandas/io/__init__.pyi rename to pandas-stubs/io/__init__.pyi diff --git a/typings/pandas/io/api.pyi b/pandas-stubs/io/api.pyi similarity index 100% rename from typings/pandas/io/api.pyi rename to pandas-stubs/io/api.pyi diff --git a/typings/pandas/io/excel/_base.pyi b/pandas-stubs/io/excel/_base.pyi similarity index 100% rename from typings/pandas/io/excel/_base.pyi rename to pandas-stubs/io/excel/_base.pyi diff --git a/typings/pandas/io/gcs.pyi b/pandas-stubs/io/gcs.pyi similarity index 100% rename from typings/pandas/io/gcs.pyi rename to pandas-stubs/io/gcs.pyi diff --git a/typings/pandas/io/json/__init__.pyi b/pandas-stubs/io/json/__init__.pyi similarity index 100% rename from typings/pandas/io/json/__init__.pyi rename to pandas-stubs/io/json/__init__.pyi diff --git a/typings/pandas/io/json/_json.pyi b/pandas-stubs/io/json/_json.pyi similarity index 100% rename from typings/pandas/io/json/_json.pyi rename to pandas-stubs/io/json/_json.pyi diff --git a/typings/pandas/io/json/_normalize.pyi b/pandas-stubs/io/json/_normalize.pyi similarity index 100% rename from typings/pandas/io/json/_normalize.pyi rename to pandas-stubs/io/json/_normalize.pyi diff --git a/typings/pandas/io/json/_table_schema.pyi b/pandas-stubs/io/json/_table_schema.pyi similarity index 100% rename from typings/pandas/io/json/_table_schema.pyi rename to pandas-stubs/io/json/_table_schema.pyi diff --git a/typings/pandas/io/parsers.pyi b/pandas-stubs/io/parsers.pyi similarity index 100% rename from typings/pandas/io/parsers.pyi rename to pandas-stubs/io/parsers.pyi diff --git a/typings/pandas/io/s3.pyi b/pandas-stubs/io/s3.pyi similarity index 100% rename from typings/pandas/io/s3.pyi rename to pandas-stubs/io/s3.pyi diff --git a/typings/pandas/io/sas/sas_constants.pyi b/pandas-stubs/io/sas/sas_constants.pyi similarity index 100% rename from typings/pandas/io/sas/sas_constants.pyi rename to pandas-stubs/io/sas/sas_constants.pyi diff --git a/typings/pandas/io/stata.pyi b/pandas-stubs/io/stata.pyi similarity index 100% rename from typings/pandas/io/stata.pyi rename to pandas-stubs/io/stata.pyi diff --git a/typings/pandas/plotting/__init__.pyi b/pandas-stubs/plotting/__init__.pyi similarity index 100% rename from typings/pandas/plotting/__init__.pyi rename to pandas-stubs/plotting/__init__.pyi diff --git a/typings/pandas/plotting/_core.pyi b/pandas-stubs/plotting/_core.pyi similarity index 100% rename from typings/pandas/plotting/_core.pyi rename to pandas-stubs/plotting/_core.pyi diff --git a/typings/pandas/plotting/_matplotlib/__init__.pyi b/pandas-stubs/plotting/_matplotlib/__init__.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/__init__.pyi rename to pandas-stubs/plotting/_matplotlib/__init__.pyi diff --git a/typings/pandas/plotting/_matplotlib/boxplot.pyi b/pandas-stubs/plotting/_matplotlib/boxplot.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/boxplot.pyi rename to pandas-stubs/plotting/_matplotlib/boxplot.pyi diff --git a/typings/pandas/plotting/_matplotlib/compat.pyi b/pandas-stubs/plotting/_matplotlib/compat.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/compat.pyi rename to pandas-stubs/plotting/_matplotlib/compat.pyi diff --git a/typings/pandas/plotting/_matplotlib/converter.pyi b/pandas-stubs/plotting/_matplotlib/converter.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/converter.pyi rename to pandas-stubs/plotting/_matplotlib/converter.pyi diff --git a/typings/pandas/plotting/_matplotlib/core.pyi b/pandas-stubs/plotting/_matplotlib/core.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/core.pyi rename to pandas-stubs/plotting/_matplotlib/core.pyi diff --git a/typings/pandas/plotting/_matplotlib/hist.pyi b/pandas-stubs/plotting/_matplotlib/hist.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/hist.pyi rename to pandas-stubs/plotting/_matplotlib/hist.pyi diff --git a/typings/pandas/plotting/_matplotlib/misc.pyi b/pandas-stubs/plotting/_matplotlib/misc.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/misc.pyi rename to pandas-stubs/plotting/_matplotlib/misc.pyi diff --git a/typings/pandas/plotting/_matplotlib/style.pyi b/pandas-stubs/plotting/_matplotlib/style.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/style.pyi rename to pandas-stubs/plotting/_matplotlib/style.pyi diff --git a/typings/pandas/plotting/_matplotlib/timeseries.pyi b/pandas-stubs/plotting/_matplotlib/timeseries.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/timeseries.pyi rename to pandas-stubs/plotting/_matplotlib/timeseries.pyi diff --git a/typings/pandas/plotting/_matplotlib/tools.pyi b/pandas-stubs/plotting/_matplotlib/tools.pyi similarity index 100% rename from typings/pandas/plotting/_matplotlib/tools.pyi rename to pandas-stubs/plotting/_matplotlib/tools.pyi diff --git a/typings/pandas/plotting/_misc.pyi b/pandas-stubs/plotting/_misc.pyi similarity index 100% rename from typings/pandas/plotting/_misc.pyi rename to pandas-stubs/plotting/_misc.pyi diff --git a/typings/pandas/testing.pyi b/pandas-stubs/testing.pyi similarity index 100% rename from typings/pandas/testing.pyi rename to pandas-stubs/testing.pyi diff --git a/typings/pandas/tseries/__init__.pyi b/pandas-stubs/tseries/__init__.pyi similarity index 100% rename from typings/pandas/tseries/__init__.pyi rename to pandas-stubs/tseries/__init__.pyi diff --git a/typings/pandas/tseries/api.pyi b/pandas-stubs/tseries/api.pyi similarity index 100% rename from typings/pandas/tseries/api.pyi rename to pandas-stubs/tseries/api.pyi diff --git a/typings/pandas/tseries/frequencies.pyi b/pandas-stubs/tseries/frequencies.pyi similarity index 100% rename from typings/pandas/tseries/frequencies.pyi rename to pandas-stubs/tseries/frequencies.pyi diff --git a/typings/pandas/tseries/offsets.pyi b/pandas-stubs/tseries/offsets.pyi similarity index 100% rename from typings/pandas/tseries/offsets.pyi rename to pandas-stubs/tseries/offsets.pyi diff --git a/typings/pandas/util/__init__.pyi b/pandas-stubs/util/__init__.pyi similarity index 100% rename from typings/pandas/util/__init__.pyi rename to pandas-stubs/util/__init__.pyi diff --git a/typings/pandas/util/_decorators.pyi b/pandas-stubs/util/_decorators.pyi similarity index 100% rename from typings/pandas/util/_decorators.pyi rename to pandas-stubs/util/_decorators.pyi diff --git a/typings/pandas/util/_depr_module.pyi b/pandas-stubs/util/_depr_module.pyi similarity index 100% rename from typings/pandas/util/_depr_module.pyi rename to pandas-stubs/util/_depr_module.pyi diff --git a/typings/pandas/util/_doctools.pyi b/pandas-stubs/util/_doctools.pyi similarity index 100% rename from typings/pandas/util/_doctools.pyi rename to pandas-stubs/util/_doctools.pyi diff --git a/typings/pandas/util/_exceptions.pyi b/pandas-stubs/util/_exceptions.pyi similarity index 100% rename from typings/pandas/util/_exceptions.pyi rename to pandas-stubs/util/_exceptions.pyi diff --git a/typings/pandas/util/_print_versions.pyi b/pandas-stubs/util/_print_versions.pyi similarity index 100% rename from typings/pandas/util/_print_versions.pyi rename to pandas-stubs/util/_print_versions.pyi diff --git a/typings/pandas/util/_test_decorators.pyi b/pandas-stubs/util/_test_decorators.pyi similarity index 100% rename from typings/pandas/util/_test_decorators.pyi rename to pandas-stubs/util/_test_decorators.pyi diff --git a/typings/pandas/util/_tester.pyi b/pandas-stubs/util/_tester.pyi similarity index 100% rename from typings/pandas/util/_tester.pyi rename to pandas-stubs/util/_tester.pyi diff --git a/typings/pandas/util/_validators.pyi b/pandas-stubs/util/_validators.pyi similarity index 100% rename from typings/pandas/util/_validators.pyi rename to pandas-stubs/util/_validators.pyi diff --git a/pyproject.toml b/pyproject.toml index fdb5f50b..64bcb193 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,126 @@ +[tool.poetry] +name = "pandas-stubs" +version = "1.4.2.220608" +description = "Type annotations for pandas" +authors = ["The Pandas Development Team "] +license = "BSD-3-Clause" +readme = "README.md" +homepage = "https://pandas.pydata.org" +repository = "https://github.com/pandas-dev/pandas-stubs" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Scientific/Engineering" +] +packages = [ + { "include" = "pandas-stubs"} +] + +[tool.poetry.urls] +"Bug Tracker" = "https://github.com/pandas-dev/pandas-stubs/issues" +"Documentation" = "https://pandas.pydata.org/pandas-docs/stable" +"Source Code" = "https://github.com/pandas-dev/pandas-stubs" + +[tool.poetry.dependencies] +python = ">=3.8,<3.11" +pandas = "1.4.2" +typing-extensions = ">=4.2.0" +matplotlib = ">=3.3.2" + +[tool.poetry.dev-dependencies] +mypy = ">=0.960" +pytest = ">=7.1.2" +pyright = ">=1.1.251" +black = ">=22.3.0" +isort = ">=5.10.1" +poethepoet = ">=0.13.1" +loguru = ">=0.6.0" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poe.tasks.check_style] +help = "Local Code Style Check" +script = "scripts.style:check_style" + +[tool.poe.tasks.test_src] +help = "LOCAL Test | Run tests against source code version: \"poe test_src -p=\"" +script = "scripts.test:test_src(profile, clean_cache)" + + [[tool.poe.tasks.test_src.args]] + help = "\"default\" (mypy + pyright) or \"pytest\" (pytest only) or \"full\" (mypy + pyright + pytest)" + name = "profile" + options = ["-p", "--profile"] + default = "default" + + [[tool.poe.tasks.test_src.args]] + help = "remove mypy and pytest cache folders" + name = "clean-cache" + options = ["-c", "--clean_cache"] + default = false + +[tool.poe.tasks.test_dist] +help = "Local Test | Run tests against distribuition version: \"poe test_dist\"" +script = "scripts.test:test_dist(clean_cache)" + + [[tool.poe.tasks.test_dist.args]] + help = "remove mypy and pytest cache folders" + name = "clean-cache" + options = ["-c", "--clean_cache"] + default = false + +[tool.poe.tasks.test_all] +help = "Local Test | Run tests against source code and distribuition version: \"poe test_all\"" +script = "scripts.test:test_all(clean_cache)" + + [[tool.poe.tasks.test_all.args]] + help = "remove mypy and pytest cache folders" + name = "clean-cache" + options = ["-c", "--clean_cache"] + default = false + +[tool.poe.tasks.run_mypy_src] +help = "CI Test | Run mypy against source code" +script = "scripts.test.procedures:run_mypy_src" + +[tool.poe.tasks.run_pyright_src] +help = "CI Test | Run pyright against source code" +script = "scripts.test.procedures:run_pyright_src" + +[tool.poe.tasks.run_pytest_src] +help = "CI Test | Run pytest against source code" +script = "scripts.test.procedures:run_pytest_src" + +[tool.poe.tasks.build_dist] +help = "CI Test | Build distribuition" +script = "scripts.test.procedures:build_dist" + +[tool.poe.tasks.install_dist] +help = "CI Test | Install distribuition" +script = "scripts.test.procedures:install_dist" + +[tool.poe.tasks.remove_src] +help = "CI Test | Remove source code" +script = "scripts.test.procedures:remove_src" + +[tool.poe.tasks.run_mypy_dist] +help = "CI Test | Run mypy against distribuition" +script = "scripts.test.procedures:run_mypy_dist" + +[tool.poe.tasks.run_pyright_dist] +help = "CI Test | Run pyright against distribuition" +script = "scripts.test.procedures:run_pyright_dist" + [tool.black] line_length = 88 target_version = ["py39"] @@ -41,7 +164,6 @@ extra_standard_library = [ [tool.mypy] # Import discovery -mypy_path = "typings" namespace_packages = false explicit_package_bases = false ignore_missing_imports = true @@ -86,3 +208,9 @@ strict_equality = true show_error_context = false show_column_numbers = false show_error_codes = true + +[tool.pyright] +typeCheckingMode = "basic" +stubPath = "." +include = ["tests", "pandas-stubs"] +useLibraryCodeForTypes = true diff --git a/pyrightdistconfig.json b/pyrightdistconfig.json deleted file mode 100644 index d09ec947..00000000 --- a/pyrightdistconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "typeCheckingMode": "basic", - "include": ["tests"] -} diff --git a/pyrighttestconfig.json b/pyrighttestconfig.json deleted file mode 100644 index dc989335..00000000 --- a/pyrighttestconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "typeCheckingMode": "basic", - "include": [ "tests", "typings/pandas" ], - "reportMissingModuleSource": false, - "reportUnusedVariable": false, - "useLibraryCodeForTypes": true, - "reportUnknownArgumentType": true -} diff --git a/runtests.bat b/runtests.bat deleted file mode 100644 index a8221cfc..00000000 --- a/runtests.bat +++ /dev/null @@ -1,5 +0,0 @@ -echo on -pytest tests > pytest.out -mypy tests typings/pandas > mypytests.out -pyright -p pyrighttestconfig.json > pandastests.out - diff --git a/runtests.sh b/runtests.sh deleted file mode 100644 index 3c3cad9a..00000000 --- a/runtests.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -pytest tests > pytest.out -mypy tests typings/pandas > mypytests.out -pyright -p pyrighttestconfig.json > pandastests.out - diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 00000000..9c40f6cf --- /dev/null +++ b/scripts/__init__.py @@ -0,0 +1,28 @@ +import sys + +from loguru import logger +from pathlib import Path + +pkg_path = [x for x in sys.path if x.endswith('site-packages')] + +if not Path(fr'{pkg_path[0]}/my_paths.pth').exists(): + with open(fr'{pkg_path[0]}/my_paths.pth', 'w') as file: + file.write(str(Path.cwd())) + + +config = { + "handlers": [ + { + "sink": sys.stderr, + "format": ( + "\n" + "===========================================\n" + "{message}\n" + "===========================================\n" + "" + ), + } + ] +} + +logger.configure(**config) diff --git a/scripts/_job.py b/scripts/_job.py new file mode 100644 index 00000000..c42a3168 --- /dev/null +++ b/scripts/_job.py @@ -0,0 +1,57 @@ +import time +from dataclasses import dataclass +from subprocess import CalledProcessError +from typing import Callable, List, Optional, Deque + +from loguru import logger +from collections import deque + +@dataclass +class Step: + name: str + run: Callable[[], None] + rollback: Optional[Callable[[], None]] = None + + +def __rollback_job(steps: Deque[Step]): + """ + Responsible to run rollback of steps. + """ + + while steps: + step = steps.pop() + if step.rollback is not None: + logger.warning(f"Undoing: {step.name}") + try: + step.rollback() + except Exception: + logger.error(f"Rollback of Step: '{step.name}' failed!") + + + +def run_job(steps: List[Step]) -> None: + """ + Responsible to run steps with logs. + """ + + rollback_steps = Deque[Step]() + + for step in steps: + start = time.perf_counter() + logger.info(f"Beginning: '{step.name}'") + + try: + + rollback_steps.append(step) + step.run() + + except CalledProcessError: + + logger.error(f"Step: '{step.name}' failed!") + __rollback_job(rollback_steps) + + break + + end = time.perf_counter() + logger.success(f"End: '{step.name}', runtime: {end - start:.3f} seconds.") + diff --git a/scripts/style/__init__.py b/scripts/style/__init__.py new file mode 100644 index 00000000..08d0452a --- /dev/null +++ b/scripts/style/__init__.py @@ -0,0 +1,8 @@ +from scripts.style import procedures +from scripts._job import Step, run_job + +def check_style(): + steps = [Step(name="Check Black Style Code", run=procedures.run_black_check), + Step(name="Check Isort Style Code", run=procedures.run_isort_check)] + + run_job(steps) \ No newline at end of file diff --git a/scripts/style/procedures.py b/scripts/style/procedures.py new file mode 100644 index 00000000..cf5501ff --- /dev/null +++ b/scripts/style/procedures.py @@ -0,0 +1,11 @@ +import subprocess + + +def run_black_check(): + cmd = ["black", "--check", "pandas-stubs", "tests"] + subprocess.run(cmd, check=True) + + +def run_isort_check(): + cmd = ["isort", "--check-only", "pandas-stubs", "tests"] + subprocess.run(cmd, check=True) diff --git a/scripts/test/__init__.py b/scripts/test/__init__.py new file mode 100644 index 00000000..5f9332b8 --- /dev/null +++ b/scripts/test/__init__.py @@ -0,0 +1,72 @@ +from scripts._job import Step, run_job +from scripts.test import procedures + +def test_src(profile: str, clean_cache: bool = False): + steps = [] + if clean_cache: + steps.extend([ + Step(name="Clean mypy cache", run=procedures.clean_mypy_cache), + Step(name="Clean pytest cache", run=procedures.clean_pytest_cache) + ]) + + # Possible steps + mypy_step = Step(name="Run Mypy Against Source Code", run=procedures.run_mypy_src) + pyright_step = Step(name="Run Pyright Against Source Code", run=procedures.run_pyright_src) + pytest_step = Step(name="Run Pytest Against Source Code", run=procedures.run_pytest_src) + + # Defining which test is going to run according to a profile + if profile in (None, "", "default"): + steps.extend([mypy_step, pyright_step]) + elif profile == "pytest": + steps.extend([pytest_step]) + elif profile == "full": + steps.extend([mypy_step, pyright_step, pytest_step]) + else: + raise Exception("Profile not found!") + + run_job(steps) + + +def test_dist(clean_cache: bool = False): + steps = [] + if clean_cache: + steps.extend([ + Step(name="Clean mypy cache", run=procedures.clean_mypy_cache), + Step(name="Clean pytest cache", run=procedures.clean_pytest_cache) + ]) + + steps.extend([ + Step(name="Build Dist", run=procedures.build_dist), + Step(name="Install Dist", run=procedures.install_dist, rollback=procedures.uninstall_dist), + Step(name="Remove Source Code", run=procedures.remove_src, rollback=procedures.restore_src), + Step(name="Run MyPy Against Dist", run=procedures.run_mypy_dist), + Step(name="Run Pyright Against Dist", run=procedures.run_pyright_dist), + Step(name="Uninstall Dist", run=procedures.uninstall_dist), + Step(name="Restore Source Code", run=procedures.restore_src) + ]) + + run_job(steps) + + +def test_all(clean_cache: bool = False): + steps = [] + if clean_cache: + steps.extend([ + Step(name="Clean mypy cache", run=procedures.clean_mypy_cache), + Step(name="Clean pytest cache", run=procedures.clean_pytest_cache) + ]) + + steps.extend([ + Step(name="Run Mypy Against Source Code", run=procedures.run_mypy_src), + Step(name="Run Pyright Against Source Code", run=procedures.run_pyright_src), + Step(name="Run Pytest Against Source Code", run=procedures.run_pytest_src), + Step(name="Build Dist", run=procedures.build_dist), + Step(name="Install Dist", run=procedures.install_dist, rollback=procedures.uninstall_dist), + Step(name="Remove Source Code", run=procedures.remove_src, rollback=procedures.restore_src), + Step(name="Run MyPy Against Dist", run=procedures.run_mypy_dist), + Step(name="Run Pyright Against Dist", run=procedures.run_pyright_dist), + Step(name="Uninstall Dist", run=procedures.uninstall_dist), + Step(name="Restore Source Code", run=procedures.restore_src) + ]) + + run_job(steps) \ No newline at end of file diff --git a/scripts/test/procedures.py b/scripts/test/procedures.py new file mode 100644 index 00000000..4017c746 --- /dev/null +++ b/scripts/test/procedures.py @@ -0,0 +1,76 @@ +import shutil +import subprocess +from pathlib import Path + +from scripts._job import Step, run_job + + +def run_mypy_src(): + cmd = ["mypy", "pandas-stubs", "tests", "--no-incremental"] + subprocess.run(cmd, check=True) + + +def run_pyright_src(): + cmd = ["pyright"] + subprocess.run(cmd, check=True) + + +def run_pytest_src(): + cmd = ["pytest"] + subprocess.run(cmd, check=True) + + +def build_dist(): + cmd = ["poetry", "build", "-f", "wheel"] + subprocess.run(cmd, check=True) + + +def install_dist(): + path = next(Path("dist/").glob("*.whl")) + cmd = ["pip", "install", str(path)] + subprocess.run(cmd, check=True) + + +def remove_src(): + shutil.rmtree(r"pandas-stubs") + + +def run_mypy_dist(): + cmd = ["mypy", "tests", "--no-incremental"] + subprocess.run(cmd, check=True) + + +def run_pyright_dist(): + cmd = ["pyright", "tests"] + subprocess.run(cmd, check=True) + +def uninstall_dist(): + cmd = ["pip", "uninstall", "-y", "pandas-stubs"] + subprocess.run(cmd, check=True) + + +def restore_src(): + cmd = ["git", "checkout", "HEAD", "pandas-stubs"] + subprocess.run(cmd, check=True) + + +def clean_mypy_cache(): + if Path('.mypy_cache').exists(): + shutil.rmtree('.mypy_cache') + + +def clean_pytest_cache(): + if Path('.mypy_cache').exists(): + shutil.rmtree('.pytest_cache') + + +def create_new_venv(): + cmd = ["poetry", "remove", "python"] + subprocess.run(cmd, check=True) + + cmd = ["poetry", "update", "-vvv"] + subprocess.run(cmd, check=True) + + cmd = ["poetry", "shell"] + subprocess.run(cmd, check=True) + diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 46a07041..00000000 --- a/setup.cfg +++ /dev/null @@ -1,43 +0,0 @@ -[metadata] -name = pandas-stubs -description = Type annotations for pandas -long_description = file: README.md -long_description_content_type = text/markdown -url = https://pandas.pydata.org -author = The Pandas Development Team -author_email = pandas-dev@python.org -license = BSD-3-Clause -license_file = LICENSE -platforms = any -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Console - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Scientific/Engineering -project_urls = - Bug Tracker = https://github.com/pandas-dev/pandas-stubs/issues - Documentation = https://pandas.pydata.org/pandas-docs/stable - Source Code = https://github.com/pandas-dev/pandas-stubs - -[options] -install_requires = - numpy>=1.22.3 - typing_extensions>=4.2 -python_requires = >=3.8 - -[bumpversion] -current_version = 1.4.2.220604 -parse = (?P\d+)\.(?P\d+)\.(?P\d+)\.(?P\d+) -serialize = - {major}.{minor}.{patch}.{release} -message = [skip ci] Bump pandas-stubs version: {current_version} -> {new_version} - -[bumpversion:file:setup.py] diff --git a/setup.py b/setup.py deleted file mode 100644 index f50d2b10..00000000 --- a/setup.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Setup for Pandas type annotations. -For the sake of convenience the package installation -will coexist with Pandas installation. -If this is a problem - download the source -and add it to PYTHONPATH manually. -""" - -from setuptools import setup, find_packages -from setuptools.command.build_py import build_py -from typing import Generator -import os, shutil - -version = "1.4.2.220604" - - -# find_packages might not work with stub files -src_path = "typings" - - -class BuildPyCommand(build_py): - """Custom build command.""" - - def run(self): - shutil.rmtree("src.tmp", ignore_errors=True) - os.mkdir("src.tmp") - shutil.copytree("typings/pandas", "src.tmp/pandas-stubs") - build_py.run(self) - - -def list_packages(source_path: str = src_path) -> Generator: - for root, _, _ in os.walk(os.path.join(source_path, "pandas")): - yield ".".join(os.path.relpath(root, source_path).split(os.path.sep)).replace( - "pandas", "pandas-stubs" - ) - - -setup( - cmdclass={"build_py": BuildPyCommand}, - package_dir={"": "src.tmp"}, - version=version, - packages=list(list_packages()), - package_data={"pandas-stubs": ["*.pyi", "**/*.pyi"]}, - install_requires=['typing_extensions>=4.2;python_version>="3.8"'], -) diff --git a/tests/pandas/README.md b/tests/pandas/README.md deleted file mode 100644 index 2eb269e8..00000000 --- a/tests/pandas/README.md +++ /dev/null @@ -1,3 +0,0 @@ -These tests originally came from https://github.com/VirtusLab/pandas-stubs. - - diff --git a/tests/pandas/__init__.py b/tests/pandas/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index 619c5d0e..00000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -pandas==1.4.2 -pyright -pytest -mypy==0.960 -typing_extensions==4.2.0 -matplotlib>=3.3.2 -numpy>=1.22.3 -setuptools>=62.3.2 -build>=0.8.0 -wheel>=0.37.0 diff --git a/tests/run_tests.sh b/tests/run_tests.sh deleted file mode 100644 index 690721b5..00000000 --- a/tests/run_tests.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -python -m pip install --upgrade pyright -python -m pip install -r requirements.txt -cp -R ../partial/ ../typings -pyright --lib --pythonversion 3.9 -p ../pyrighttestconfig.json . - - - diff --git a/tests/pandas/test_frame.py b/tests/test_frame.py similarity index 100% rename from tests/pandas/test_frame.py rename to tests/test_frame.py diff --git a/tests/pandas/test_indexes.py b/tests/test_indexes.py similarity index 100% rename from tests/pandas/test_indexes.py rename to tests/test_indexes.py diff --git a/tests/pandas/test_interval.py b/tests/test_interval.py similarity index 100% rename from tests/pandas/test_interval.py rename to tests/test_interval.py diff --git a/tests/pandas/test_merge.py b/tests/test_merge.py similarity index 100% rename from tests/pandas/test_merge.py rename to tests/test_merge.py diff --git a/tests/pandas/test_pandas.py b/tests/test_pandas.py similarity index 100% rename from tests/pandas/test_pandas.py rename to tests/test_pandas.py diff --git a/tests/pandas/test_series.py b/tests/test_series.py similarity index 100% rename from tests/pandas/test_series.py rename to tests/test_series.py diff --git a/tests/pandas/test_testing.py b/tests/test_testing.py similarity index 100% rename from tests/pandas/test_testing.py rename to tests/test_testing.py diff --git a/tests/pandas/test_timefuncs.py b/tests/test_timefuncs.py similarity index 100% rename from tests/pandas/test_timefuncs.py rename to tests/test_timefuncs.py