I did not modify any of those modules; I want to publish the .py file only (no binaries).
If you will not be including copies of numpy and Matplotlib, then you need not concern yourself with their permissive licenses. Neither license imposes restrictions on derivative works such as your script.
To see this, let's start by walking through the BSD license:
Copyright [year] [someone]
This is a standard line indicating that [someone] published this in [year] and they own the copyright. It doesn't make very much legal difference in practice, because that is already the default state of affairs anyway. Under modern law, nearly everywhere on Earth, copyright automatically vests the moment you save a file to your hard drive. A notice such as this does provide a few ancillary legal benefits (such as making it harder for infringers to claim they did not realize the file was copyrighted), but it does not cause the file to become copyrighted, because that is automatic.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
What you are doing (probably) qualifies as "use," so it is permitted if you follow the remaining instructions.
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Inapplicable. You don't plan on redistributing source code. All the source code you will distribute is original.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Inapplicable. You don't plan on distributing binaries at all.
- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
Inapplicable. You have not indicated that you plan to do that.
[A warranty disclaimer in ALL CAPS]
This basically just means "don't sue us if the code causes a problem." You should probably include a similar disclaimer in your publication.
Now, let's do the MIT license:
Copyright [year] [someone]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
This is a bit more explicit than the BSD license, but it clearly grants you permission for the things you want to do.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Again, you're not distributing a copy or substantial portion of the library, so this does not apply to you.
[Another warranty disclaimer]
Finally, we come to the PSF license, which is slightly longer, but ultimately it comes down to the same legal analysis we've seen twice already: You are not doing anything which would trigger any of the specific requirements of the license.
TL;DR: You can distribute your script under whatever terms you choose. If you want to package numpy or Matplotlib with your script, then you need to include their licenses, but they do not "infect" the rest of your distribution.