-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add a pre-commit hook for this tool #33
Comments
astropy/astropy#15257 for a discussion on this in Astropy |
I don't really have time to work on this right now. This was mainly a tool that I cooked up to help me solve a problem I had at the time. But if you or someone else wants to work to improve it I'm happy to give people push access. |
Hi @asmeurer! Thanks for this amazing tool! I just bumped into this issue and I have been working on something similar as a side project - My fork, I would be more than happy to create PRs here once I get the pre-commit stuff working on my fork, or I would also be more than happy to maintain the fork separately. Please let me know how I should work on this. Thanks! :) Notes from the README of
|
Great. There's no need to fork to a separate project, though. Like I said, I'm happy to give people access here if you want to continue work on removestar |
Yes, I would love that! I can start pushing the changes that are actually ready, including |
I got the pre-commit working :) Adding the following to astropy's - repo: https://github.com/Saransh-cpp/rmstar
rev: f7c340ad7d8cc9496aaadbd88ae27b7e41dfcfd1 # Haven't made a release
hooks:
- id: rmstar
args: [] # See removestar's docs for all args (-i edits file in-place)
additional_dependencies: # The libraries or packages your code imports
- . # Should be . if running inside a library (to install the library itself in the environment)
- sphinx_astropy gives me the following output - rmstar...................................................................Failed
- hook id: rmstar
- duration: 4.4s
- exit code: 1
--- original/astropy/modeling/models.py
+++ fixed/astropy/modeling/models.py
@@ -6,15 +6,15 @@
from . import math_functions as math
from .core import custom_model, fix_inputs, hide_inverse
-from .functional_models import *
-from .mappings import *
-from .physical_models import *
-from .polynomial import *
-from .powerlaws import *
-from .projections import *
-from .rotations import *
-from .spline import *
-from .tabular import *
+from .functional_models import (AiryDisk2D, ArcCosine1D, ArcSine1D, ArcTangent1D, Box1D, Box2D,
+ Const1D, Const2D, Cosine1D, Disk2D, Ellipse2D, Gaussian1D,
+ Gaussian2D, KingProjectedAnalytic1D, Linear1D, Lorentz1D, Moffat1D,
+ Moffat2D, RickerWavelet1D, RickerWavelet2D, Sersic1D, Sersic2D,
+ Sine1D, Tangent1D, Trapezoid1D, TrapezoidDisk2D, Voigt1D)
+from .physical_models import NFW
+from .polynomial import (Chebyshev1D, Chebyshev2D, Hermite1D, Hermite2D, Legendre1D, Legendre2D,
+ Polynomial1D, Polynomial2D)
+from .powerlaws import PowerLaw1D
# Attach a docstring explaining constraints to all models which support them.
# Note: add new models to this list
warnings.warn(
Warning: docs/conf.py: The removed star import statement for 'sphinx_astropy.conf.v1' had an inline comment which may not make sense without the import
--- original/docs/conf.py
+++ fixed/docs/conf.py
@@ -60,7 +60,7 @@
print('Please install the "docs" requirements.')
sys.exit(1)
-from sphinx_astropy.conf.v1 import * # noqa: E402
+# noqa: E402
from sphinx_astropy.conf.v1 import ( # noqa: E402
exclude_patterns,
extensions, The output does look good. Adding the astropy/astropy#15258 cleaned up the PS: Please let me know how should I push the changes upstream. |
@Saransh-cpp this looks very good! The |
@Saransh-cpp, you can open a PR on Astropy adding |
Sent you both invites to be collaborators on this repo. |
Hi all, just saw this issue; I created a pre-commit hook for removestar (removestar-pre-commit) a few months back for personal use if useful - but looks like changes are nearly there Awesome project by the way ✌️ |
Thanks! I'll still create PRs and merge them on my own just so the changes are easily visible.
There is already one, according to the docs here - https://github.com/asmeurer/removestar#whitelisting-star-imports
Great! Will do once I push all the changes upstream!
This looks great! I'll take a look at the config! |
If someone wants to take a look at the existing open PRs that would be great too. I've been neglecting them, but I think at least #31 is probably ready to be merged. |
Everything works now - https://results.pre-commit.ci/run/github/2081289/1693857593.zi7J0ShNQN-5w65zCDEgBA! @nstarman @kieran-ryan could you please take a look? @asmeurer could you please configure the trusted publisher thing for this repository? I will then make a release (if everything looks right) on GitHub, triggering cd.yml and creating a new release on PyPI. Thanks! |
The PR in Astropy looks good. We'll have to add |
Just give me your PyPI username and I'll add you there. |
Great! That would be Saransh-cpp - thanks! |
Thanks for the invite, @asmeurer! Unfortunately, I cannot access the "Manage" part (and subsequently the "Publishing" part) of the project. Would it be possible for you to bump my role in PyPI? Thanks again! |
Made a new release and everything works well so far! Closing this, thanks for the discussion here! |
Looks very useful! A pre-commit tool to run this as a CI check would be lovely.
The text was updated successfully, but these errors were encountered: