Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move base req. to root #4219

Merged
merged 5 commits into from
Oct 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Have a favorite feature from other libraries like fast.ai or transformers? Those

We are always looking for help implementing new features or fixing bugs.

A lot of good work has already been done in project mechanics (requirements/base.txt, setup.py, pep8, badges, ci, etc...) so we're in a good state there thanks to all the early contributors (even pre-beta release)!
A lot of good work has already been done in project mechanics (requirements.txt, setup.py, pep8, badges, ci, etc...) so we're in a good state there thanks to all the early contributors (even pre-beta release)!

### Bug Fixes:

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci_pkg-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,26 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Prepare env
run: |
pip install check-manifest "twine==1.13.0"

- name: Create package
run: |
check-manifest
# python setup.py check --metadata --strict
python setup.py sdist

- name: Check package
run: |
pip install twine==1.13.0
twine check dist/*
python setup.py clean

- name: Setup Windows
if: runner.os == 'windows'
run: |
# this is just a hotfix because of Win cannot install it directly
pip install -r requirements/base.txt --find-links https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements.txt --find-links https://download.pytorch.org/whl/torch_stable.html

- name: Install package
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_test-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements/base.txt') }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-

- name: Install dependencies
run: |
python -m pip install --upgrade --user pip
pip install --requirement ./requirements/base.txt --quiet --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
pip install --requirement ./requirements.txt --quiet --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
pip install --requirement ./requirements/test.txt --quiet --upgrade-strategy only-if-needed
# pip install tox coverage
python --version
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci_test-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ jobs:
- name: Setup MacOS Minimal
if: runner.os == 'macOS' && matrix.requires == 'minimal'
run : |
python -c "fname = 'requirements/base.txt' ; req = open(fname).read().replace('torch>=1.3', 'torch>=1.4') ; open(fname, 'w').write(req)"
python -c "fname = 'requirements.txt' ; req = open(fname).read().replace('torch>=1.3', 'torch>=1.4') ; open(fname, 'w').write(req)"

- name: Set min. dependencies
if: matrix.requires == 'minimal'
run: |
python -c "fname = 'requirements/base.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
python -c "fname = 'requirements.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
python -c "fname = 'requirements/extra.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
python -c "fname = 'requirements/test.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
python -c "fname = 'requirements/examples.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
Expand All @@ -76,7 +76,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements/extra.txt') }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/extra.txt') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-

Expand All @@ -88,7 +88,7 @@ jobs:
HOROVOD_WITHOUT_TENSORFLOW: 1
run: |
# python -m pip install --upgrade --user pip
pip install --requirement requirements/base.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet --upgrade
pip install --requirement requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet --upgrade
pip install --requirement ./requirements/devel.txt --quiet --upgrade
python --version
pip --version
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-extras-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements/extra.txt') }}
key: ${{ runner.os }}-pip-extras-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/extra.txt') }}
restore-keys: |
${{ runner.os }}-pip-extras-

Expand All @@ -53,7 +53,7 @@ jobs:
HOROVOD_WITHOUT_TENSORFLOW: 1
run: |
# python -m pip install --upgrade --user pip
pip install --requirement requirements/base.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement ./requirements/devel.txt --quiet
# pip install tox coverage
python --version ; pip --version ; pip list
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/base.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

Expand All @@ -46,7 +46,7 @@ jobs:
HOROVOD_WITHOUT_TENSORFLOW: 1
run: |
# python -m pip install --upgrade --user pip
pip install --requirement requirements/base.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements/extra.txt
pip install --requirement requirements/docs.txt
python --version
Expand Down Expand Up @@ -79,13 +79,13 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/base.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
pip install --requirement requirements/base.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
pip install --requirement requirements/docs.txt
# install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux
sudo apt-get update && sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ python:
version: 3.7
install:
- requirements: requirements/docs.txt
#- requirements: requirements/base.txt
#- requirements: requirements.txt
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ recursive-include docs/source/_images/general/ pl_overview* tf_* tutorial_* PTL1

# Include the Requirements
recursive-include requirements *.txt
recursive-exclude requirements *.sh
include requirements.txt

# Exclude build configs
exclude *.yml
Expand All @@ -62,5 +64,5 @@ prune notebook*
prune temp*
prune test*
prune benchmark*
prune docker
prune dockers

2 changes: 1 addition & 1 deletion dockers/base-xla/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ RUN \
# Install PL dependencies
cd pytorch-lightning && \
# drop Torch as it was installed with XLA
python -c "fname = 'requirements/base.txt' ; lines = [line for line in open(fname).readlines() if not line.startswith('torch')] ; open(fname, 'w').writelines(lines)" && \
python -c "fname = 'requirements.txt' ; lines = [line for line in open(fname).readlines() if not line.startswith('torch')] ; open(fname, 'w').writelines(lines)" && \
# drop Horovod as it is not needed
python -c "fname = 'requirements/extra.txt' ; lines = [line for line in open(fname).readlines() if not line.startswith('horovod')] ; open(fname, 'w').writelines(lines)" && \
# drop TorchVision as it was installed with XLA
Expand Down
2 changes: 1 addition & 1 deletion dockers/tpu-tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ COPY ./ ./pytorch-lightning/
# If using this image for tests, intall more dependencies and don"t delete the source code where the tests live.
RUN \
# Install pytorch-lightning at the current PR, plus dependencies.
#pip install -r pytorch-lightning/requirements/base.txt --no-cache-dir && \
#pip install -r pytorch-lightning/requirements.txt --no-cache-dir && \
# drop Horovod
#python -c "fname = 'pytorch-lightning/requirements/extra.txt' ; lines = [line for line in open(fname).readlines() if not line.startswith('horovod')] ; open(fname, 'w').writelines(lines)" && \
pip install -r pytorch-lightning/requirements/devel.txt --no-cache-dir --upgrade-strategy only-if-needed
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def package_list_from_file(file):
MOCK_PACKAGES = []
if SPHINX_MOCK_REQUIREMENTS:
# mock also base packages when we are on RTD since we don't install them there
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements/base.txt'))
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements.txt'))
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements/extra.txt'))
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements/loggers.txt'))

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion requirements/devel.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# install all mandatory dependencies
-r ./base.txt
-r ../requirements.txt

# install all extra dependencies for full package testing
-r ./extra.txt
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import pytorch_lightning # noqa: E402


def load_requirements(path_dir=PATH_ROOT, file_name='base.txt', comment_char='#'):
with open(os.path.join(path_dir, 'requirements', file_name), 'r') as file:
def load_requirements(path_dir=PATH_ROOT, file_name='requirements.txt', comment_char='#'):
with open(os.path.join(path_dir, file_name), 'r') as file:
lines = [ln.strip() for ln in file.readlines()]
reqs = []
for ln in lines:
Expand Down Expand Up @@ -64,10 +64,10 @@ def load_long_description():
# From local copy of repo, use like `pip install ".[dev, docs]"`
extras = {
# 'docs': load_requirements(file_name='docs.txt'),
'examples': load_requirements(file_name='examples.txt'),
'loggers': load_requirements(file_name='loggers.txt'),
'extra': load_requirements(file_name='extra.txt'),
'test': load_requirements(file_name='test.txt')
'examples': load_requirements(path_dir=os.path.join(PATH_ROOT, 'requirements'), file_name='examples.txt'),
'loggers': load_requirements(path_dir=os.path.join(PATH_ROOT, 'requirements'), file_name='loggers.txt'),
'extra': load_requirements(path_dir=os.path.join(PATH_ROOT, 'requirements'), file_name='extra.txt'),
'test': load_requirements(path_dir=os.path.join(PATH_ROOT, 'requirements'), file_name='test.txt')
}
extras['dev'] = extras['extra'] + extras['loggers'] + extras['test']
extras['all'] = extras['dev'] + extras['examples'] # + extras['docs']
Expand Down