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

Prep v0 8 0 #188

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 5 additions & 24 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ necessary package channels, and install CTLearn specified version and its depend

.. code-block:: bash

CTLEARN_VER=0.7.0
CTLEARN_VER=0.8.0
wget https://raw.githubusercontent.com/ctlearn-project/ctlearn/v$CTLEARN_VER/environment.yml
conda env create -n [ENVIRONMENT_NAME] -f environment.yml
conda activate [ENVIRONMENT_NAME]
Expand All @@ -54,29 +54,10 @@ Citing this software

Please cite the corresponding version using the DOIs below if this software package is used to produce results for any publication:

.. |zendoi060| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.6842323.svg
:target: https://doi.org/10.5281/zenodo.6842323
.. |zendoi052| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5947837.svg
:target: https://doi.org/10.5281/zenodo.5947837
.. |zendoi051| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5772815.svg
:target: https://doi.org/10.5281/zenodo.5772815
.. |zendoi050| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4576196.svg
:target: https://doi.org/10.5281/zenodo.4576196
.. |zendoi040| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3345947.svg
:target: https://doi.org/10.5281/zenodo.3345947
.. |zendoi040l| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3342954.svg
:target: https://doi.org/10.5281/zenodo.3342954
.. |zendoi031| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3342953.svg
:target: https://doi.org/10.5281/zenodo.3342953


* 0.6.0 : |zendoi050|
* 0.5.2 : |zendoi050|
* 0.5.1 : |zendoi050|
* 0.5.0 : |zendoi050|
* 0.4.0 : |zendoi040|
* 0.4.0-legacy : |zendoi040l|
* 0.3.1 : |zendoi031|
.. |zendoi070| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.7908252.svg
:target: https://doi.org/10.5281/zenodo.7908252

* 0.7.0 : |zendoi070|

Team
----
Expand Down
33 changes: 11 additions & 22 deletions ctlearn/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
but being much more lightwheight

"""
from subprocess import check_output, CalledProcessError, run, PIPE
from subprocess import check_output, CalledProcessError
from os import path, name, devnull, environ, listdir
from ast import literal_eval

Expand Down Expand Up @@ -78,36 +78,23 @@ def find_git_on_windows():
GIT_COMMAND = find_git_on_windows()


def get_current_version():
"""
Given a repository, list all tags for that repository
without cloning it and get the current version.
"""
result = run([
"git", "ls-remote", "--tags"
], stdout= PIPE, text=True)

output_lines = result.stdout.splitlines()

tags = [
line.split("refs/tags/")[-1] for line in output_lines
if "refs/tags/" in line and "^{}" not in line

]
last_tag = tags[-1][1:]
return last_tag


def get_git_describe_version(abbrev=7):
"""return the string output of git desribe"""
try:
return get_current_version()
with open(devnull, "w") as fnull:
arguments = [GIT_COMMAND, "describe", "--tags", "--abbrev=%d" % abbrev]
return (
check_output(arguments, cwd=CURRENT_DIRECTORY, stderr=fnull)
.decode("ascii")
.strip()
)
except (OSError, CalledProcessError):
return None


def format_git_describe(git_str, pep440=False):
"""format the result of calling 'git describe' as a python version"""

if "-" not in git_str: # currently at a tag
formatted_str = git_str
else:
Expand Down Expand Up @@ -171,9 +158,11 @@ def get_version(pep440=False):

The file VERSION will need to be changed manually.
"""

raw_git_version = get_git_describe_version()
if not raw_git_version: # not a git repository
return read_release_version()

git_version = format_git_describe(raw_git_version, pep440=pep440)

return git_version
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ channels:
- ctlearn-project
dependencies:
- python=3.10
- dl1_data_handler==0.10.10
- dl1_data_handler==0.11.1
- astropy
- matplotlib
- numpy
Expand Down
Loading