Skip to content
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

Publish an alpha to pypi #5

Closed
lb- opened this issue Feb 13, 2022 · 4 comments
Closed

Publish an alpha to pypi #5

lb- opened this issue Feb 13, 2022 · 4 comments

Comments

@lb-
Copy link
Member

lb- commented Feb 13, 2022

Publish an alpha of this package so that we can test an install on the Wagtail core code.

@lb-
Copy link
Member Author

lb- commented Feb 13, 2022

@zerolab please let me know if you're able to help out with this in the coming week.

As per wagtail/wagtail#6228

We want to be able to test this package installation so we can move ahead with the hallo code removal in this PR wagtail/wagtail#7922

@zerolab
Copy link
Collaborator

zerolab commented Feb 13, 2022

@lb- will submit a PR this afternoon

@zerolab
Copy link
Collaborator

zerolab commented Feb 13, 2022

@lb- I don't have write access to this repo to push a proper alpha (as in proper version change and so on)

the repo already has all it needs, so all you need to do locally:

  • pip install twine
  • python3 setup.py clean --all sdist bdist_wheel
  • twine upload dist/* <-- pushes to PyPI
Here's a patch for PEP compliant version handling for (alpha, rc, etc)
diff --git a/wagtail_hallo/__init__.py b/wagtail_hallo/__init__.py
index f3f130b..3a3fb48 100644
--- a/wagtail_hallo/__init__.py
+++ b/wagtail_hallo/__init__.py
@@ -1,5 +1,45 @@
 default_app_config = "wagtail_hallo.apps.WagtailHalloAppConfig"

+# This file is heavily inspired by django.utils.version

-VERSION = (0, 1, 0)
+
+def get_version(version):
+    """Return a PEP 440-compliant version number from VERSION."""
+    version = get_complete_version(version)
+
+    # Now build the two parts of the version number:
+    # main = X.Y[.Z]
+    # sub = .devN - for pre-alpha releases
+    #     | {a|b|rc}N - for alpha, beta, and rc releases
+
+    main = get_main_version(version)
+
+    sub = ""
+    if version[3] != "final":
+        mapping = {"alpha": "a", "beta": "b", "rc": "rc", "dev": ".dev"}
+        sub = mapping[version[3]] + str(version[4])
+
+    return main + sub
+
+
+def get_main_version(version):
+    """Return main version (X.Y[.Z]) from VERSION."""
+    version = get_complete_version(version)
+    parts = 2 if version[2] == 0 else 3
+    return ".".join(str(x) for x in version[:parts])
+
+
+def get_complete_version(version):
+    """
+    Return a tuple of the Wagtail version. If version argument is non-empty,
+    check for correctness of the tuple provided.
+    """
+    assert len(version) == 5
+    assert version[3] in ("dev", "alpha", "beta", "rc", "final")
+
+    return version
+
+
+VERSION = (0, 1, 0, "alpha", "1")
 __version__ = ".".join(map(str, VERSION))
+

@lb-
Copy link
Member Author

lb- commented Feb 15, 2022

https://pypi.org/project/wagtail-hallo/0.1.0a1/ - thanks @zerolab worked a treat

@lb- lb- closed this as completed Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants