Skip to content

Add files for PYPI#14

Open
serhii73 wants to merge 29 commits intobosswissam:masterfrom
serhii73:pypi
Open

Add files for PYPI#14
serhii73 wants to merge 29 commits intobosswissam:masterfrom
serhii73:pypi

Conversation

@serhii73
Copy link

@serhii73 serhii73 commented Oct 1, 2018

Resolve #13

Copy link

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

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:
Copy link

Choose a reason for hiding this comment

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

Don't modify notifications. It's not related, nor needed.

.travis.yml Outdated
email:
on_success: never
on_failure: always
deploy:
Copy link

Choose a reason for hiding this comment

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

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
Copy link

Choose a reason for hiding this comment

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

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
Copy link

Choose a reason for hiding this comment

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

How is this change related to the PR?

setup.py Outdated
version='1.0',
py_modules=['pysize'],
) No newline at end of file
with open("README.md", "r") as fh:
Copy link

Choose a reason for hiding this comment

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

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"},
Copy link

Choose a reason for hiding this comment

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

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__"):
Copy link

Choose a reason for hiding this comment

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

This is unrelated

@@ -1,5 +1,6 @@
import sys
Copy link

Choose a reason for hiding this comment

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

Why did you move the module?

setup.py Outdated

setup(
name="pysize",
version="1.0",
Copy link

Choose a reason for hiding this comment

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

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)
Copy link

Choose a reason for hiding this comment

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

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)
Copy link

Choose a reason for hiding this comment

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

This is not needed.

MANIFEST.in Outdated
@@ -0,0 +1 @@
include README.md LICENSE
Copy link

Choose a reason for hiding this comment

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

setuptools-scm takes care of manifest better.

version='1.0',
py_modules=['pysize'],
) No newline at end of file
__requires__ = ('setuptools >=36.3.0', )
Copy link

Choose a reason for hiding this comment

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

@bosswissam do you think you want to require this version of setuptools as a pre-requisite?

Copy link
Owner

Choose a reason for hiding this comment

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

what's your recommendation? Sorry not super familiar with pypi setup.

Choose a reason for hiding this comment

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

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.

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

@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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

This list is broken.

README.rst Outdated
.. code:: python

>>> class Test(object):
>>> pass

Choose a reason for hiding this comment

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

>>> -> ...

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:

Choose a reason for hiding this comment

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

-> members

README.rst Outdated
License
=======

`MIT <LICENSE.txt>`__

Choose a reason for hiding this comment

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

I believe it needs a single trailing underscore.

README.rst Outdated
License
=======

`MIT <LICENSE.txt>`__

Choose a reason for hiding this comment

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

Also, it's not txt anymore, but rst

.travis.yml Outdated
@@ -1,12 +1,12 @@
conditions: v1

Choose a reason for hiding this comment

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

Why did you remove it? you should add it back!

.travis.yml Outdated

script: nosetests
install:
- pip install pytest==3.9.1

Choose a reason for hiding this comment

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

This change is unrelated.

Copy link

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

Get back conditions opt-in and revert unrelated test runner change.

Copy link

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

It's not about removing the existing things, but adding what's stated in the PR title.

language: python

python:
- "2.6"

Choose a reason for hiding this comment

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

Get back all of the matrix jobs

setup.cfg Outdated
license_file = LICENSE.rst
keywords =
check
Python

Choose a reason for hiding this comment

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

this keyword is useless.

.travis.yml Outdated
- "3.5-dev" # 3.5 development branch
- "nightly" # currently points to 3.6-dev
# command to run tests
- 2.6

Choose a reason for hiding this comment

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

Keep the original syntax, it shouldn't appear in this diff.

Choose a reason for hiding this comment

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

(refactoring is not related to the PR purpose)

.travis.yml Outdated
- 3.4
- 3.5
- 3.6
- 3.7

Choose a reason for hiding this comment

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

It's already in jobs.include + it doesn't work like others and will error out in Travis CI.

Suggested change
- 3.7

tags: true
user: bosswissam
password:
secure:

Choose a reason for hiding this comment

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

@bosswissam you should use the command travis encrypt to encrypt your password and put the result in here.

Choose a reason for hiding this comment

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

.travis.yml Outdated
- 3.4
- 3.5
- 3.6
- 3.7

Choose a reason for hiding this comment

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

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 explicitly

And 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 root

P.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
Copy link

@webknjaz webknjaz Oct 18, 2018

Choose a reason for hiding this comment

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

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.

Suggested change
name = pysize
name = pysize-inspector

cc @bosswissam ^

.travis.yml Outdated
@@ -10,3 +11,30 @@ python:
- "nightly" # currently points to 3.6-dev

Choose a reason for hiding this comment

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

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.

Choose a reason for hiding this comment

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

P.S. nightly points to 3.8-dev now

README.rst Outdated
|Build Status|

pysize-inspector
======

Choose a reason for hiding this comment

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

Underline should match the test length.

@@ -0,0 +1,45 @@
[metadata]
name = pysize-inspector

Choose a reason for hiding this comment

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

.travis.yml Outdated
sudo: true

- stage: &stage_deploy_name upload new version of python package to PYPI (only for tagged commits)
name: "Deploy"

Choose a reason for hiding this comment

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

Quotes are not really needed for strings unless you use some special characters there, which you don't.

Copy link

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

LGTM

@bosswissam would you please add encrypted PyPI creds to Travis CI config?

@bosswissam
Copy link
Owner

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.

@webknjaz
Copy link

@bosswissam maybe we'd just drop in the shim for supporting fairly old setuptools? This would reduce the number of questions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants