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

[WIP] Module reorganization #172

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ec19335
Use src-layout
sajith Jun 6, 2023
b1f2aa1
Move tests to top level
sajith Jun 6, 2023
ccb70dd
Rename the project
sajith Jun 6, 2023
5a5a1c4
Move fablib to top-level as fabrictestbed_fablib
sajith Jun 6, 2023
338c8a4
Add version string to top-level init file
sajith Jun 6, 2023
98c50c3
Use setuptools as the build backend
sajith Jun 6, 2023
cd43e49
Update note about dynamic version
sajith Jun 6, 2023
6750d5e
Empty out dunder inits
sajith Jun 6, 2023
069b810
Update imports to use fabrictestbed_fablib
sajith Jun 6, 2023
efbb0fa
Add backward compatibility fablib modules
sajith Jun 6, 2023
542d77f
Re-export fablib modules correctly
sajith Jun 7, 2023
239ac06
Reformat
sajith Jun 7, 2023
9a4a665
Add a changelog entry
sajith Jun 7, 2023
29682c1
Build with build, not with flit
sajith Jun 7, 2023
0a83014
Attempt to install the correct thing on CI
sajith Jun 7, 2023
539e768
Use single source for version
sajith Jun 7, 2023
ea3d346
Add copyright headers
sajith Jun 7, 2023
77ec692
Reduce black's verboseness
sajith Jun 7, 2023
b6c3317
Merge remote-tracking branch 'origin/main' into 164.module-reorg
sajith Jun 7, 2023
b3268ea
Reformat
sajith Jun 7, 2023
4c4a5ad
Update packaging and publishing notes
sajith Jun 7, 2023
d21cf25
Update code sample
sajith Jun 7, 2023
407022c
Update title and PyPI links
sajith Jun 7, 2023
f408966
Use plain style PyPI badge
sajith Jun 7, 2023
acb9312
Use full path to init file
sajith Jun 7, 2023
39075a6
Re-export modules from dunder init
sajith Jun 7, 2023
75eaaed
Use importlib to report our own version
sajith Jun 7, 2023
586a54f
Trim whitespace
sajith Jun 7, 2023
9c5b98a
Do not compute version dynamically
sajith Jun 7, 2023
4590e3c
Update README note about version
sajith Jun 7, 2023
6c5845b
Update README note about tagging releases
sajith Jun 7, 2023
4a67276
Update git tagging example
sajith Jun 7, 2023
74ee03f
Shorten example code
sajith Jun 7, 2023
0814530
Refer to the actual package name
sajith Jun 7, 2023
dd6a775
Dot the dot, upcase
sajith Jun 7, 2023
a14d116
Merge remote-tracking branch 'origin/main' into 164.module-reorg
sajith Jun 8, 2023
871d89d
Reformat
sajith Jun 8, 2023
db33a8a
Make re-exports consistent
sajith Jun 12, 2023
bc779d7
Merge remote-tracking branch 'origin/main' into 164.module-reorg
sajith Jun 14, 2023
2e6bc2b
Merge remote-tracking branch 'origin/main' into 164.module-reorg
sajith Jun 23, 2023
16fc4da
Bump up version
sajith Jun 23, 2023
660b05b
Merge remote-tracking branch 'origin/main' into 164.module-reorg
sajith Jul 20, 2023
f9410c3
Fix typo
sajith Jul 20, 2023
d22821a
Update isort/black configuration
sajith Jul 20, 2023
f47c601
Re-format
sajith Jul 20, 2023
ca56968
Merge remote-tracking branch 'origin/main' into 164.module-reorg
sajith Jul 25, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flit
python -m pip install build

- name: Build the package
run: |
python -m flit build
python -m build

- name: Try installing the package
run: |
python -m pip install dist/fabrictestbed_extensions-*.whl
python -m pip install dist/fabrictestbed_fablib-*.whl

