Skip to content

Commit

Permalink
added auto publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
facundoq committed Dec 27, 2023
1 parent c44aac2 commit c937f69
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 30 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/pipy_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Python 🐍 distributions 📦 to PyPI

on:
push:
tags:
- '*'
jobs:
build:
name: Build 📦 publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tmeasures
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/setuptools
run: >-
python -m
pip install wheel setuptools
- name: Extract tag name to use as version
id: tag
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Update version in setup.py
run: >-
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py
- name: Build a binary wheel
run: >-
python setup.py sdist bdist_wheel --universal
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}


4 changes: 2 additions & 2 deletions .github/workflows/tests.py → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8']
python-version: ['3.10']
backend: [tensorflow, pytorch]
os: [ubuntu-latest] #, macos-latest, windows-latest]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


url="https://github.com/facundoq/tmeasures"
VERSION="1.2.5"
VERSION="{{VERSION_PLACEHOLDER}}"

class UploadCommand(Command):
"""Support setup.py upload."""
Expand Down Expand Up @@ -105,7 +105,7 @@ def run(self):
# could also include long_description, download_url, etc.
long_description=long_description,
long_description_content_type='text/markdown',
cmdclass={
'upload': UploadCommand,
},
# cmdclass={
# 'upload': UploadCommand,
# },
)
24 changes: 0 additions & 24 deletions tmeasures/pytorch/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,3 @@ def abbreviation(self, name:str)->str:
name = "b"
return name

import ctypes, os, threading
def set_thread_name_np(the_name):
the_lib_path = "/lib/libpthread-2.42.so"
if not os.path.isfile(the_lib_path):
return None
try:
libpthread = ctypes.CDLL(the_lib_path)
except:
return None
if hasattr(libpthread, "pthread_setname_np"):
pthread_setname_np = libpthread.pthread_setname_np
pthread_setname_np.argtypes = [ctypes.c_void_p,
ctypes.c_char_p]
pthread_setname_np.restype = ctypes.c_int
if isinstance(the_name, str):
the_name = the_name.encode('ascii', 'replace')
if type(the_name) is not bytes:
return None
the_thread = threading.current_thread()
ident = getattr(the_thread, "ident", None)
if ident is not None:
pthread_setname_np(ident, the_name[:15])
return True
return None

0 comments on commit c937f69

Please sign in to comment.