move base req. to root (#4219)
* move base req. to root * check-manifest * check-manifest * manifest * req
This commit is contained in:
parent
66e58f5afb
commit
d3567c33a6
|
@ -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:
|
||||
|
||||
|
|
|
@ -25,14 +25,18 @@ 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
|
||||
|
||||
|
@ -40,7 +44,7 @@ jobs:
|
|||
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: |
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)"
|
||||
|
@ -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 }}-
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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-
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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-
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -39,4 +39,4 @@ python:
|
|||
version: 3.7
|
||||
install:
|
||||
- requirements: requirements/docs.txt
|
||||
#- requirements: requirements/base.txt
|
||||
#- requirements: requirements.txt
|
||||
|
|
|
@ -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
|
||||
|
@ -62,5 +64,5 @@ prune notebook*
|
|||
prune temp*
|
||||
prune test*
|
||||
prune benchmark*
|
||||
prune docker
|
||||
prune dockers
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
12
setup.py
12
setup.py
|
@ -31,8 +31,8 @@ builtins.__LIGHTNING_SETUP__ = True
|
|||
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:
|
||||
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue