Skip to content

Commit

Permalink
Broken cython publish (#248)
Browse files Browse the repository at this point in the history
* sets the github action to only publish sdist packages to pypi as the wheels are missing the compiled versions
* change paper building to only build the paper during a pull request to the paper branch
* adds `noexception` flags to cython code where needed
  • Loading branch information
derNarr authored Nov 28, 2023
1 parent 23463a3 commit d8b4647
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Build paper PDF

on: [push]
on:
pull_request:
branches:
- paper

jobs:
paper:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ jobs:
name: ${{ matrix.os }} ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
poetry-version: [1.2]
os: [ubuntu-latest]
python-version: ['3.11']
# os: [ubuntu-latest, macOS-latest, windows-latest]
# python-version: ['3.8', '3.9', '3.10', '3.11']
poetry-version: [1.6]
fail-fast: false
runs-on: ${{ matrix.os }}

Expand All @@ -27,5 +29,7 @@ jobs:
poetry-version: ${{ matrix.poetry-version }}
- name: Install package
run: poetry install
- name: Build and publish package
run: poetry publish --build --skip-existing --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
- name: Build package
run: poetry build --format sdist
- name: Publish package
run: poetry publish --skip-existing --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
8 changes: 4 additions & 4 deletions pyndl/ndl_parallel.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ from error_codes cimport ErrorCode

cdef ErrorCode learn_inplace_binary_to_binary_ptr(char*, dtype_t, dtype_t, dtype_t, dtype_t,
dtype_t*, unsigned int, unsigned int*, unsigned int,
unsigned int) nogil
unsigned int) noexcept nogil


cdef ErrorCode learn_inplace_binary_to_real_ptr(char*, dtype_t, dtype_t*,
dtype_t*, unsigned int, unsigned int, unsigned int,
unsigned int) nogil
unsigned int) noexcept nogil


cdef ErrorCode learn_inplace_real_to_real_ptr(char*, dtype_t, dtype_t*,
dtype_t*, dtype_t*, unsigned int, unsigned int,
unsigned int, unsigned int) nogil
unsigned int, unsigned int) noexcept nogil


cdef ErrorCode learn_inplace_real_to_binary_ptr(char*, dtype_t, dtype_t,
dtype_t, dtype_t*, dtype_t*, unsigned int, unsigned
int, unsigned int) nogil
int, unsigned int) noexcept nogil
18 changes: 9 additions & 9 deletions pyndl/ndl_parallel.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ test_index += test_cue_index
assert test_index == 18446744069414584320


cdef inline void read_next_int(void *data, FILE *binary_file) nogil:
cdef inline void read_next_int(void *data, FILE *binary_file) noexcept nogil:
fread(data, 4, 1, binary_file) # little endian


cdef extern from "stdio.h":
#FILE * fopen ( const char * filename, const char * mode )
FILE *fopen(const char *, const char *) nogil
FILE *fopen(const char *, const char *) noexcept nogil
#int fclose ( FILE * stream )
int fclose(FILE *) nogil
int fclose(FILE *) noexcept nogil
#size_t fread ( void *ptr, size_t size, size_t count, FILE *stream );
size_t fread (void *, size_t, size_t, FILE *) nogil
size_t fread (void *, size_t, size_t, FILE *) noexcept nogil


def learn_inplace_binary_to_binary(binary_file_paths,
Expand Down Expand Up @@ -78,7 +78,7 @@ def learn_inplace_binary_to_binary(binary_file_paths,



cdef int is_element_of(unsigned int elem, unsigned int* arr, unsigned int size) nogil:
cdef int is_element_of(unsigned int elem, unsigned int* arr, unsigned int size) noexcept nogil:
cdef unsigned int ii
for ii in range(size):
if arr[ii] == elem:
Expand All @@ -94,7 +94,7 @@ cdef ErrorCode learn_inplace_binary_to_binary_ptr(char* binary_file_path,
unsigned int n_all_cues,
unsigned int* all_outcome_indices,
unsigned int start,
unsigned int end) nogil:
unsigned int end) noexcept nogil:


cdef unsigned int number_of_events, number_of_cues, number_of_outcomes
Expand Down Expand Up @@ -178,7 +178,7 @@ cdef ErrorCode learn_inplace_binary_to_real_ptr(char* binary_file_path,
unsigned int n_all_cues,
unsigned int n_outcome_vector_dimensions,
unsigned int start,
unsigned int end) nogil:
unsigned int end) noexcept nogil:


cdef unsigned int number_of_events, number_of_cues, number_of_outcomes
Expand Down Expand Up @@ -265,7 +265,7 @@ cdef ErrorCode learn_inplace_real_to_real_ptr(char* binary_file_path,
unsigned int n_cue_vector_dimensions,
unsigned int n_outcome_vector_dimensions,
unsigned int start,
unsigned int end) nogil:
unsigned int end) noexcept nogil:

cdef unsigned int number_of_events, number_of_cues, number_of_outcomes
cdef dtype_t association_strength, update, summed_cue_vector_value, summed_outcome_vector_value
Expand Down Expand Up @@ -376,7 +376,7 @@ cdef ErrorCode learn_inplace_real_to_binary_ptr(char* binary_file_path,
dtype_t* weights,
unsigned int n_cue_vector_dimensions,
unsigned int start,
unsigned int end) nogil:
unsigned int end) noexcept nogil:

cdef unsigned int number_of_events, number_of_cues, number_of_outcomes
cdef dtype_t association_strength, update, summed_cue_vector_value
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyndl"
version = "1.2.1"
version = "1.2.2"
description = "Naive discriminative learning implements learning and classification models based on the Rescorla-Wagner equations."

license = "MIT"
Expand Down

0 comments on commit d8b4647

Please sign in to comment.