chartbeat-labs / textacy

NLP, before and after spaCy
https://textacy.readthedocs.io
Other
2.21k stars 249 forks source link

Old preprocess.py still deployed #281

Closed alexkiro closed 4 years ago

alexkiro commented 4 years ago

steps to reproduce

  1. install textacy via pip
  2. try to import textacy.preprocess
Python 3.7.3 (default, Oct  7 2019, 12:56:13) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import textacy
>>> import textacy.preprocess
>>> textacy.preprocess.replace_emails("test@example.com")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alexandru/env/lib/python3.7/site-packages/textacy/preprocess.py", line 108, in replace_emails
    return constants.RE_EMAIL.sub(replace_with, text)
AttributeError: module 'textacy.constants' has no attribute 'RE_EMAIL'
>>> 
>>> import textacy.preprocessing.replace
>>> textacy.preprocessing.replace.replace_emails("test@example.com")
'_EMAIL_'
>>> 
>>> textacy.__version__
'0.9.1'
>>> 

expected vs. actual behavior

It's expected that the old preprocess.py module would no longer be available, as it's out dated and no longer works. Created a bit of confusion when I upgrade to a newer textacy version :smile:

(env) ~$ ls -1ad env/lib/python3.7/site-packages/textacy/preprocess*
env/lib/python3.7/site-packages/textacy/preprocessing
env/lib/python3.7/site-packages/textacy/preprocess.py

possible solution?

The file has already been removed 61efd93f6f66d73a96afc71b2431214ecebdf317, but it seem it might have snuck in when the release was made.

The solution would be cleaning the build dir before doing the next release.

context

Creates confusion as the old methods are still there when installing e.g:

environment

bdewilde commented 4 years ago

Hi @alexkiro , just checking: Is it possible that an old preprocess.pyc module got left behind somehow, and that got pulled in when I built the release wheel? Or do you have that file locally?

I'm not able to replicate your issue:

(textacy) ~$ ipy
import textacy.preprocessPython 3.7.4 (default, Aug 23 2019, 13:12:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import textacy.preprocess
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-db3eaef95b4e> in <module>
----> 1 import textacy.preprocess

ModuleNotFoundError: No module named 'textacy.preprocess'
alexkiro commented 4 years ago

Hi @alexkiro , just checking: Is it possible that an old preprocess.pyc module got left behind somehow, and that got pulled in when I built the release wheel? Or do you have that file locally?

Nope, it's definitely in the wheel, a manually wget and unzip shows it there :smile:

(env) textacy$ wget https://files.pythonhosted.org/packages/3a/5e/3b8391cf6ff39350b73f8421184cf6792002b5c2c17982b7c9fbd5ff36de/textacy-0.9.1-py3-none-any.whl
--2019-11-14 11:45:55--  https://files.pythonhosted.org/packages/3a/5e/3b8391cf6ff39350b73f8421184cf6792002b5c2c17982b7c9fbd5ff36de/textacy-0.9.1-py3-none-any.whl
Resolving files.pythonhosted.org (files.pythonhosted.org)... 151.101.113.63, 2a04:4e42:1b::319
Connecting to files.pythonhosted.org (files.pythonhosted.org)|151.101.113.63|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 203846 (199K) [binary/octet-stream]
Saving to: ‘textacy-0.9.1-py3-none-any.whl’

textacy-0.9.1-py3-none-any.whl                       100%[======================================================================================================================>] 199.07K  --.-KB/s    in 0.1s    

2019-11-14 11:45:56 (1.34 MB/s) - ‘textacy-0.9.1-py3-none-any.whl’ saved [203846/203846]

(env) textacy$ unzip textacy-0.9.1-py3-none-any.whl | grep process
  inflating: textacy/preprocess.py   
  inflating: textacy/preprocessing/__init__.py  
  inflating: textacy/preprocessing/normalize.py  
  inflating: textacy/preprocessing/remove.py  
  inflating: textacy/preprocessing/replace.py  
  inflating: textacy/preprocessing/resources.py  
(env) textacy$ stat textacy/preprocess.py 
  File: textacy/preprocess.py
  Size: 9922        Blocks: 24         IO Block: 4096   regular file
Device: 812h/2066d  Inode: 3804388     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/alexandru)   Gid: ( 1000/alexandru)
Access: 2019-06-25 20:50:00.000000000 +0300
Modify: 2019-06-25 20:50:00.000000000 +0300
Change: 2019-11-14 11:46:09.580964189 +0200
 Birth: -
(env) textacy$ md5sum textacy/preprocess.py 
a4174fea49de771978529dad845a0ffb  textacy/preprocess.py
(env) textacy$
bdewilde commented 4 years ago

Hi! I've released a new version, and I'm pretty sure old .pyc files have been removed. Please holler if you notice that I've flubbed this again.