Skip to content

Comments

Add support for multiple addresses when publishing a service#170

Merged
jstasiak merged 5 commits intopython-zeroconf:masterfrom
dtantsur:multi-addr
May 22, 2019
Merged

Add support for multiple addresses when publishing a service#170
jstasiak merged 5 commits intopython-zeroconf:masterfrom
dtantsur:multi-addr

Conversation

@dtantsur
Copy link
Collaborator

This is a rebased and fixed version of PR #27, which also adds compatibility shim for ServiceInfo.address and does a proper deprecation for it.

@coveralls
Copy link

coveralls commented May 20, 2019

Coverage Status

Coverage increased (+0.04%) to 93.644% when pulling 90f70f0 on dtantsur:multi-addr into 12477c9 on jstasiak:master.

dtantsur added 2 commits May 20, 2019 14:56
* Raise deprecation warnings when address is used
* Add a compatibility property to avoid breaking existing code
  (based on suggestion by Bas Stottelaar in PR python-zeroconf#27)
* Make addresses keyword-only, so that address can be eventually
  removed and replaced with it without breaking consumers
* Raise TypeError instead of an assertion on conflicting address
  and addresses
Due to psf/black#759 black produces
code that is invalid Python 3.5 syntax even with --target-version py35.
This patch disables reformatting for this call (it doesn't seem to be
possible per line) until it's fixed.
@jstasiak
Copy link
Collaborator

Nice!

@jstasiak jstasiak merged commit c787610 into python-zeroconf:master May 22, 2019
@jstasiak
Copy link
Collaborator

I'm thinking – maybe it makes sense to keep address working as long as len(addresses) == 1 and (in the future) make it throw an exception when there's more than a single address.

@dtantsur
Copy link
Collaborator Author

I'm on the fence about this. I don't think writing info.addresses[0] is so much harder than info.address and having two ways to do the same thing may be confusing. I'm worried about people just writing info.address without realizing that it won't always work.

@jstasiak
Copy link
Collaborator

Yeah, you're probably right.

@balloob
Copy link

balloob commented May 31, 2019

Could you make a new release? This is actually fixing a bug where a ServiceInfo without an address would hit an assertion error.

@jstasiak
Copy link
Collaborator

jstasiak commented Jun 4, 2019

@balloob Sure, version 0.23.0 has just been released.

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.

5 participants