forked from PelicanPlatform/pelicanfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added packaging workflows and setup and slightly better README
- Loading branch information
Showing
6 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Publish PelicanFS distribution to TestPyPI | ||
on: pre-release | ||
|
||
jobs: | ||
build: | ||
name: Build distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- name: Install pypa/build | ||
run: >- | ||
python 3 -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: python3 -m build | ||
- name: Store the distribution packages | ||
uses: actions/upload-artiface@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-test-pypi: | ||
name: >- | ||
Publish Python Distribution to TestPyPI | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/pelicanfs | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/downaload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
respository-url: https://test.pypi.org/legacy | ||
|
||
github-release: | ||
name: >- | ||
Sign the Python distribution with Sigstore | ||
and upload them to GitHub Release | ||
needs: | ||
- publish-to-test-pypi | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
id-token: write # IMPORTANT: mandatory for sigstore | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Sign the dists with Sigstore | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
--notes "" | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Upload to GitHub Release using the `gh` CLI. | ||
# `dist/` contains the built packages, and the | ||
# sigstore-produced signatures and certificates. | ||
run: >- | ||
gh release upload | ||
'${{ github.ref_name }}' dist/** | ||
--repo '${{ github.repository }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,42 @@ | ||
# pelicanfs | ||
An ffspec implementation that uses the pelican client | ||
# PelicanFS | ||
|
||
## Overview | ||
|
||
PelicanFS is a file system interface (fsspec) for the Pelican Platform. For more information about the Pelican Platform, please visit the [Pelican Platform](https://pelicanplatform.org) and the [Pelican Platform Github](https://github.com/PelicanPlatform/pelican) pages. For more information about fsspec, visit the [filesystem-spec](https://filesystem-spec.readthedocs.io/en/latest/index.html) page. | ||
|
||
|
||
## Limitations | ||
|
||
PelicanFS is built on top of the http fsspec implementation. As such, any functionality that isn’t available in the http implementation is also *not* available in PelicanFS. | ||
|
||
### Installation | ||
|
||
To install pelican, run:```pip install pelicanfs```### Using PelicanFS | ||
|
||
To use pelicanfs, first create a `PelicanFileSystem` and provide it with the url for the director of your data federation. As an example using the OSDF director | ||
|
||
```python | ||
from pelicanfs.core import PelicanFileSystem | ||
|
||
pelfs = PelicanFileSystem("https://osdf-director.osg-htc.org/") | ||
``` | ||
|
||
From there, use `pelfs` as you would an http fsspec using a namespace path as the url path. For example: | ||
|
||
```python | ||
hello_world = pelfs.cat('/ospool/uc-shared/public/OSG-Staff/validation/test.txt') | ||
print(hello_world) | ||
``` | ||
|
||
### Getting an FSMap | ||
|
||
Sometimes various systems that interact with an fsspec want a key-value mapper rather than a url. To do that, call the `PelicanMap` function with the namespace path and a `PelicanFileSystem` object rather than using the fsspec `get_mapper` call. For example | ||
|
||
```python | ||
from pelicanfs.core import PelicanFileSystem, PelicanMap | ||
|
||
pelfs = PelicanFileSystem(“some-director-url”) | ||
file1 = PelicanMap(“namespace/file/1”, pelfs=pelfs) | ||
file2 = PelicanMap(“namespace/file/2”, pelfs=pelfs) | ||
ds = xarray.open_mfdataset([file1,file2], engine='zarr') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[tool.pytest.ini_options] | ||
addopts = [ | ||
"--import-mode=importlib", | ||
] | ||
|
||
[build-system] | ||
requires = ["setuptools>=61.0", "wheel"] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[metadata] | ||
license_files = LICENSE | ||
|
||
[options] | ||
packages = find: | ||
package_dir = | ||
=src | ||
|
||
[options.packages.find] | ||
where = src | ||
include = pelicanfs* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from setuptools import setup, find_packages | ||
|
||
packages = find_packages() | ||
print(packages) | ||
|
||
setup( | ||
name="pelicanfs", | ||
version="0.0.1", | ||
description="An FSSpec Implementation using the Pelican System", | ||
url = "https://github.com/PelicanPlatform/pelicanfs", | ||
classifiers=[ | ||
"Development Status :: 2 - Pre-Alpha", | ||
"Intended Audience :: Science/Research", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"License :: OSI Approved :: Apache Software License", | ||
], | ||
keywords="pelican, fsspec", | ||
packages=find_packages( | ||
where='src', | ||
include=['pelicanfs*'], | ||
), | ||
package_dir={"": "src"}, | ||
python_requires=">=3.7, <4", | ||
install_requires=["aiohttp==3.9.4", | ||
"aiosignal==1.3.1", | ||
"async-timeout==4.0.3", | ||
"attrs==23.2.0", | ||
"frozenlist==1.4.1", | ||
"fsspec==2024.3.1", | ||
"idna==3.7", | ||
"multidict==6.0.5", | ||
"yarl==1.9.4"], | ||
project_urls={ | ||
"Source": "https://github.com/PelicanPlatform/pelicanfs", | ||
"Pelican Source": "https://github.com/PelicanPlatform/pelican", | ||
"Bug Reports":"https://github.com/PelicanPlatform/pelicanfs/issues" | ||
}, | ||
) |