# See https://github.com/actions/upload-artifact
- name: Upload build artifacts
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Methods added to retrieve SSH keys for bastion and sliver (PR
[#207](https://github.com/fabric-testbed/fabrictestbed-extensions/pull/207))

### Changed

- Renamed the package to fabrictestbed-fablib. Modules are also renamed, such
that we will have the shorter `import fabrictestbed_fablib.fablib` instead
of the longer `import fabrictestbed_extensions.fablib.fablib` (PR
[#172](https://github.com/fabric-testbed/fabrictestbed-extensions/pull/172),
issue [#164](https://github.com/fabric-testbed/fabrictestbed-extensions/issue/164)).
A comatibility shim module is added so that we do not break existing code and
notebooks in the interim. The existence of two top-level modules also
necessitates a switch to setuptools as the build backend.


## [1.4.4] - 2023-05-21

Expand Down
44 changes: 17 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# fabrictestbed-extensions
# fabrictestbed-fablib

[![pypi-badge]][pypy] [![api-docs-badge]][api-docs]

Expand All @@ -11,7 +11,7 @@ known as "FABlib", for intereacting with [FABRIC][fabric] testbed.
You can install released versions of FABlib from PyPI:

```console
$ pip install fabrictestbed-extensions
$ pip install fabrictestbed-fablib
```

If you need the current development version of FABlib, install it from
Expand All @@ -33,10 +33,10 @@ work. FABRIC team tends to favor virtualenvwrapper.
Once installed, you can use FABlib in your Python projects:

```python
from fabrictestbed_extensions.fablib.fablib import FablibManager as fablib_manager
from fabrictestbed_fablib import FablibManager

try:
fablib = fablib_manager()
fablib = FablibManager()
fablib.show_config()
except Exception as e:
print(f"Exception: {e}")
Expand Down Expand Up @@ -93,47 +93,39 @@ $ pytest -s tests/integration/test_hello_fabric.py

## Packaging FABlib

FABlib uses [flit] as the build backend. To build source and wheel
packages, do this:
To build source and wheel packages, do this:

```console
$ pip install flit
$ flit build
```

While using flit as the build backend, continuing to use [build] as
the build frontend should work too:

```
$ pip install build
$ python -m build
```


## Releasing FABlib

When it is time to release a new version of FABlib, remember to: (1)
update the package version in top-level `__init__.py`, (2) build the
source and wheel packages, and (3) upload packages to PyPI:
When it is time to release a new version of FABlib, remember to:

1. Update `version` in `pyproject.toml`.
2. Tag the release tag and push the tag to GitHub:

```console
$ flit publish
$ git tag --sign --message "Great new features" rel<x.y.z> <commit>
$ git push origin --tags rel<x.y.z>
```

Continuing to use twine to publish packages is an option too:
2. Build the source and wheel packages.
3. Upload packages to PyPI using [twine]:

```console
$ pip install twine
$ twine upload dist/*
```

For details about publishing to PyPI, see flit documentation about
[package uploads].


<!-- URLs -->

[pypy]: https://pypi.org/project/fabrictestbed-extensions/
[pypi-badge]: https://img.shields.io/pypi/v/fabrictestbed-extensions?style=plastic (PyPI)
[pypy]: https://pypi.org/project/fabrictestbed-fablib/
[pypi-badge]: https://img.shields.io/pypi/v/fabrictestbed-fablib?style=plain (PyPI)

[api-docs]: https://fabric-fablib.readthedocs.io/en/latest/?badge=latest
[api-docs-badge]: https://readthedocs.org/projects/fabric-fablib/badge/?version=latest (Documentation Status)
Expand All @@ -151,11 +143,9 @@ For details about publishing to PyPI, see flit documentation about
[fablib-api-rtd]: https://fabric-fablib.readthedocs.io/en/latest/
[fablib-api-old]: https://learn.fabric-testbed.net/docs/fablib/fablib.html

[flit]: https://flit.pypa.io/en/stable/
[package uploads]: https://flit.pypa.io/en/latest/upload.html

[build]: https://pypi.org/project/build/
[tox]: https://pypi.org/project/tox/
[pytest]: https://pypi.org/project/pytest/
[black]: https://pypi.org/project/black/
[twine]: https://pypi.org/project/twine/
[isort]: https://pypi.org/project/isort/
3 changes: 0 additions & 3 deletions fabrictestbed_extensions/__init__.py

This file was deleted.

13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "fabrictestbed-extensions"
# Bump version up in top-level __init.py__.
dynamic = ["version"]
name = "fabrictestbed-fablib"
version = "1.5.1"
description = "FABRIC Python Client Library and CLI Extensions"
authors = [
{name="Paul Ruth", email="[email protected]"},
Expand Down Expand Up @@ -56,11 +55,11 @@ branch = true
omit = [ "fabrictestbed_extensions/tests/*" ]

[tool.black]
src_paths = ["fabrictestbed_extensions", "docs/source/conf.py", "tests"]
src_paths = ["src", "docs/source/conf.py", "tests"]

[tool.isort]
profile = "black"
src_paths = ["fabrictestbed_extensions", "docs/source/conf.py", "tests"]
src_paths = ["src", "docs/source/conf.py", "tests"]

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
32 changes: 32 additions & 0 deletions src/fabrictestbed_extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import warnings

warnings.warn(
"fabrictestbed_extensions module is deprecated", DeprecationWarning, stacklevel=2
)

from importlib.metadata import version

__version__ = version("fabrictestbed_fablib")
35 changes: 35 additions & 0 deletions src/fabrictestbed_extensions/fablib/component.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import warnings

from fabrictestbed_fablib.component import Component

warnings.warn(
"fabrictestbed_extensions.fablib.component module is deprecated;"
" please import fabrictestbed_fablib.component instead",
DeprecationWarning,
stacklevel=2,
)

__all__ = [Component]
35 changes: 35 additions & 0 deletions src/fabrictestbed_extensions/fablib/fablib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import warnings

from fabrictestbed_fablib.fablib import FablibManager

warnings.warn(
"fabrictestbed_extensions.fablib.fablib module is deprecated;"
" please import fabrictestbed_fablib.fablib instead",
DeprecationWarning,
stacklevel=2,
)

__all__ = [FablibManager]
35 changes: 35 additions & 0 deletions src/fabrictestbed_extensions/fablib/facility_port.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import warnings

from fabrictestbed_fablib.facility_port import FacilityPort

warnings.warn(
"fabrictestbed_extensions.fablib.facility_port module is deprecated;"
" please import fabrictestbed_fablib.facility_port instead",
DeprecationWarning,
stacklevel=2,
)

__all__ = [FacilityPort]
35 changes: 35 additions & 0 deletions src/fabrictestbed_extensions/fablib/interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import warnings

from fabrictestbed_fablib.interface import Interface

warnings.warn(
"fabrictestbed_extensions.fablib.interface module is deprecated;"
" please import fabrictestbed_fablib.interface instead",
DeprecationWarning,
stacklevel=2,
)

__all__ = [Interface]
35 changes: 35 additions & 0 deletions src/fabrictestbed_extensions/fablib/network_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import warnings

from fabrictestbed_fablib.network_service import NetworkService

warnings.warn(
"fabrictestbed_extensions.fablib.network_service module is deprecated;"
" please import fabrictestbed_fablib.network_service instead",
DeprecationWarning,
stacklevel=2,
)

__all__ = [NetworkService]
Loading