-
Notifications
You must be signed in to change notification settings - Fork 44
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
Pip install #77
Pip install #77
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: PyPI | ||
on: push | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python distribution to PyPI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- name: Build a binary wheel and a source tarball | ||
run: | | ||
python -mpip install wheel | ||
python setup.py sdist bdist_wheel | ||
- name: Publish distribution to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/[email protected] | ||
with: | ||
password: ${{ secrets.PYPI_PASSWORD }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
*/.DS_Store | ||
**/__pycache__/* | ||
.DS_Store | ||
**/__pycache__/* | ||
dist/ | ||
*.egg-info/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import json | ||
import os | ||
from typing import Dict | ||
|
||
from jsonschema import RefResolver | ||
|
||
SCHEMAS_PATH = "schemas" | ||
|
||
|
||
class LocalRefResolver(RefResolver): | ||
def resolve_remote(self, url: str) -> Dict: | ||
# Use remote URL to generate local path | ||
# e.g. https://ngff.openmicroscopy.org/0.3/schemas/image.schema | ||
rel_path = url.replace("https://ngff.openmicroscopy.org/", "") | ||
curr_dir = os.path.dirname(__file__) | ||
path = os.path.join(curr_dir, "..", rel_path) | ||
path = os.path.normpath(path) | ||
# Load local document and cache it | ||
document = load_json(path) | ||
self.store[url] = document | ||
return document | ||
|
||
|
||
def load_json(path: str) -> Dict: | ||
with open(path) as f: | ||
document = json.loads(f.read()) | ||
return document | ||
|
||
|
||
def get_schema(version: str, strict: bool = False) -> Dict: | ||
schema_name = "strict_image.schema" if strict else "image.schema" | ||
curr_dir = os.path.dirname(__file__) | ||
# The paths here match the paths in the ngff repo (and public schemas) | ||
path = os.path.join( | ||
curr_dir, "..", version, "schemas", schema_name | ||
) | ||
path = os.path.normpath(path) | ||
return load_json(path) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python | ||
|
||
import codecs | ||
import os | ||
from typing import List | ||
|
||
from setuptools import setup | ||
|
||
|
||
def read(fname): | ||
file_path = os.path.join(os.path.dirname(__file__), fname) | ||
return codecs.open(file_path, encoding="utf-8").read() | ||
|
||
|
||
install_requires: List[List[str]] = [] | ||
install_requires += (["jsonschema"],) | ||
|
||
|
||
setup( | ||
name="ngff", | ||
version="0.0.4dev", | ||
author="The Open Microscopy Team", | ||
url="https://github.com/ome/ngff", | ||
description="Next-Generation File Format: spec and schemas", | ||
long_description=read("README.md"), | ||
long_description_content_type="text/markdown", | ||
packages=["ngff"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See ome/ome-zarr-py#142 (review) for a suggestion of prefixing the package with |
||
py_modules=["ngff"], | ||
python_requires=">=3.6", | ||
install_requires=install_requires, | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: OS Independent", | ||
"License :: OSI Approved :: BSD License", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another issue to clarify is that the repository is currently marked under the W3C Sofware and Document License - see https://github.com/ome/ngff/blob/main/LICENSE.md |
||
], | ||
tests_require=["pytest"], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
version
probably expresses best my concerns about the multi-type repository. Turning it into a question, what is our positions on the different versions in this repository? I see at least 3 sources of truth:"Are these versions expected to be in sync or evolve independently. For all the versions that are in sync, can we use a single-source of truth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "version of the latest schema" is defined by the most recent top-level directory, currently
/0.3/
but I think that doesn't have to match the current version in setup.py, since the directory will never be named*dev
. But at each release they should match and correspond to the repo tag (with bumpversion being the single source of truth).