Skip to content
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
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"

[project]
name = "pyflapjack"
version = "1.0.6"
version = "1.0.14"
description = "Python package that interfaces the Flapjack API"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.7,<3.11"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Align supported Python range with pinned dependencies

requires-python now advertises support for Python 3.7 and 3.8, but this release pins numpy==1.26.2 and scipy==1.11.0, which require Python 3.9+, so installs on 3.7/3.8 will fail dependency resolution despite metadata claiming compatibility. This creates a packaging regression for users/environments that select interpreters based on requires-python; tighten the lower bound (e.g., >=3.9) or downgrade pins to versions compatible with the declared range.

Useful? React with 👍 / 👎.

license = {file = "LICENSE"}
keywords = ["flapjack", "data", "experimental", "analysis", "synthetic biology"]
authors = [
Expand All @@ -24,18 +24,18 @@ classifiers = [
]

dependencies = [
'numpy==1.21.2',
'scipy==1.8.0',
'pandas==1.3.3',
'requests==2.26.0',
'numpy== 1.26.2',
'scipy==1.11.0',
'pandas==1.5.3',
'requests>=2.25.1',
'tqdm==4.62.3',
'plotly==5.3.1',
'asyncio==3.4.3',
'nest_asyncio==1.5.1',
'requests_jwt==0.5.3',
'websockets==10.0',
'matplotlib==3.4.3',
'kaleido'
'matplotlib>=3.10',
'kaleido==0.2.1'
]

[project.optional-dependencies]
Expand Down
38 changes: 33 additions & 5 deletions src/flapjack/flapjack.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@ def __del__(self):

def handle_response(self, s):
return True

# Sign in to the server

def sign_up(self, username, password, email):
try:
s = requests.post(
self.http_url_base+'/api/auth/sign_up/',
data={
'username':username,
'password':password,
'email':email
}
)
except:
print(f'Sign up failed.')
else:
if self.handle_response(s):
print(f'Successfully signed up as {username}.')
self.log_in(username, password)

def register(self, username, password, password2, email):
try:
Expand All @@ -77,7 +96,17 @@ def register(self, username, password, password2, email):
data = s.json()
self.access_token = data['access']
self.refresh_token = data['refresh']


def log_in_token(self, username, access_token, refresh_token):
try:
self.username = username
self.access_token = access_token
self.refresh_token = refresh_token
except:
print(f'Invalid token')



def log_in(self, username, password):
try:
s = requests.post(
Expand All @@ -95,15 +124,14 @@ def log_in(self, username, password):
data = s.json()
self.access_token = data['access']
self.refresh_token = data['refresh']
self.username = username

def log_out(self):
if self.username:
try:
s = requests.post(
self.http_url_base+'/api/auth/log_out/',
data={
'username':username
'username':self.username
}
)
except:
Expand Down Expand Up @@ -165,7 +193,7 @@ def create(self, model, confirm=True, overwrite=False, **kwargs):
headers={'Authorization': 'Bearer ' + self.access_token},
data=kwargs
)
elif len(existing) and overwrite == False:
elif len(existing) and not overwrite:
print(f'Returning exististing model, {model}')
return existing

Expand Down Expand Up @@ -217,7 +245,7 @@ def get(self, model, **kwargs):
url = data['next']
df = pd.DataFrame(results)
# Convert ids from np.int64 to int
df.index = df.index.astype(np.int)
df.index = df.index.astype(int)
return df

def parse_params(self, **kwargs):
Expand Down