open-dis-python icon indicating copy to clipboard operation
open-dis-python copied to clipboard

Will this become a Pip package?

Open ztolley opened this issue 3 years ago • 11 comments

Are there any plans to make this a package installable via pip with versioned releases to help reliant projects pickup new fixes?

ztolley avatar Jan 11 '23 09:01 ztolley

@ztolley yes that was my intent. I tried a while back and hit a snag, maybe it's time I retry.

leif81 avatar Jan 11 '23 13:01 leif81

Could I check what is the oldest version of Python 3 this package would be intended to support?

ngjunsiang avatar Feb 23 '24 14:02 ngjunsiang

@ngjunsiang i'm not sure how to determine that

leif81 avatar Feb 24 '24 02:02 leif81

I am asking primarily because this would determine the main style and syntax to be used (e.g. class DataQueryDatumSpecification( object ): is required by Python2, but Python3 only requires class DataQueryDatumSpecification:)

Secondarily, Python3 versions 3.7 and up add new syntax features that might not be supported in earlier versions. E.g. dataclasses are only available for version 3.7, and would need an external import for support in 3.6 and earlier.

I noted that the README states this is a Python 3 implementation of DIS 7, so I assume this is not meant to be backward-compatible with any Python version earlier than 3.0. I am trying to determine which newer Python features I can use if I want to make any pull requests.

Furthermore, if packaging work is to be done, the Python requirement needs to be stated in pyproject.toml (with reference to the Python Packaging User Guide). I can help with this work when my commitments free up somewhat in the second half of this year. But I don't know how to begin finding out where open-dis-python is already being adopted, so as to avoid breaking backward compatibility with those projects if they switch to a pip-based install instead of building from source.

ngjunsiang avatar Feb 24 '24 03:02 ngjunsiang

Assuming there is no major prior use of open-dis-python that needs backward compatibility to be supported, I would recommend the following minimum versions:

Python 3.5

This is the earliest version that supports type annotations in functions and methods. This would make the code more readable and easier to understand at a glance, especially for those used to type specifications from Java and C++

Annotated functions, before and after

image image

Python 3.7

This is the earliest version that introduces dataclasses and the dataclass decorator and field object. The dataclass decorator uses type annotations on class attributes and uses them to provide default __init__() and __repr__() behaviour, which make introspection much easier with less code.

Before dataclass

image image

After dataclass (with type annotations)

image image

ngjunsiang avatar Feb 24 '24 16:02 ngjunsiang

@ngjunsiang It's difficult to know what version of Python users of the library are using.

I see that Python 3.5 was released in 2015 and Python 3.7 in 2018. And based on W3 stats for Python 3 (I'm not sure if these are the best stats) I see the following use in the Python 3 community:

  • 1.2% of users are using a version older than 3.5.
  • 33.8% of users are using a version older than 3.7.

Based on those stats, we may alienate up to 1/3 of the users by upgrading to 3.7 today, whereas almost no one would be impacted by updating to 3.5. On this info alone, I would suggest setting the base version to 3.5.

Two questions for the open-dis-python community. Lets leave this question open for a week to collect feedback.

  1. Are you using a version of Python older than 3.5?
  2. Would you be able to upgrade your application to Python 3.5?

leif81 avatar Feb 25 '24 18:02 leif81

Maybe consider a pyproject.toml? https://packaging.python.org/en/latest/guides/writing-pyproject-toml/

for enabling poetry-like integrations: https://python-poetry.org/docs/pyproject/

scottrbrtsn avatar Feb 29 '24 22:02 scottrbrtsn

This issue would make installing to Dockerfiles much easier also. I'm wondering if a docker swarm/k8s example would be worth the effort?

scottrbrtsn avatar Mar 01 '24 01:03 scottrbrtsn

fysa it appears that open-dis-python requires numpy which requires python 3.9 per: https://github.com/open-dis/open-dis-python/pull/50#issuecomment-1972350387

scottrbrtsn avatar Mar 01 '24 02:03 scottrbrtsn

@scottrbrtsn good catch. If we're already dependent on 3.9+ then we might as well stay with that baseline version.

leif81 avatar Mar 01 '24 13:03 leif81

Didn't think of this option:
pip install git+https://github.com/open-dis/open-dis-python works as is until a package is created in the global pypi.

scottrbrtsn avatar Mar 04 '24 14:03 scottrbrtsn