Skip to content

Commit

Permalink
Don't require fire as base dependency and add `lightning_tools[dev]…
Browse files Browse the repository at this point in the history
…` installation (#42)

* Don't require cli dep by default

* Add pip install lightning_utilities[dev]

* Update readme

* Update installation

* Remove unused base.txt
  • Loading branch information
akihironitta authored Sep 7, 2022
1 parent c27592a commit 215a983
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set oldest dependencies
if: matrix.requires == 'oldest'
run: |
pip install -e .
pip install -e '.[dev]'
python -m lightning_utilities.dev requirements set-oldest
- uses: ./.github/actions/cache
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export SLURM_LOCALID=0
export SPHINX_MOCK_REQUIREMENTS=0

test:
pip install -q -r requirements/base.txt
pip install -q -r requirements/dev.txt
pip install -q -r requirements/test.txt

# use this to run tests
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
# requires: latest
```

## 3. CLI
## 3. CLI `lightning_utilities.dev`

The package provides common CLI commands.

Expand All @@ -71,7 +71,7 @@ pip install https://github.com/Lightning-AI/utilities/archive/refs/heads/main.zi
From pypi:

```bash
pip install lightning_utilities
pip install lightning_utilities[dev]
```

</details>
Expand Down Expand Up @@ -102,3 +102,27 @@ pytest-timeout
```

</details>

## 4. General Python utilities `lightning_utilities.core`

<details>
<summary>Installation</summary>

From pypi:

```bash
pip install lightning_utilities
```

</details>

__Usage:__

Example for optional imports:

```python
from lightning_utilities.core.imports import module_available

if module_available("some_package.something"):
from some_package import something
```
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,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", "dev.txt"))
MOCK_PACKAGES = [PACKAGE_MAPPING.get(pkg, pkg) for pkg in MOCK_PACKAGES]

autodoc_mock_imports = MOCK_PACKAGES
Expand Down
File renamed without changes.
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def _load_py_module(fname, pkg="lightning_utilities"):


about = _load_py_module("__about__.py")
with open(os.path.join(_PATH_REQUIRE, "base.txt")) as fp:
requirements = list(map(str, parse_requirements(fp.readline())))
with open(os.path.join(_PATH_REQUIRE, "dev.txt")) as fp:
requirements_dev = list(map(str, parse_requirements(fp.readline())))
with open(os.path.join(_PATH_ROOT, "README.md")) as fp:
readme = fp.read()

Expand All @@ -42,7 +42,10 @@ def _load_py_module(fname, pkg="lightning_utilities"):
keywords=["Utilities", "DevOps", "CI/CD"],
python_requires=">=3.7",
setup_requires=[],
install_requires=requirements,
install_requires=[],
extras_require={
"dev": requirements_dev,
},
project_urls={
"Bug Tracker": "https://github.com/Lightning-AI/utilities/issues",
"Documentation": "https://dev-toolbox.rtfd.io/en/latest/", # TODO: Update domain
Expand Down

0 comments on commit 215a983

Please sign in to comment.