-
Notifications
You must be signed in to change notification settings - Fork 19
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
changes to setup, remove teal #63
Conversation
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.
I am not sure if this is enough. I don't see any pyproject.toml
. Also there are still metadata left in setup.py
that can be moved to setup.cfg
.
You also want to try to actually package this thing and make sure you can install both the packaged tarball and wheel (separately) and get back a working install. If you want to take this a step further, you can automate like https://github.com/astropy/pytest-doctestplus/blob/main/.github/workflows/publish.yml .
It is unfortunate that this package does not have a test suite, so all you can do is to make sure the installation works (i.e., you can import the package) but not guarantee that it would work correctly.
p.s. I see Matt R put in https://github.com/spacetelescope/wfc3tools/blob/master/.github/workflows/publish-to-pypi.yml but that does not run as CI and not very sure how you ask it to only run as packaging test but not upload anything. Anyways, you cannot have two publish workflows, so you need to delete this one if you are going to add the other one to CI. |
As Pey-Lian mentioned - add a pyproject.toml file. Then refactor |
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.
In setup.py
, we should determine what information goes as PACKAGENAME, AUTHOR, etc.
In __init__.py
, if we're going to use from __future__
that should be refactored. from .version
is looking for a module named wfc3tools.version
, which doesn't exist. Nadia mentioned refactoring __version__
like the other packages, but I don't know if that solves the problem.
@FDauphin , all the metadata should now be in |
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.
(Just a quick review of that you have so far.)
Change package_name
in setup.cfg
to just name
.
You don't need anything in setup.py
besides invoking setuptools_scm
to generate the version file. Move all the remaining metadata to appropriate sections in setup.cfg
.
pyproject.toml
Outdated
|
||
[tool.setuptools_scm] |
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.
Don't need this?
[tool.setuptools_scm] |
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.
roman and jwst both include this in this file, is it not necessary? what does including it here imply, that its needed for the setup?
wfc3tools/__init__.py
Outdated
if sys.version_info < (3, 6): | ||
raise ImportError("wfc3tools supports Python versions 3.6 and above.") # pragma: no cover | ||
|
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.
Don't need this. Enforced by setting in setup.cfg
.
if sys.version_info < (3, 6): | |
raise ImportError("wfc3tools supports Python versions 3.6 and above.") # pragma: no cover |
wfc3tools/__init__.py
Outdated
raise ImportError("wfc3tools supports Python versions 3.6 and above.") # pragma: no cover | ||
|
||
try: | ||
__version__ = get_distribution(__name__).version |
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 is overkill. If setuptools_scm worked correctly, you can do from .version import version as __version__
directly.
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.
@nden commented to say I should add version in init
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.
i've remove the minimum version check in this file, since setup.cfg should be enforcing this (i think?). i also did not add a version here because even without declaring it here, I am still able to access wfc3tools.version, so I assume this is done by setuptools
I'm removing doc related extras in setup.cfg. I'm going to open up another PR with all the doc stuff. Theres a lot in there and I want to distill it down to what is actually required. |
setup.py
Outdated
import pytest | ||
errno = pytest.main(self.test_args) | ||
sys.exit(errno) | ||
NAME = 'wfc3tools' |
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.
I think this is not needed. It's defined in setup.cfg
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.
I installed the package and found a few minor issues. After fixing them I think this is good to go.
wfc3tools/util.py
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
from __future__ import print_function, division | |||
import warnings | |||
from .version import __version__ | |||
importlib.metadata import version |
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 is not going to work, missing from
setup.cfg
Outdated
author = STScI | ||
author_email = help@stsci.edu | ||
license = BSD | ||
edit_on_github = False | ||
github_project = spacetelescope/wfc3tools | ||
description-file = README.rst |
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.
When I install the package I see a Warning
UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
MANIFEST.in
Outdated
include README.rst | ||
include CHANGES.rst | ||
include setup.cfg | ||
include LICENSE |
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 actual name is LICENSE.txt
aa1a041
to
9056293
Compare
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.
Close...
If you want to remove the TEAL doc, should at least move them to proper RTD sections so we don't lose the info.
Also, I don't see any CI set up to test the packaging.
setup.py
Outdated
use_scm_version=True, | ||
setup_requires=['setuptools_scm'], | ||
packages=find_packages()) |
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.
use_scm_version=True, | |
setup_requires=['setuptools_scm'], | |
packages=find_packages()) | |
use_scm_version={'write_to': 'wfc3tools/version.py'}) |
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.
done, but just curious why 'packages' isn't needed?
setup.py
Outdated
@@ -1,82 +1,7 @@ | |||
#!/usr/bin/env python | |||
import os | |||
import subprocess | |||
import sys | |||
from setuptools import setup, find_packages |
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.
from setuptools import setup, find_packages | |
from setuptools import setup |
wfc3tools/__init__.py
Outdated
teal.print_tasknames(__name__, os.path.dirname(__file__)) | ||
except (ImportError, UnboundLocalError): | ||
print("Teal not installed, gui param editing disabled") | ||
__version__ = version('wfc3tools') |
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.
__version__ = version('wfc3tools') | |
try: | |
from .version import version as __version__ | |
except ImportError: | |
__version__ = '' |
|
||
# STSCI | ||
from stsci.tools import parseinput | ||
from .util import error_code | ||
|
||
try: | ||
from stsci.tools import teal |
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.
Is WFC3 team ok with removing TEAL support? This seems out of scope.
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.
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.
Back in September, I asked Michele De La Pena (might be helpful to ask her review as well) if we could remove TEAL support, but she said she was unsure. I am in support of removing it because I do not know in any instances where TEAL is the preferred method of using wfc3tools
.
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.
I agree that TEAL has probably outlived its usefulness, but someone should do the due diligence to make sure all the doc you are deleting are already reflected in RTD docs. If not, they have to be ported. Otherwise, you might lose precious info. Up to you.
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 info in the .help files is going to be added back in by fred's PR
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.
@cshanahan1 is correct; the help files info is added as docstrings in PEP 8 style and is added in the RTD. However, in the new RTD I initially removed all TEAL dependency. I suppose it would be best to add a sentence or two on the main RTD page that TEAL dependency was removed and why so.
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.
I was able to clone this branch, install wfc3tools
, and import with no issues. With regards to TEAL, I asked Michele De La Pena if removing it is the right decision (which I think it is).
In terms of packaging, testing source install isn't enough. You want to make sure you are able to build sdist and wheel, and then install those and get a full package back. I recently had to help debug another package that accidentally released an empty wheel. |
I built and tested a source package and a wheel. I can confirm they work. |
@pllim The idea for this PR is to make the build scripts up to date and release so we can start putting together and testing a larger HST distribution. The documentation will come in the next PR, followed by a new release but meanwhile we can work on the larger HST distribution. Is there anything else you would like to see done for this PR? |
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.
For completeness, maybe remove the following from .gitignore
:
RELIC-INFO
relic/
Otherwise, LGTM. Thanks!
d99a1db
to
f7d7723
Compare
f7d7723
to
7e6971c
Compare
ok thanks everyone! im going to merge this now |
@cshanahan1 thanks for your work on this! Michele followed up and said as long as |
Made changes to setup files to install dependencies and remove 'relic' I also removed some pytest setup since there are currently no tests in this package. I also removed everything related to 'teal'.