Skip to content

Commit

Permalink
Merge pull request #62 from Caltech-IPAC/FIREFLY-1527-update-package-…
Browse files Browse the repository at this point in the history
…config

FIREFLY-1527: Update the package/build configuration and cleanup
  • Loading branch information
jaladh-singhal authored Aug 30, 2024
2 parents ede0e67 + ebf2c9e commit 94c00c5
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 79 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ jobs:
python -m venv .venv
source .venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt

- name: Install package
run: pip install -e .
- name: Install the package with docs dependencies
run: pip install -e .[docs]

- name: Build docs
run: |
Expand Down
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

26 changes: 11 additions & 15 deletions docs/development/new-release-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@

## Procedure
1. To push a new release you must be a maintainer in pypi ([see pypi below](#pypi))
2. Bump version in setup.py (this step is might be done in the PR)
2. Bump version in pyproject.toml (this step might be done in the PR)
3. Clean out old distribution
- `rm dist/*`
4. Create the distribution
- Create a tar/gzip file with the correct directory structure
- Create a tar/gzip file (unbuilt source distibution) and a wheel file
(built package) together using the `build` package:
```bash
python setup.py sdist
pip install --upgrade build
python -m build
```
- Create the wheel file
```bash
pip install --upgrade wheel
python setup.py bdist_wheel
```
- check it: `ls dist` should show two files a `.tar.gz` file and a `.whl` file
- Check it: `ls dist` should show two files a `.tar.gz` file and a `.whl` file
5. _Optional_ - At this point you could do an optional test installation ([see below](#optional-test-installation))
6. Upload to PYPI
1. _One-time-only auth setup:_ Login to pypi and then in your account settings, go to the API tokens section and select "Add API token". Give it any name and select scope to project:firefly-client and create token. To save this token for later uses, make sure to create a `$HOME/.pypirc` file (or update it if you already have it) with the following:
Expand All @@ -35,22 +32,21 @@
pip install --upgrade twine
twine upload dist/* --repository firefly-client
```
7. If any files were edited (i.e `setup.py`)
7. If any files were edited (i.e `pyproject.toml`)
- `git commit - a`
- `git push origin master`
8. Tag
- `git tag -a 2.5.0` (replace version number with the current version from setup.py)
- `git tag -a 2.5.0` (replace version number with the current version from pyproject.toml)
9. Push tags
- `git push --tags`
10. After this you can install
- `pip install firefly_client`
11. Make is release with github, using the tag above
11. Make a release with github, using the tag above
- https://github.com/Caltech-IPAC/firefly_client/releases
## PYPI
- https://pypi.org/project/firefly-client/
- Currently two maintainers
- Must be maintainer at https://pypi.org/project/firefly-client/
- Testing site: https://test.pypi.org/project/firefly-client/
## Optional Test installation
Expand All @@ -63,7 +59,7 @@
## Conda and conda-forge
Anytime the version tag is updated conda-forge it set up to do a pull and add `firefly_client` to its distribution.
Anytime the version tag is updated, conda-forge is set up to do a pull and add `firefly_client` to its distribution.
See the following sites:
- https://github.com/conda-forge/firefly-client-feedstock/
Expand Down
9 changes: 7 additions & 2 deletions firefly_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from importlib.metadata import PackageNotFoundError, version

from .firefly_client import FireflyClient
from .ffws import FFWs
from .env import Env
from .range_values import RangeValues
import pkg_resources

__version__ = pkg_resources.get_distribution("firefly_client").version
try:
__version__ = version("firefly_client")
except PackageNotFoundError:
# package is not installed
__version__ = None
4 changes: 2 additions & 2 deletions firefly_client/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def raise_invalid_lab_error(cls):
if not cls.firefly_channel_lab:
raise RuntimeError(COULD_NO_FIND_ENV + ENV_FF_CHANNEL_LAB + '. ' + EXT_INCORRECT + ' ' + SUGGESTION)
if not cls.firefly_url_lab:
raise RuntimeError(COULD_NO_FIND_ENV + ENV_FF_URL_LAB_LAB + '. ' + EXT_INCORRECT + ' ' + SUGGESTION)
raise RuntimeError(COULD_NO_FIND_ENV + ENV_FF_URL_LAB + '. ' + EXT_INCORRECT + ' ' + SUGGESTION)

@classmethod
def show_start_browser_tab_msg(cls, url):
Expand Down Expand Up @@ -99,6 +99,6 @@ def failed_net_message(cls, location, status_code=-1):
if cls.firefly_lab_extension and cls.firefly_url_lab:
err_message += ('\nCheck the Firefly URL in ~/.jupyter/jupyter_notebook_config.py' +
' or ~/.jupyter/jupyter_notebook_config.json')
elif firefly_url:
elif cls.firefly_url:
err_message += 'Check setting of FIREFLY_URL environment variable: %s' % cls.firefly_url
return err_message
4 changes: 2 additions & 2 deletions firefly_client/firefly_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def show_lab_tab(self, html_file=_def_html_file):
@staticmethod
def get_viewer_mode(html_file, viewer_override):
if viewer_override:
if viewer_override in _viewer_modes:
if viewer_override in FireflyClient._viewer_modes:
return viewer_override
else:
warn('viewer_override mode: {} is not a recognized mode, using {}'.format(viewer_override, UNKNOWN))
Expand Down Expand Up @@ -348,7 +348,7 @@ def add_listener(self, callback, name=ALL):
def header_cb(headers): self.header_from_ws = headers
FFWs.add_listener(self.wsproto, self.auth_headers, self.channel, self.location, callback, name, header_cb)
except ConnectionRefusedError as err:
raise ValueError(err_message) from err
raise ValueError(f"Couldn't add listener: {err}") from err

def remove_listener(self, callback, name=ALL):
"""
Expand Down
52 changes: 52 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[build-system]
requires = ["setuptools >= 64.0"]
build-backend = "setuptools.build_meta"

[project]
name = "firefly_client"
version = "3.0.2"
description = "Python API for Firefly: display astronomical data as tables, images, charts, and more!"
authors = [
{name = "IPAC LSST SUIT"}
]
readme = "README.md"
license = {file = "License.txt"}
requires-python = ">=3.8"
dependencies = [
"websocket-client",
"requests"
]
keywords = [
"jupyter",
"firefly",
"caltech",
"ipac",
"astronomy",
"visualization",
"images",
"charts",
"tables"
]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Framework :: Jupyter",
"Framework :: Jupyter :: JupyterLab",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Scientific/Engineering :: Visualization",
"Programming Language :: Python",
"Programming Language :: Python :: 3"
]

[project.urls]
Homepage = "https://github.com/Caltech-IPAC/firefly_client"
Documentation = "https://caltech-ipac.github.io/firefly_client"
Repository = "http://github.com/Caltech-IPAC/firefly_client.git"

[project.optional-dependencies]
docs = [
"Sphinx~=7.1.0",
"sphinx-automodapi",
"pydata-sphinx-theme",
"myst-parser"
]
9 changes: 0 additions & 9 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

20 changes: 0 additions & 20 deletions setup.py

This file was deleted.

0 comments on commit 94c00c5

Please sign in to comment.