Re: [openstack-dev] [all] Question about import module

2015-01-30 Thread Doug Hellmann


On Thu, Jan 29, 2015, at 09:10 PM, liuxinguo wrote:
 * I have seen that the module 'oslo.config' have changed to
 'oslo_config' in Kilo but in Juno it is still 'oslo.config'.
 
 I want my code work compatibly both for Juno and Kilo so I import this
 module in this way:
 
 try:
 from oslo_config import cfg
 except:
 from oslo.config import cfg
 
 * Does this way of importing module will be accepted by the
 communityapp:ds:community? Or is there any other better
 wayapp:ds:way?

There's no need to do this. The config library still supports using
oslo.config for now, and we are going to cap the versions of the
libraries used in Juno to avoid issues in the future.

Please update master branches of any projects using Oslo libraries to
import from the new name only.

Doug

 
 Thanks and regards,
 Liu
 
 __
 OpenStack Development Mailing List (not for usage questions)
 Unsubscribe:
 openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [all] Question about import module

2015-01-29 Thread Ian Cordasco
The requirements files are being updated so this fallback is unnecessary.
Newer versions of the library (which should be the new minimum version)
will work with the first import without issue. The only reason you would
do this is if you’re not following global-requirements.txt and have a very
low minimum requirement for the oslo libraries.

On 1/29/15, 20:10, liuxinguo liuxin...@huawei.com wrote:

·
I have seen that the module ‘oslo.config’ have changed to ‘oslo_config’
in Kilo but in Juno it is still ‘oslo.config’.
 
I want my code work compatibly both for Juno and Kilo so I import this
module in this way:
 
try:
   
from oslo_config
importcfg
except:
from oslo.config
importcfg
 
·
Does this way of importing module will be accepted by the
community app:ds:community? Or is there any other better
way app:ds:way?
 
Thanks and regards,
Liu
 


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [all] Question about import module

2015-01-29 Thread iKhan
Suppose that's the way to do it.

On Fri, Jan 30, 2015, 7:44 AM liuxinguo liuxin...@huawei.com wrote:

   · I have seen that the module ‘oslo.config’ have changed to
 ‘oslo_config’ in Kilo but in Juno it is still ‘oslo.config’.



 I want my code work compatibly both for Juno and Kilo so I import this
 module in this way:



 try:

 from oslo_config import cfg

 except:

 from oslo.config import cfg



 · Does this way of importing module will be accepted by the
 community? Or is there any other better way?



 Thanks and regards,

 Liu


  
 __
 OpenStack Development Mailing List (not for usage questions)
 Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev