Conversation
webknjaz
left a comment
There was a problem hiding this comment.
Factor out all unrelated changes into separate PRs.
.travis.yml
Outdated
| - "nightly" # currently points to 3.6-dev | ||
| # command to run tests | ||
| script: nosetests | ||
| notifications: |
There was a problem hiding this comment.
Don't modify notifications. It's not related, nor needed.
.travis.yml
Outdated
| email: | ||
| on_success: never | ||
| on_failure: always | ||
| deploy: |
There was a problem hiding this comment.
Current implementation adds this step to all jobs in the matrix. The suggestion is to create an additional stage with a separate job for deployment. And then use if-clause to run that stage only for tagged commits.
.travis.yml
Outdated
| password: | ||
| secure: | ||
| on: | ||
| branch: master |
There was a problem hiding this comment.
It shouldn't be triggered for every single commit in master. Only tagged builds should publish dist.
requirements.txt
Outdated
| @@ -0,0 +1 @@ | |||
| nose==1.3.7 | |||
setup.py
Outdated
| version='1.0', | ||
| py_modules=['pysize'], | ||
| ) No newline at end of file | ||
| with open("README.md", "r") as fh: |
There was a problem hiding this comment.
For Python 2 compat use io.open() with UTF-8 encoding. Also, newer setuptools allow using declarative setup.cfg, but that'd require upgrading setuptools in CI.
setup.py
Outdated
| version="1.0", | ||
| description="Use to quickly measure the size of your python objects.", | ||
| py_modules=["pysize"], | ||
| package_dir={"": "src"}, |
There was a problem hiding this comment.
Why do you combine this with py_modules?
src/pysize.py
Outdated
| # self-referential objects | ||
| seen.add(obj_id) | ||
| if hasattr(obj, '__dict__'): | ||
| if hasattr(obj, "__dict__"): |
| @@ -1,5 +1,6 @@ | |||
| import sys | |||
setup.py
Outdated
|
|
||
| setup( | ||
| name="pysize", | ||
| version="1.0", |
There was a problem hiding this comment.
How about integrating setuptools-scm? Maybe in a follow up PR.
setup.py
Outdated
| about = {} | ||
| if not VERSION: | ||
| with open(os.path.join(here, NAME, '__version__.py')) as f: | ||
| exec(f.read(), about) |
There was a problem hiding this comment.
No, it's a horrible idea and not related to what I asked. https://github.com/pypa/setuptools_scm
__version__.py
Outdated
| @@ -0,0 +1,3 @@ | |||
| VERSION = (0, 0, 1) | |||
MANIFEST.in
Outdated
| @@ -0,0 +1 @@ | |||
| include README.md LICENSE | |||
There was a problem hiding this comment.
setuptools-scm takes care of manifest better.
| version='1.0', | ||
| py_modules=['pysize'], | ||
| ) No newline at end of file | ||
| __requires__ = ('setuptools >=36.3.0', ) |
There was a problem hiding this comment.
@bosswissam do you think you want to require this version of setuptools as a pre-requisite?
There was a problem hiding this comment.
what's your recommendation? Sorry not super familiar with pypi setup.
There was a problem hiding this comment.
Well, the question is what do you want for your users.
You're going to have a wheel (binary dist) and a tarball (source dist).
When building wheel, it's okay to upgrade setuptools in CI to use latest features.
But when it comes to users they may have older setuptools on their machines.
It doesn't affect wheel, because its installation is just unpacking a zip archive.
With sdist it's a bit more complicated: pip install actually executes setup.py install under the hood. So all those options/meta stored in setup.cfg will simply not be read. Of course, I've got a shim for that if needed.
But most of the users will install from wheel anyway.
The decision is up to you.
setup.cfg
Outdated
| author = bosswissam | ||
| author_email = bosswissam@gmail.com | ||
| description = Use to quickly measure the size of your python objects. | ||
| long_description = file: README.md |
There was a problem hiding this comment.
@bosswissam is it okay if we convert README into rst?
@serhii73 if we'll decide to keep Markdown, it'll require one extra option to be set in metadata, explicitly declaring the correct MIME type of the description.
.travis.yml
Outdated
| dist: xenial | ||
| sudo: true | ||
|
|
||
| - python: 3.5 |
There was a problem hiding this comment.
All Pythons except for 3.7 don't need sudo, nor they need xenial. Revert this change and only leave 3.7 inside of jobs.include
setup.cfg
Outdated
| [options] | ||
| python_requires = >=2.6 | ||
| install_requires = | ||
| nose |
There was a problem hiding this comment.
I believe it's not a runtime requirement. So you have to remove it.
README.rst
Outdated
| pysize | ||
| ====== | ||
|
|
||
| Use to quickly measure the size of your python objects. Supports: \* Measuring the size of self-referential objects \* No double-counting for repeated objects in a collection \* Python v2/v3 |
README.rst
Outdated
| .. code:: python | ||
|
|
||
| >>> class Test(object): | ||
| >>> pass |
README.rst
Outdated
| >>> get_size(y) | ||
| 80971 | ||
|
|
||
| To measure the size of ``properties``, call ``pysize.get_size`` on the full list of the object's members minus overhead and unwanted memberes: |
README.rst
Outdated
| License | ||
| ======= | ||
|
|
||
| `MIT <LICENSE.txt>`__ |
There was a problem hiding this comment.
I believe it needs a single trailing underscore.
README.rst
Outdated
| License | ||
| ======= | ||
|
|
||
| `MIT <LICENSE.txt>`__ |
.travis.yml
Outdated
| @@ -1,12 +1,12 @@ | |||
| conditions: v1 | |||
There was a problem hiding this comment.
Why did you remove it? you should add it back!
.travis.yml
Outdated
|
|
||
| script: nosetests | ||
| install: | ||
| - pip install pytest==3.9.1 |
webknjaz
left a comment
There was a problem hiding this comment.
Get back conditions opt-in and revert unrelated test runner change.
webknjaz
left a comment
There was a problem hiding this comment.
It's not about removing the existing things, but adding what's stated in the PR title.
| language: python | ||
|
|
||
| python: | ||
| - "2.6" |
setup.cfg
Outdated
| license_file = LICENSE.rst | ||
| keywords = | ||
| check | ||
| Python |
.travis.yml
Outdated
| - "3.5-dev" # 3.5 development branch | ||
| - "nightly" # currently points to 3.6-dev | ||
| # command to run tests | ||
| - 2.6 |
There was a problem hiding this comment.
Keep the original syntax, it shouldn't appear in this diff.
There was a problem hiding this comment.
(refactoring is not related to the PR purpose)
.travis.yml
Outdated
| - 3.4 | ||
| - 3.5 | ||
| - 3.6 | ||
| - 3.7 |
There was a problem hiding this comment.
It's already in jobs.include + it doesn't work like others and will error out in Travis CI.
| - 3.7 |
| tags: true | ||
| user: bosswissam | ||
| password: | ||
| secure: |
There was a problem hiding this comment.
@bosswissam you should use the command travis encrypt to encrypt your password and put the result in here.
.travis.yml
Outdated
| - 3.4 | ||
| - 3.5 | ||
| - 3.6 | ||
| - 3.7 |
There was a problem hiding this comment.
Look at https://travis-ci.org/bosswissam/pysize/builds/443226261. There's two jobs for 3.7. The first one (failing) is this line and the second one is one in jobs.include, which is configured properly.
The way it works is that Travis CI generates a matrix of jobs from python: section and for each of them it uses script:/install: from the root level of this config.
Jobs in jobs.include inherit all of the steps from the root level, but when you explicitly specify different values for things those override inherited settings.
So for the failing job the config is:
dist: trusty # implicit default
sudo: false # implicit default
language: python # specified explicitly
python: 3.7 # specified explicitly
install: pip install -r requirements.txt # implicit default
script: nosetests # specified explicitlyAnd for succeeding job it's:
dist: xenial # specified explicitly, overrides value from config root level
sudo: true # specified explicitly, overrides value from config root level
python: 3.7 # specified explicitly, overrides value from config root level
install: pip install -r requirements.txt # inherited from config root
script: nosetests # inherited from config rootP.S. If you are not sure how the config you wrote has been parsed by Travis, there's a "View config" tab in each job, like:
setup.cfg
Outdated
| @@ -0,0 +1,45 @@ | |||
| [metadata] | |||
| name = pysize | |||
There was a problem hiding this comment.
Project/package distribution with this name already exists on PyPI: https://pypi.org/p/pysize. The upload will fail should you try to reuse it.
Let's use smth else like pysize-inspector.
| name = pysize | |
| name = pysize-inspector |
cc @bosswissam ^
.travis.yml
Outdated
| @@ -10,3 +11,30 @@ python: | |||
| - "nightly" # currently points to 3.6-dev | |||
There was a problem hiding this comment.
I think it's okay to replace 3.5-dev with 3.6 in this PR, so that we'd have the whole version coverage.
README.rst
Outdated
| |Build Status| | ||
|
|
||
| pysize-inspector | ||
| ====== |
There was a problem hiding this comment.
Underline should match the test length.
| @@ -0,0 +1,45 @@ | |||
| [metadata] | |||
| name = pysize-inspector | |||
.travis.yml
Outdated
| sudo: true | ||
|
|
||
| - stage: &stage_deploy_name upload new version of python package to PYPI (only for tagged commits) | ||
| name: "Deploy" |
There was a problem hiding this comment.
Quotes are not really needed for strings unless you use some special characters there, which you don't.
webknjaz
left a comment
There was a problem hiding this comment.
LGTM
@bosswissam would you please add encrypted PyPI creds to Travis CI config?
|
Sorry for the delay on my end. This is on my radar, just need some time to make sure I'm making the right decision re setup.py & pypi naming. |
|
@bosswissam maybe we'd just drop in the shim for supporting fairly old setuptools? This would reduce the number of questions :) |
Resolve #13