Skip to content

Commit

Permalink
pkg src/ (#1010)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored May 18, 2023
1 parent 0a6955e commit a0bad20
Show file tree
Hide file tree
Showing 177 changed files with 17 additions and 19 deletions.
9 changes: 6 additions & 3 deletions .azure/gpu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,26 @@ pr:
- release/*

jobs:
- job: pytest
- job: testing
# how long to run the job before automatically cancelling
timeoutInMinutes: "45"
# how much time to give 'run always even if cancelled tasks' before stopping them
cancelTimeoutInMinutes: "2"

pool: lit-rtx-3090
variables:
DEVICES: $( python -c 'print("$(Agent.Name)".split("_")[-1])' )
DEVICES: $( python -c 'name = "$(Agent.Name)" ; gpus = name.split("_")[-1] if "_" in name else "0,1"; print(gpus)' )
DEBIAN_FRONTEND: "noninteractive"
TZ: "Europe/Amsterdam"
TORCH_HOME: "/var/tmp/torch"
TRANSFORMERS_CACHE: "/var/tmp/huggingface"
FREEZE_REQUIREMENTS: 1

container:
#image: "pytorchlightning/pytorch_lightning:base-cuda-py3.9-torch1.12-cuda11.6.1"
image: "pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime"
#endpoint: azureContainerRegistryConnection
options: "--gpus=all --shm-size=16g -v /usr/bin/docker:/tmp/docker:ro"
options: "--gpus=all --shm-size=16g -v /usr/bin/docker:/tmp/docker:ro -v /var/tmp:/var/tmp"

workspace:
clean: all
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ jobs:
# todo: seems there are some issues with py3.10 while install dependencies
python-version: ["3.7", "3.9"]
requires: ['oldest', 'latest']

env:
FREEZE_REQUIREMENTS: 1
# Timeout: https://stackoverflow.com/a/59076067/4521646
# the reason for high number is MUCH slower tests on macOS and py3.8
timeout-minutes: 50
Expand Down Expand Up @@ -69,10 +70,11 @@ jobs:
pip list
- name: Test Package [only]
working-directory: ./src
run: |
pip install pytest -q
# TODO: package shall be fine to run full without any ignores
python -m pytest pl_bolts \
python -m pytest . \
--ignore=pl_bolts/datamodules \
--ignore=pl_bolts/datasets \
--ignore=pl_bolts/models/self_supervised/amdim/transforms.py \
Expand All @@ -86,7 +88,7 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/modules.txt') }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-
Expand All @@ -113,16 +115,7 @@ jobs:
- name: Tests
run: |
python -m pytest tests -v --cov=pl_bolts \
--junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: always()
python -m pytest tests -v --cov=pl_bolts
- name: Statistics
if: success()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ignore-init-module-imports = true
unfixable = ["F401"]

[tool.mypy]
files = ["pl_bolts"]
files = ["src/pl_bolts"]
disallow_untyped_defs = "True"
ignore_missing_imports = "True"
install_types = "True"
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def _load_py_module(fname, pkg="pl_bolts"):
spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_ROOT, pkg, fname))
spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_ROOT, "src", pkg, fname))
py = module_from_spec(spec)
spec.loader.exec_module(py)
return py
Expand Down Expand Up @@ -115,6 +115,7 @@ def _prepare_extras():
"loggers": _load_requirements(path_dir=_PATH_REQUIRE, file_name="loggers.txt"),
"models": _load_requirements(path_dir=_PATH_REQUIRE, file_name="models.txt"),
"test": _load_requirements(path_dir=_PATH_REQUIRE, file_name="test.txt"),
"typing": _load_requirements(path_dir=_PATH_REQUIRE, file_name="typing.txt"),
}
extras["extra"] = extras["models"] + extras["loggers"]
extras["dev"] = extras["extra"] + extras["test"]
Expand Down Expand Up @@ -142,7 +143,8 @@ def _prepare_extras():
url=about.__homepage__,
download_url="https://github.com/PyTorchLightning/lightning-bolts",
license=about.__license__,
packages=find_packages(exclude=["tests", "docs"]),
package_dir={"": "src"},
packages=find_packages(where="src"),
long_description=long_description,
long_description_content_type="text/markdown",
include_package_data=True,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit a0bad20

Please sign in to comment.