1

I have a rather large personal python library that I use for projects. I want to release it to the public, but first I wanted to change the name to something a little less silly then the personal anecdote that I named it after.

Lets say I have a library name "FooBarLib" and it is contained within the folder "FooBarLib" and internally it makes references to "import FooBarLib.moduleName" and what have you.

I want to change it to "NewLibName" and have every instance in every file of "FooBarLib" replaced with "NewLibName".

What is the best way to go about this?

3 Answers 3

3

Consider using rope or some other refactoring system to help. IDE's are better at this sort of thing because they're configured to know something about how code is being imported.

That said, it would be perfectly reasonable searching for FooBarLib and replacing with NewLibName (as long as FooBarLib was a pretty unique name). Some automated tests would really help to make sure you've got everything renamed properly (and don't forget to check setup.py, documentation files, etc.)

Sign up to request clarification or add additional context in comments.

Comments

0

You could use rope, which is a Python refactoring library that can be used with a lot of editors. This sort of refactoring is also supported by tons of IDEs.

Comments

0

You could use a sed/awk script to do the batch renaming.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.