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

fix on tags feature #2

Merged
merged 6 commits into from
Sep 19, 2023
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
2 changes: 0 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ name: Upload Python Package
on:
release:
types: [published]
push:
tags: [feature-*]

jobs:
deploy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/py_utility-*.whl
pip install dist/pylabtools-*.whl
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ test.py

__pycache__
build
dist
tin_utility.egg-info
text.txt
py_utility.egg-info
dist
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# py_utility
# pylabtools

`py_utility` is a Python utility library that provides various helper functions for file and directory manipulation, text formatting, and logging.
`pylabtools` is a Python utility library that provides various helper functions for file and directory manipulation, text formatting, and logging.

## Installation

You can install py_utility using pip:
You can install pylabtools using pip:

```bash
pip install py_utility
pip install pylabtools
```

## Testing
Expand Down
2 changes: 1 addition & 1 deletion py_utility/__init__.py → pylabtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
x.replace(".py", "") for x in files if x.endswith(".py") and not x.startswith("__")
)
for module in modules:
__import__("py_utility." + module)
__import__("pylabtools." + module)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 10 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@
import subprocess
import os

cf_remote_version = (
remote_version = (
subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE)
.stdout.decode("utf-8")
.strip()
)

if "-" in cf_remote_version:
if "-" in remote_version:
# when not on tag, git describe outputs: "1.3.3-22-gdf81228"
# pip has gotten strict with version numbers
# so change it to: "1.3.3+22.git.gdf81228"
# See: https://peps.python.org/pep-0440/#local-version-segments
v,i,s = cf_remote_version.split("-")
cf_remote_version = v + "+" + i + ".git." + s
v,i,s = remote_version.split("-")
remote_version = v + "+" + i + ".git." + s

assert "-" not in cf_remote_version
assert "." in cf_remote_version
assert "-" not in remote_version
assert "." in remote_version

with open("README.md", "r") as f:
long_description = f.read()

setuptools.setup(
name="py_utility",
version=cf_remote_version,
name="pylabtools",
version=remote_version,
author="Tinnawong saelao",
author_email="[email protected]",
description="python utility for research",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/tinnawong/py_utility",
url="https://github.com/tinnawong/pylabtools",
packages=setuptools.find_packages(),
package_data={"py_utility": ["VERSION"]},
package_data={"pylabtools": ["VERSION"]},
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_file_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from unittest.mock import mock_open, patch
from py_utility import file_wrapper as fw
from pylabtools import file_wrapper as fw

class TestFileFunctions(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion tests/test_log_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from unittest.mock import patch, mock_open
import logging
from py_utility import log_wropper as lw
from pylabtools import log_wropper as lw

class TestLoggerSetup(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion tests/test_path_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import tempfile
import unittest
from py_utility import path_wrapper as pw
from pylabtools import path_wrapper as pw
class TestFileOperations(unittest.TestCase):

def setUp(self):
Expand Down
Loading