<?xml version="1.0" encoding="utf-8"?> 
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us">
    <generator uri="https://gohugo.io/" version="0.152.2">Hugo</generator><title type="html"><![CDATA[Numpy on Blog]]></title>
    
    
    
            <link href="https://blog.scientific-python.org/tags/numpy/" rel="alternate" type="text/html" title="html" />
            <link href="https://blog.scientific-python.org/tags/numpy/atom.xml" rel="self" type="application/atom" title="atom" />
    <updated>2026-04-04T04:32:36+00:00</updated>
    
    
    
    
        <id>https://blog.scientific-python.org/tags/numpy/</id>
    
        
        <entry>
            <title type="html"><![CDATA[A Year of Typing: My NumPy Fellowship Retrospective]]></title>
            <link href="https://blog.scientific-python.org/numpy/fellowship-program-2025-retrospective/?utm_source=atom_feed" rel="alternate" type="text/html" />
            
                <link href="https://blog.scientific-python.org/numpy/fellowship-program-2025/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy&#39;s Second Developer in Residence: Joren Hammudoglu" />
                <link href="https://blog.scientific-python.org/numpy/fellowship-program/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy&#39;s first Developer in Residence: Sayed Adel" />
                <link href="https://blog.scientific-python.org/numpy/numpy2/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy 2.0: an evolutionary milestone" />
                <link href="https://blog.scientific-python.org/numpy/numpy-rng/?utm_source=atom_feed" rel="related" type="text/html" title="Best Practices for Using NumPy&#39;s Random Number Generators" />
                <link href="https://blog.scientific-python.org/numpy/mukulikapahari/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy Contributor Spotlight: Mukulika Pahari" />
            
                <id>https://blog.scientific-python.org/numpy/fellowship-program-2025-retrospective/</id>
            
            
            <published>2026-01-08T00:00:00+00:00</published>
            <updated>2026-01-08T00:00:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<blockquote>A Year of Typing: My NumPy Fellowship Retrospective</blockquote><p>It’s been exactly one year since I started my journey as a NumPy Fellow, and looking back, it has honestly been the best job I&rsquo;ve ever had. My main goal for 2025 was to push the boundaries of static typing within the Scientific Python ecosystem. I&rsquo;m happy to report that we didn&rsquo;t just push the boundaries; we reshaped them.</p>
<p>Here is a high-level look at what we achieved, from making <code>numpy</code> fully type-checked to bridging the gap between scientific computing and the wider Python typing community.</p>
<h2 id="numpy-is-now-fully-type-checked">NumPy is Now Fully Type-Checked<a class="headerlink" href="#numpy-is-now-fully-type-checked" title="Link to this heading">#</a></h2>
<p>One of the biggest wins this year is that NumPy is now fully type-checked. When I started, there were significant gaps between the runtime behavior and the typing stubs.</p>
<p>For example, I spent a lot of time integrating <code>stubtest</code> — a <a href="https://github.com/python/mypy">mypy</a> tool that checks if stubs match the runtime — into the CI pipeline. For this I had to fix thousands (yes, thousands) of errors in the stubs. Now typing correctness is enforced by running <code>stubtest</code> and <code>mypy</code> on the stubs in CI, ensuring that technical debt doesn&rsquo;t creep back in.</p>
<p>Crucially, NumPy is now largely compatible with the official <a href="https://typing.python.org/en/latest/">Python typing specification</a>. I helped drop support for Python 3.11 to update our stubs to use the modern PEP 695 syntax, making the codebase cleaner and more future-proof.</p>
<p>Besides static typing, since NumPy 2.4.0, all function- and class-signatures can now also be inspected at runtime using <code>inspect.signature</code>. This is a game-changer for runtime type-checkers like <a href="https://github.com/beartype/beartype">beartype</a> and <a href="https://github.com/agronholm/typeguard">typeguard</a>.</p>
<p>Over the past year I&rsquo;ve made <a href="https://github.com/numpy/numpy/pulls?q=is%3Apr&#43;author%3Ajorenham&#43;created%3A2025-01-01..2025-12-31&#43;is%3Amerged">hundreds of contributions</a> to NumPy, so there&rsquo;s a good chance I&rsquo;m forgetting some important achievements.</p>
<h2 id="the-shape-typing-frontier-numtype">The Shape-Typing Frontier: NumType<a class="headerlink" href="#the-shape-typing-frontier-numtype" title="Link to this heading">#</a></h2>
<p>A massive part of my fellowship was dedicated to the &ldquo;holy grail&rdquo; of array typing: shape-typing. For this I had to rely on type-checker behavior that isn&rsquo;t well-specified, and therefore subject to change. Using these typing acrobatics in NumPy would be too risky, so we decided to create a new project for this, called <a href="https://github.com/numpy/numtype">NumType</a>.</p>
<p>When NumType is installed, your static type-checker will use its <code>.pyi</code> stubs instead of those bundled with NumPy. There are three main advantages to this:</p>
<ol>
<li>Improved ufunc annotations.</li>
<li>Full support of the <a href="https://numpy.org/neps/nep-0050-scalar-promotion.html">NEP 50</a> promotion rules for all scalars, exhaustively verified to be 100% accurate.</li>
<li>Experimental shape-typing with automatic static broadcasting types.</li>
</ol>
<p>The &ldquo;magic&rdquo; types that enable the dtype promotion and shape-type broadcasting are currently only accessible from the private type-check-only <code>_numtype</code> API. But the plan is to eventually make these part of the public <code>numtype</code> API.</p>
<p>But before you drop everything to install NumType, note that it&rsquo;s currently in alpha, so there&rsquo;s no backwards-compatibility guarantee. However, if you <em>do</em> decide to use it and encounter an issue, be sure to complain about it in high definition at <a href="https://github.com/numpy/numtype/issues">https://github.com/numpy/numtype/issues</a> :)</p>
<h2 id="strengthening-the-ecosystem-scipy-stubs-and-beyond">Strengthening the Ecosystem: <code>scipy-stubs</code> and Beyond<a class="headerlink" href="#strengthening-the-ecosystem-scipy-stubs-and-beyond" title="Link to this heading">#</a></h2>
<p>Typing NumPy is useless if the libraries built <em>on top</em> of it aren&rsquo;t typed. A significant portion of my time went into <code>scipy-stubs</code>.</p>
<ul>
<li>We transferred ownership of <a href="https://github.com/scipy/scipy-stubs/"><code>scipy-stubs</code></a> — which started as <code>jorenham/scipy-stubs</code> — to the official SciPy organization.</li>
<li><code>scipy-stubs</code> now covers the full SciPy API, and only uses <code>Any</code> when absolutely necessary.</li>
<li>It has grown massively — it now contains over 72,000 lines of code (according to <a href="https://github.com/boyter/scc"><code>scc</code></a>), making it the largest hand-written stubs-only Python package; even if you include <code>typeshed</code>&rsquo;s standard library stubs (which currently counts 69,439 lines of code).</li>
<li>We added runtime support for the generic types, including the sparse arrays, probability distributions, and interpolation classes.</li>
<li>I helped large libraries such as <a href="https://github.com/pandas-dev/pandas"><code>pandas</code></a>, <a href="https://github.com/jax-ml/jax"><code>jax</code></a>, <a href="https://github.com/colour-science/colour"><code>colour</code></a>, and <a href="https://github.com/apache/spark"><code>pyspark</code></a> adopt <code>scipy-stubs</code>.</li>
</ul>
<p>I also made sure to spread the love to other corners of the ecosystem by adding typing support to <a href="https://github.com/numpy/numpy-financial"><code>numpy-financial</code></a>, <a href="https://github.com/wolph/numpy-stl"><code>numpy-stl</code></a>, <a href="https://pypi.org/project/numpy-quaddtype/"><code>numpy-quaddtype</code></a>, <a href="https://github.com/pydata/numexpr"><code>numexpr</code></a>, and <a href="https://github.com/joblib/threadpoolctl"><code>threadpoolctl</code></a>.</p>
<h2 id="bridging-communities">Bridging Communities<a class="headerlink" href="#bridging-communities" title="Link to this heading">#</a></h2>
<p>Perhaps the achievement I&rsquo;m most proud of is the collaboration with the type-checker maintainers. Scientific Python has complex needs that often stretch the limits of Python&rsquo;s type system.</p>
<p>Throughout the year, I discovered and investigated bugs in all five major type-checkers: <a href="https://github.com/python/mypy"><code>mypy</code></a>, <a href="https://github.com/microsoft/pyright"><code>pyright</code></a>, <a href="https://github.com/DetachHead/basedpyright"><code>basedpyright</code></a>, <a href="https://github.com/facebook/pyrefly"><code>pyrefly</code></a>, and <a href="https://github.com/astral-sh/ty"><code>ty</code></a>. <a href="https://github.com/python/mypy/pulls?q=is%3Apr&#43;author%3Ajorenham&#43;created%3A2025-01-01..2025-12-31">Some</a> of the <code>mypy</code> bugs I even managed to fix myself. We fixed critical bugs affecting NumPy users and improved analysis times.</p>
<p>I feel that this work has brought the Scientific Python community much closer to the Python Typing community. I&rsquo;m incredibly grateful to the maintainers of these tools for their responsiveness and willingness to collaborate.</p>
<h2 id="wrapping-up">Wrapping Up<a class="headerlink" href="#wrapping-up" title="Link to this heading">#</a></h2>
<p>This fellowship has been an absolute privilege, and I feel like I&rsquo;ve made the most out of it. If you want to dive into the nitty-gritty details, you can find all of my activity on my GitHub profile (<a href="https://github.com/jorenham"><code>@jorenham</code></a>), but for now, I&rsquo;m just happy to have made those squiggly lines a bit more meaningful.</p>
<p>Thanks to everyone who made this possible, and type safe!</p>
]]></content>
            
                 
                    
                 
                    
                         
                        
                            
                             
                                <category scheme="taxonomy:Tags" term="numpy" label="numpy" />
                             
                                <category scheme="taxonomy:Tags" term="developer-in-residence" label="developer-in-residence" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[NumPy's Second Developer in Residence: Joren Hammudoglu]]></title>
            <link href="https://blog.scientific-python.org/numpy/fellowship-program-2025/?utm_source=atom_feed" rel="alternate" type="text/html" />
            
                <link href="https://blog.scientific-python.org/numpy/fellowship-program/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy&#39;s first Developer in Residence: Sayed Adel" />
                <link href="https://blog.scientific-python.org/numpy/numpy2/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy 2.0: an evolutionary milestone" />
                <link href="https://blog.scientific-python.org/numpy/numpy-rng/?utm_source=atom_feed" rel="related" type="text/html" title="Best Practices for Using NumPy&#39;s Random Number Generators" />
                <link href="https://blog.scientific-python.org/numpy/mukulikapahari/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy Contributor Spotlight: Mukulika Pahari" />
            
                <id>https://blog.scientific-python.org/numpy/fellowship-program-2025/</id>
            
            
            <published>2025-01-01T00:00:00+00:00</published>
            <updated>2025-01-01T00:00:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<blockquote>Introducing NumPy&rsquo;s second developer in residence, Joren Hammudoglu.</blockquote><p>The NumPy team is excited to announce the appointment of Joren Hammudoglu (@jorenham) as the second NumPy Developer in Residence. For the second time, the project is in a position to use its project funds to pay for a full year of maintainer time through the NumPy Fellowship Program.</p>
<p>Joren has been the driving force behind the improvements in NumPy&rsquo;s support for static typing since he started contributing in mid-2024. He has authored a lot of the improvements — from the annotations themselves to CI support and working towards fundamental design improvements like ndarray shape typing — and helps guide and integrate the work of other NumPy contributors in this area, and engages with upstream projects like MyPy and Pyright and the typing standards/PEP process to help move static typing support for the ecosystem as a whole forward. He also contributes widely to static typing support in the ecosystem, as the author of <code>scipy-stubs</code>, <code>numtype</code> and more.</p>
<p>The NumPy Steering Council sees Joren’s appointment to this role as both recognition of his contributions and expertise as well as an opportunity to continue improving NumPy’s static typing support — an area that few maintainers are knowledgeable about but a significant fraction of end users tends to care about a lot.</p>
<p>Joren&rsquo;s role is for the calendar year 2025. Thanks to individual and corporate donations, as well as payments from Tidelift, NumPy has been able to fund another full-time position for one year, following the first such role held by Sayed Adel in 2023. The funds are still <a href="https://numpy.org/neps/nep-0048-spending-project-funds.html">transparently administered</a> on Open Collective.</p>
<p>Welcome aboard, Joren! We&rsquo;re excited to see the impact of your work.</p>
]]></content>
            
                 
                    
                 
                    
                         
                        
                            
                             
                                <category scheme="taxonomy:Tags" term="numpy" label="numpy" />
                             
                                <category scheme="taxonomy:Tags" term="developer-in-residence" label="developer-in-residence" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[NumPy 2.0: an evolutionary milestone]]></title>
            <link href="https://blog.scientific-python.org/numpy/numpy2/?utm_source=atom_feed" rel="alternate" type="text/html" />
            
                <link href="https://blog.scientific-python.org/numpy/numpy-rng/?utm_source=atom_feed" rel="related" type="text/html" title="Best Practices for Using NumPy&#39;s Random Number Generators" />
                <link href="https://blog.scientific-python.org/numpy/fellowship-program/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy&#39;s first Developer in Residence: Sayed Adel" />
                <link href="https://blog.scientific-python.org/numpy/mukulikapahari/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy Contributor Spotlight: Mukulika Pahari" />
                <link href="https://blog.scientific-python.org/matplotlib/book/?utm_source=atom_feed" rel="related" type="text/html" title="Newly released open access book" />
                <link href="https://blog.scientific-python.org/matplotlib/gsoc_2021_final/?utm_source=atom_feed" rel="related" type="text/html" title="GSoC&#39;21: Final Report" />
            
                <id>https://blog.scientific-python.org/numpy/numpy2/</id>
            
            
            <published>2024-06-17T00:00:00+00:00</published>
            <updated>2024-06-17T00:00:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<blockquote>We announce the release of NumPy 2.0, which brings major improvements in functionality and usability. Improvements to NumPy internals set the stage for future development. We discuss the motivation behind breaking changes and how those impact users, as well as some of the history of the 2.0 development process.</blockquote><p>Eighteen years since the release of NumPy 1.0, we are thrilled to announce the
launch of NumPy 2.0! This major release marks a significant milestone in the
evolution of NumPy, bringing a wealth of enhancements and improvements to users,
and setting the stage for future feature development.</p>
<p>NumPy has improved and evolved over the past 18 years, with many old releases bringing
significant performance, usability, and consistency improvements.
That said, our approach for a long time has been to make only incremental changes while
carefully managing backward compatibility. This approach minimizes user breakage,
but also limits the scope of improvements that can be made, both to the API and its underlying implementation.
Therefore, for this one-off major release, we are breaking backward
compatibility to implement significant improvements in NumPy&rsquo;s type system. The
type system is fundamental to NumPy, and major behavioral changes could not be
made incrementally without mixing two different
type systems, which would be a recipe for disaster.</p>
<p>The journey to an actual 2.0 release has been long, and it was difficult to
build the necessary momentum. In part, this may be because, for a time, the
NumPy developers associated a NumPy 2.0 release with nothing less than a
revolutionary rewrite of significant key pieces of the code base. Many of these
rewrites and changes happened over the years, but because of backward
compatibility concerns they remained largely invisible to the users. NumPy 2.0
is the culmination of these efforts, allowing us to discard some legacy
ABI (Application Binary Interface) that prevented future improvements.</p>
<p>Some major changes to NumPy internals—required for key features in
2.0—have been in the works since 2019 at least.
We started concrete plans for the 2.0 release more than a year ago, at a four hour
long <a href="https://github.com/numpy/archive/tree/main/2.0_developer_meeting">public planning meeting</a>
in April 2023. Many of the key changes were proposed and discussed. The key goals
we decided on there were perhaps even larger and more ambitious in scope than
some of us expected. This also unlocked some extra energy - which has been great to see.
After the meeting and over the course of the last year, NumPy enhancement
proposals (<a href="https://numpy.org/neps/">NEPs</a>) were written,
reviewed, and implemented for each major change.</p>
<p>Some key highlights are:</p>
<ul>
<li>
<p>Cleaned-up and streamlined Python API (<a href="https://numpy.org/neps/nep-0052-python-api-cleanup.html">NEP 52</a>):
The Python API has undergone a thorough cleanup, making it easier to learn
and use NumPy. The main namespace has been reduced by approximately 10%, and
the more niche <code>numpy.lib</code> namespace has been reduced by about 80%, providing
a clearer distinction between public and private API elements.</p>
</li>
<li>
<p>Improved scalar promotion rules: The scalar promotion rules have been
updated, as proposed in <a href="https://numpy.org/neps/nep-0050-scalar-promotion.html">NEP 50</a>
addressing surprising behaviors in type promotion, e.g. with zero dimensional arrays.</p>
</li>
<li>
<p>Powerful new DType API and a new string dtype: NumPy 2.0 introduces a new API
for implementing user-defined custom data types as proposed by
<a href="https://numpy.org/neps/nep-0041-improved-dtype-support.html">NEP 41</a>. We used
this new API to implement <code>StringDType</code>, offering efficient and painless
support for variable length strings which was proposed in
<a href="https://numpy.org/neps/nep-0055-string_dtype.html">NEP 55</a>. And it is our hope
that enable future new data types with interesting new capabilities in the
PyData ecosystem and in NumPy itself.</p>
</li>
<li>
<p>Windows compatibility enhancements: The default 32-bit integer representation
on Windows has been updated to 64-bit on 64-bit architectures, addressing one
of the most common problems with having NumPy work portably across operating
systems.</p>
</li>
<li>
<p>Support for the Python array API standard: This is the first release to
include full support for the array API standard (v2022.12), made possible
by the new promotion rules, APIs, and API cleanup mentioned above.
We also aligned existing APIs and behavior with the standard,
as proposed in <a href="https://numpy.org/neps/nep-0056-array-api-main-namespace.html">NEP 56</a>.</p>
</li>
</ul>
<p>These are just some of the more impactful changes in behavior and usability. In addition,
NumPy 2.0 contains significant performance and documentation improvements,
and much more - for an extensive list of changes, see
the <a href="https://numpy.org/devdocs/release/2.0.0-notes.html">NumPy 2 release notes</a>.</p>
<p>To adopt this major release, users will likely need to adjust existing code, but we
worked hard to strike a balance between improvements and ensuring that the
transition to NumPy 2.0 is as seamless as possible. We wrote a comprehensive
<a href="https://numpy.org/devdocs/numpy_2_0_migration_guide.html">migration guide</a>,
and a <a href="https://numpy.org/devdocs/numpy_2_0_migration_guide.html#ruff-plugin">ruff plugin</a>
that helps to update Python code so it will work with both NumPy 1.x and
NumPy 2.x.</p>
<p>While we do require C API users to recompile their projects to support
NumPy 2.0, we prepared for this in NumPy 1.25 already. The build process was
simplified so that you can now compile with the latest NumPy version,
and remain backward compatible.
This means that projects build with NumPy 2.x are &ldquo;magically&rdquo; compatible with
1.x. It also means that projects no longer need to build their binaries using
the oldest supported version of NumPy.</p>
<p>We knew throughout development that rolling out NumPy 2.0
would be (temporarily) disruptive, because of the backwards-incompatible API and
ABI changes. We spent an extraordinary amount of effort communicating these
changes, helping downstream projects adapt, tracking compatibility of popular
open source projects (see, e.g.,
<a href="https://github.com/numpy/numpy/issues/26191">numpy#26191</a>), and completing the
release process at limited pace to provide time for adoption. No
doubt, the next few weeks will bring to light some new challenges, however we fully expect these
to be manageable and well worth it in the long run.</p>
<p>The NumPy 2.0 release is the result of a collaborative, largely volunteer,
effort spanning many years and involving contributions from a diverse community
of developers. In addition, many of the changes above would not have been
possible without funders and institutional sponsors allowing several team members
to work on NumPy as part of their day jobs. We&rsquo;d like to acknowledge in particular:
the Gordon and Betty Moore Foundation, the Alfred P. Sloan Foundation,
NASA, NVIDIA, Quansight Labs, the Chan Zuckerberg Initiative, and Tidelift.</p>
<p>We are excited about future improvements to NumPy, many of which will be
possible due to changes in NumPy 2.0. See <a href="https://numpy.org/neps/roadmap.html">the NumPy roadmap</a>
for some features in the pipeline or on the wishlist. Let&rsquo;s
continue working together to improve NumPy and the scientific Python and PyData
ecosystem!</p>]]></content>
            
                 
                    
                 
                    
                         
                        
                            
                             
                                <category scheme="taxonomy:Tags" term="news" label="News" />
                             
                                <category scheme="taxonomy:Tags" term="numpy" label="numpy" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[Best Practices for Using NumPy's Random Number Generators]]></title>
            <link href="https://blog.scientific-python.org/numpy/numpy-rng/?utm_source=atom_feed" rel="alternate" type="text/html" />
            
                <link href="https://blog.scientific-python.org/scientific-python/dev-summit-1-development-guide/?utm_source=atom_feed" rel="related" type="text/html" title="The Scientific Python Development Guide" />
                <link href="https://blog.scientific-python.org/numpy/fellowship-program/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy&#39;s first Developer in Residence: Sayed Adel" />
                <link href="https://blog.scientific-python.org/numpy/mukulikapahari/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy Contributor Spotlight: Mukulika Pahari" />
                <link href="https://blog.scientific-python.org/matplotlib/how-to-create-custom-tables/?utm_source=atom_feed" rel="related" type="text/html" title="How to create custom tables" />
                <link href="https://blog.scientific-python.org/matplotlib/visualising-usage-using-batteries/?utm_source=atom_feed" rel="related" type="text/html" title="Battery Charts - Visualise usage rates &amp; more" />
            
                <id>https://blog.scientific-python.org/numpy/numpy-rng/</id>
            
            
            <published>2024-01-26T23:22:46+02:00</published>
            <updated>2024-01-26T23:22:46+02:00</updated>
            
            
            <content type="html"><![CDATA[<blockquote>Best Practices for Using NumPy&rsquo;s Random Number Generators</blockquote><p>Given the practical challenges of achieving true randomness, deterministic algorithms, known as Pseudo Random Number Generators (RNGs), are employed in science to create sequences that mimic randomness. These generators are used for simulations, experiments, and analysis where it is essential to have numbers that appear unpredictable. I want to share here what I have learned about best practices with pseudo RNGs and especially the ones available in <a href="https://numpy.org/">NumPy</a>.</p>
<p>A pseudo RNG works by updating an internal state through a deterministic algorithm. This internal state is initialized with a value known as a seed and each update produces a number that appears randomly generated. The key here is that the process is deterministic, meaning that if you start with the same seed and apply the same algorithm, you will get the same sequence of internal states (and numbers). Despite this determinism, the resulting numbers exhibit properties of randomness, appearing unpredictable and evenly distributed. Users can either specify the seed manually, providing a degree of control over the generated sequence, or they can opt to let the RNG object automatically derive the seed from system entropy. The latter approach enhances unpredictability by incorporating external factors into the seed.</p>
<p>I assume a certain knowledge of NumPy and that NumPy 1.17 or greater is used. The reason for this is that great new features were introduced in the <a href="https://numpy.org/doc/stable/reference/random/index.html">random</a> module of version 1.17. As <code>numpy</code> is usually imported as <code>np</code>, I will sometimes use <code>np</code> instead of <code>numpy</code>. Finally, RNG will always mean pseudo RNG in the rest of this blog post.</p>
<h3 id="the-main-messages">The main messages<a class="headerlink" href="#the-main-messages" title="Link to this heading">#</a></h3>
<ol>
<li>Avoid using the global NumPy RNG. This means that you should avoid using <a href="https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html"><code>np.random.seed</code></a> and <code>np.random.*</code> functions, such as <code>np.random.random</code>, to generate random values.</li>
<li>Create a new RNG and pass it around using the <a href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.default_rng"><code>np.random.default_rng</code></a> function.</li>
<li>Be careful with parallel random number generation and use the <a href="https://numpy.org/doc/stable/reference/random/parallel.html">strategies provided by NumPy</a>.</li>
</ol>
<p>Note that, with older versions of NumPy (&lt;1.17), the way to create a new RNG is to use <a href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState"><code>np.random.RandomState</code></a> which is based on the popular Mersenne Twister 19937 algorithm. This is also how the global NumPy RNG is created. This function is still available in newer versions of NumPy, but it is now recommended to use <code>default_rng</code> instead, which returns an instance of the statistically better <a href="https://www.pcg-random.org">PCG64</a> RNG. You might still see <code>np.random.RandomState</code> being used in tests as it has strong stability guarantees between different NumPy versions.</p>
<h2 id="random-number-generation-with-numpy">Random number generation with NumPy<a class="headerlink" href="#random-number-generation-with-numpy" title="Link to this heading">#</a></h2>
<p>When you import <code>numpy</code> in your Python script, an RNG is created behind the scenes. This RNG is the one used when you generate a new random value using a function such as <code>np.random.random</code>. I will here refer to this RNG as the global NumPy RNG.</p>
<p>Although not recommended, it is a common practice to reset the seed of this global RNG at the beginning of a script using the <code>np.random.seed</code> function. Fixing the seed at the beginning ensures that the script is reproducible: the same values and results will be produced each time you run it. However, although sometimes convenient, using the global NumPy RNG is a bad practice. A simple reason is that using global variables can lead to undesired side effects. For instance one might use <code>np.random.random</code> without knowing that the seed of the global RNG was set somewhere else in the codebase. Quoting <a href="https://numpy.org/neps/nep-0019-rng-policy.html">Numpy Enhancement Proposal (NEP) 19</a> by Robert Kern:</p>
<blockquote>
<p>The implicit global RandomState behind the <code>np.random.*</code> convenience functions can cause problems, especially when threads or other forms of concurrency are involved. Global state is always problematic. We categorically recommend avoiding using the convenience functions when reproducibility is involved. [&hellip;] The preferred best practice for getting reproducible pseudorandom numbers is to instantiate a generator object with a seed and pass it around.</p>
</blockquote>
<p>In short:</p>
<ul>
<li>Instead of using <code>np.random.seed</code>, which reseeds the already created global NumPy RNG, and then using <code>np.random.*</code> functions, you should create a new RNG.</li>
<li>You should create an RNG at the beginning of your script (with your own seed if you want reproducibility) and use this RNG in the rest of the script.</li>
</ul>
<p>To create a new RNG you can use the <code>default_rng</code> function as illustrated in the <a href="https://numpy.org/doc/stable/reference/random/index.html">introduction of the random module documentation</a>:</p>


<div class="highlight">
  <pre class="chroma"><code><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">rng</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">default_rng</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"><span class="n">rng</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>  <span class="c1"># generate a floating point number between 0 and 1</span></span></span></code></pre>
</div>
<p>If you want to use a seed for reproducibility, <a href="https://numpy.org/doc/stable/reference/random/index.html#quick-start">the NumPy documentation</a> recommends using a large random number, where large means at least 128 bits. The first reason for using a large random number is that this increases the probability of having a different seed than anyone else and thus independent results. The second reason is that relying only on small numbers for your seeds can lead to biases as they do not fully explore the state space of the RNG. This limitation implies that the first number generated by your RNG may not seem as random as expected due to inaccessible first internal states. For example, some numbers will never be produced as the first output. One possibility would be to pick the seed at random in the state space of the RNG but <a href="https://github.com/numpy/numpy/issues/25778#issuecomment-1930441151">according to Robert Kern</a> a 128-bit random number is large enough<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup>. To generate a 128-bit random number for your seed you can rely on the <a href="https://docs.python.org/3/library/secrets.html">secrets module</a>:</p>


<div class="highlight">
  <pre class="chroma"><code><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">secrets</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">secrets</span><span class="o">.</span><span class="n">randbits</span><span class="p">(</span><span class="mi">128</span><span class="p">)</span></span></span></code></pre>
</div>
<p>When running this code I get <code>65647437836358831880808032086803839626</code> for the number to use as my seed. This number is randomly generated so you need to copy paste the value that is returned by <code>secrets.randbits(128)</code> otherwise you will have a different seed each time you run your code and thus break reproducibility:</p>


<div class="highlight">
  <pre class="chroma"><code><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">seed</span> <span class="o">=</span> <span class="mi">65647437836358831880808032086803839626</span>
</span></span><span class="line"><span class="cl"><span class="n">rng</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">default_rng</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">rng</span><span class="o">.</span><span class="n">random</span><span class="p">()</span></span></span></code></pre>
</div>
<p>The reason for seeding your RNG only once (and passing that RNG around) is that with a good RNG such as the one returned by <code>default_rng</code> you will be ensured good randomness and independence of the generated numbers. However, if not done properly, using several RNGs (each one created with its own seed) might lead to streams of random numbers that are less independent than the ones created from the same seed<sup id="fnref:2"><a href="#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup>. That being said, <a href="https://github.com/numpy/numpy/issues/15322#issuecomment-573890207">as explained by Robert Kern</a>, with the RNGs and seeding strategies introduced in NumPy 1.17, it is considered fairly safe to create RNGs using system entropy, i.e. using <code>default_rng(None)</code> multiple times. However as explained later be careful when running jobs in parallel and relying on <code>default_rng(None)</code>. Another reason for seeding your RNG only once is that obtaining a good seed can be time consuming. Once you have a good seed to instantiate your generator, you might as well use it.</p>
<h2 id="passing-a-numpy-rng-around">Passing a NumPy RNG around<a class="headerlink" href="#passing-a-numpy-rng-around" title="Link to this heading">#</a></h2>
<p>As you write functions that you will use on their own as well as in a more complex script it is convenient to be able to pass a seed or your already created RNG. The function <code>default_rng</code> allows you to do this very easily. As written above, this function can be used to create a new RNG from your chosen seed, if you pass a seed to it, or from system entropy when passing <code>None</code> but you can also pass an already created RNG. In this case the returned RNG is the one that you passed.</p>


<div class="highlight">
  <pre class="chroma"><code><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">stochastic_function</span><span class="p">(</span><span class="n">high</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">rng</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">    <span class="n">rng</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">default_rng</span><span class="p">(</span><span class="n">rng</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">    <span class="k">return</span> <span class="n">rng</span><span class="o">.</span><span class="n">integers</span><span class="p">(</span><span class="n">high</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span></span></span></code></pre>
</div>
<p>You can either pass an <code>int</code> seed or your already created RNG to <code>stochastic_function</code>. To be perfectly exact, the <code>default_rng</code> function returns the exact same RNG passed to it for certain kind of RNGs such at the ones created with <code>default_rng</code> itself. You can refer to the <a href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.default_rng"><code>default_rng</code> documentation</a> for more details on the arguments that you can pass to this function<sup id="fnref:3"><a href="#fn:3" class="footnote-ref" role="doc-noteref">3</a></sup>.</p>
<h2 id="parallel-processing">Parallel processing<a class="headerlink" href="#parallel-processing" title="Link to this heading">#</a></h2>
<p>You must be careful when using RNGs in conjunction with parallel processing. Let&rsquo;s consider the context of Monte Carlo simulation: you have a random function returning random outputs and you want to generate these random outputs a lot of times, for instance to compute an empirical mean. If the function is expensive to compute, an easy solution to speed up the computation time is to resort to parallel processing. Depending on the parallel processing library or backend that you use different behaviors can be observed. For instance if you do not set the seed yourself it can be the case that forked Python processes use the same random seed, generated for instance from system entropy, and thus produce the exact same outputs which is a waste of computational resources. A very nice example illustrating this when using the Joblib parallel processing library is available <a href="https://joblib.readthedocs.io/en/latest/auto_examples/parallel_random_state.html">here</a>.</p>
<p>If you fix the seed at the beginning of your main script for reproducibility and then pass your seeded RNG to each process to be run in parallel, most of the time this will not give you what you want as this RNG will be deep copied. The same results will thus be produced by each process. One of the solutions is to create as many RNGs as parallel processes with a different seed for each of these RNGs. The issue now is that you cannot choose the seeds as easily as you would think. When you choose two different seeds to instantiate two different RNGs how do you know that the numbers produced by these RNGs will appear as statistically independent?<sup id="fnref1:2"><a href="#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup> The design of independent RNGs for parallel processes has been an important research question. See, for example, <a href="https://www.sciencedirect.com/science/article/pii/S0378475416300829">Random numbers for parallel computers: Requirements and methods, with emphasis on GPUs</a> by L&rsquo;Ecuyer et al. (2017) for a good summary of different methods.</p>
<p>Starting with NumPy 1.17, it is now very easy to instantiate independent RNGs. Depending on the type of RNG you use, different strategies are available as documented in the <a href="https://numpy.org/doc/stable/reference/random/parallel.html">Parallel random number generation section</a> of the NumPy documentation. One of the strategies is to use <code>SeedSequence</code> which is an algorithm that makes sure that poor input seeds are transformed into good initial RNG states. More precisely, this ensures that you will not have a degenerate behavior from your RNG and that the subsequent numbers will appear random and independent. Additionally, it ensures that close seeds are mapped to very different initial states, resulting in RNGs that are, with very high probability, independent of each other. You can refer to the documentation of <a href="https://numpy.org/doc/stable/reference/random/parallel.html#seedsequence-spawning">SeedSequence Spawning</a> for examples on how to generate independent RNGs from a <code>SeedSequence</code> or an existing RNG. I here show how to apply this to the <a href="https://joblib.readthedocs.io/en/latest/auto_examples/parallel_random_state.html#fixing-the-random-state-to-obtain-deterministic-results">joblib example</a> mentioned above.</p>


<div class="highlight">
  <pre class="chroma"><code><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">joblib</span> <span class="kn">import</span> <span class="n">Parallel</span><span class="p">,</span> <span class="n">delayed</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">stochastic_function</span><span class="p">(</span><span class="n">high</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">rng</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">    <span class="n">rng</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">default_rng</span><span class="p">(</span><span class="n">rng</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">    <span class="k">return</span> <span class="n">rng</span><span class="o">.</span><span class="n">integers</span><span class="p">(</span><span class="n">high</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">seed</span> <span class="o">=</span> <span class="mi">319929794527176038403653493598663843656</span>
</span></span><span class="line"><span class="cl"><span class="c1"># creating the RNG that is passed around.</span>
</span></span><span class="line"><span class="cl"><span class="n">rng</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">default_rng</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># create 5 independent RNGs</span>
</span></span><span class="line"><span class="cl"><span class="n">child_rngs</span> <span class="o">=</span> <span class="n">rng</span><span class="o">.</span><span class="n">spawn</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># use 2 processes to run the stochastic_function 5 times with joblib</span>
</span></span><span class="line"><span class="cl"><span class="n">random_vector</span> <span class="o">=</span> <span class="n">Parallel</span><span class="p">(</span><span class="n">n_jobs</span><span class="o">=</span><span class="mi">2</span><span class="p">)(</span>
</span></span><span class="line"><span class="cl">    <span class="n">delayed</span><span class="p">(</span><span class="n">stochastic_function</span><span class="p">)(</span><span class="n">rng</span><span class="o">=</span><span class="n">child_rng</span><span class="p">)</span> <span class="k">for</span> <span class="n">child_rng</span> <span class="ow">in</span> <span class="n">child_rngs</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">random_vector</span><span class="p">)</span></span></span></code></pre>
</div>
<p>By using a fixed seed you always get the same results each time you run this code and by using <code>rng.spawn</code> you have an independent RNG for each call to <code>stochastic_function</code>. Note that here you could also spawn from a <code>SeedSequence</code> that you would create with the seed instead of creating an RNG. However, in general you pass around an RNG therefore I only assume to have access to an RNG. Also note that spawning from an RNG is only possible from version 1.25 of NumPy<sup id="fnref:4"><a href="#fn:4" class="footnote-ref" role="doc-noteref">4</a></sup>.</p>
<p>I hope this blog post helped you understand the best ways to use NumPy RNGs. The new Numpy API gives you all the tools you need for that. The resources below are available for further reading. Finally, I would like to thank Pamphile Roy, Stefan van der Walt and Jarrod Millman for their great feedbacks and comments which contributed to greatly improve the original version of this blog post.</p>
<h2 id="resources">Resources<a class="headerlink" href="#resources" title="Link to this heading">#</a></h2>
<h3 id="numpy-rngs">Numpy RNGs<a class="headerlink" href="#numpy-rngs" title="Link to this heading">#</a></h3>
<ul>
<li><a href="https://numpy.org/doc/stable/reference/random/index.html">The documentation of the NumPy random module</a> is the best place to find information and where I found most of the information that I share here.</li>
<li><a href="https://numpy.org/neps/nep-0019-rng-policy.html">The Numpy Enhancement Proposal (NEP) 19 on the Random Number Generator Policy</a> which lead to the changes introduced in NumPy 1.17</li>
<li>A <a href="https://github.com/numpy/numpy/issues/15322">NumPy issue</a> about the <code>check_random_state</code> function and RNG good practices, especially <a href="https://github.com/numpy/numpy/issues/15322#issuecomment-573890207">this comment</a> by Robert Kern.</li>
<li>Check also <a href="https://github.com/numpy/numpy/issues/25778#issuecomment-1930441151">this answer of Robert Kern</a> to my question about what <code>SeedSequence</code> can and cannot do. This also explains why it is recommended to use very large random numbers for seeds.</li>
<li><a href="https://scikit-learn.org/stable/faq.html#how-do-i-set-a-random-state-for-an-entire-execution">How do I set a random_state for an entire execution?</a> from the scikit-learn FAQ.</li>
<li>There are <a href="https://github.com/scientific-python/specs/pull/180">ongoing discussions</a> about uniformizing the APIs used by different libraries to seed RNGs.</li>
</ul>
<h3 id="rngs-in-general">RNGs in general<a class="headerlink" href="#rngs-in-general" title="Link to this heading">#</a></h3>
<ul>
<li><a href="https://www.sciencedirect.com/science/article/pii/S0378475416300829">Random numbers for parallel computers: Requirements and methods, with emphasis on GPUs</a> by L&rsquo;Ecuyer et al. (2017)</li>
<li>To know more about the default RNG used in NumPy, named PCG, I recommend the <a href="https://www.pcg-random.org/paper.html">PCG paper</a> which also contains lots of useful information about RNGs in general. The <a href="https://www.pcg-random.org">pcg-random.org website</a> is also full of interesting information about RNGs.</li>
</ul>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>If you only need a seed for reproducibility and do not need independence with respect to others, say for a unit test, a small seed is perfectly fine.&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:2">
<p>A good RNG is expected to produce independent numbers for a given seed. However, the independence of sequences generated from two different seeds is not always guaranteed. For instance, it is possible that the sequence started with the second seed might quickly converge to an internal state also obtained by the first seed. This can result in both RNGs producing the same subsequent numbers, which would compromise the randomness expected from distinct seeds.&#160;<a href="#fnref:2" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a>&#160;<a href="#fnref1:2" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:3">
<p>Before knowing about <code>default_rng</code>, and before NumPy 1.17, I was using the scikit-learn function <a href="https://scikit-learn.org/stable/modules/generated/sklearn.utils.check_random_state.html"><code>check_random_state</code></a> which is of course heavily used in the scikit-learn codebase. While writing this post I discovered that this function is now available in <a href="https://github.com/scipy/scipy/blob/62d2af2e13280d29781585aa39a3c5a5dfdfba17/scipy/_lib/_util.py#L231">scipy</a>. A look at the docstring and/or the source code of this function will give you a good idea about what it does. The differences with <code>default_rng</code> are that <code>check_random_state</code> currently relies on <code>np.random.RandomState</code> and that when <code>None</code> is passed to <code>check_random_state</code> then the function returns the already existing global NumPy RNG. The latter can be convenient because if you fix the seed of the global RNG before in your script using <code>np.random.seed</code>, <code>check_random_state</code> returns the generator that you seeded. However, as explained above, this is not the recommended practice and you should be aware of the risks and the side effects.&#160;<a href="#fnref:3" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:4">
<p>Before 1.25 you need to get the <code>SeedSequence</code> from the RNG using the <code>_seed_seq</code> private attribute of the underlying bit generator: <code>rng.bit_generator._seed_seq</code>. You can then spawn from this <code>SeedSequence</code> to get child seeds that will result in independent RNGs.&#160;<a href="#fnref:4" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>]]></content>
            
                 
                    
                 
                    
                         
                        
                            
                             
                                <category scheme="taxonomy:Tags" term="tutorials" label="tutorials" />
                             
                                <category scheme="taxonomy:Tags" term="numpy" label="numpy" />
                             
                                <category scheme="taxonomy:Tags" term="rng" label="rng" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[NumPy's first Developer in Residence: Sayed Adel]]></title>
            <link href="https://blog.scientific-python.org/numpy/fellowship-program/?utm_source=atom_feed" rel="alternate" type="text/html" />
            
                <link href="https://blog.scientific-python.org/numpy/mukulikapahari/?utm_source=atom_feed" rel="related" type="text/html" title="NumPy Contributor Spotlight: Mukulika Pahari" />
            
                <id>https://blog.scientific-python.org/numpy/fellowship-program/</id>
            
            
            <published>2022-12-01T00:00:00+00:00</published>
            <updated>2022-12-01T00:00:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<blockquote>Introducing the NumPy Fellowship Program and our first
Developer in Residence, Sayed Adel, who will be working on performance
optimization.</blockquote><p>The NumPy team is excited to announce the launch of the NumPy Fellowship
Program and the appointment of Sayed Adel
(<a href="https://github.com/seiko2plus">@seiko2plus</a>) as the first NumPy
Developer in Residence. This is a significant milestone in the history
of the project: for the first time, NumPy is in a position to use its
project funds to pay for a full year of maintainer time. We believe that
this will be an impactful program that will contribute to NumPy&rsquo;s
long-term sustainability as a community-driven open source project.</p>
<p>Sayed has been making major contributions to NumPy
since the start of 2020, in particular around computational performance.
He is the main author of the NumPy SIMD architecture (<a href="https://numpy.org/neps/nep-0038-SIMD-optimizations.html"><em>NEP
38</em></a>,
<a href="https://numpy.org/devdocs/reference/simd/index.html"><em>docs</em></a>),
generously shared his knowledge of SIMD instructions with the core
developer team, and helped integrate the work of various volunteer and
industry contributors in this area. As a result, we&rsquo;ve been able to
expand support to multiple CPU architectures, integrating contributions
from IBM, Intel, Apple, and others, none of which would have been
possible without Sayed. Furthermore, when NumPy tentatively started
using C++ in 2021, Sayed was one of the proponents of the move and
helped with its implementation.</p>
<p>The NumPy Steering Council sees Sayed&rsquo;s appointment to this role as both
recognition of his past outstanding contributions as well as an
opportunity to continue improving NumPy&rsquo;s computational performance. In
the next 12 months, we&rsquo;d like to see Sayed focus on the following:</p>
<ul>
<li>SIMD code maintenance,</li>
<li>code review of SIMD contributions from others,</li>
<li>performance-related features,</li>
<li>sharing SIMD and C++ expertise with the team and growing a NumPy
sub-team around it,</li>
<li>SIMD build system migration to Meson,</li>
<li>and wherever else Sayed&rsquo;s interests take him.</li>
</ul>
<blockquote>
<p><em>&ldquo;I&rsquo;m both happy and nervous: this is a great opportunity, but also a
great responsibility,&rdquo; said Sayed in response to his appointment.</em></p>
</blockquote>
<p>The funds for the NumPy Fellowship Program come from a partnership with
Tidelift and from individual donations. We sincerely thank both
Tidelift and everyone who donated to the project&mdash;without you, this
program would not be possible! We also acknowledge the CPython
Developer-in-Residence and the Django Fellowship programs, which
served as inspiration for this program.</p>
<p>Sayed officially starts as the NumPy Developer in Residence today, 1
December 2022. Already, we are thinking about opportunities beyond
this first year: we imagine &ldquo;in residence&rdquo; roles that focus on
developing, improving, and maintaining other parts of the NumPy
project (e.g., documentation, website, translations, contributor
experience, etc.). We look forward to this exciting new chapter of the
NumPy contributor community and will keep you posted on our progress.</p>
]]></content>
            
                 
                    
                 
                    
                         
                        
                            
                             
                                <category scheme="taxonomy:Tags" term="numpy" label="numpy" />
                             
                                <category scheme="taxonomy:Tags" term="developer-in-residence" label="developer-in-residence" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[NumPy Contributor Spotlight: Mukulika Pahari]]></title>
            <link href="https://blog.scientific-python.org/numpy/mukulikapahari/?utm_source=atom_feed" rel="alternate" type="text/html" />
            
            
                <id>https://blog.scientific-python.org/numpy/mukulikapahari/</id>
            
            
            <published>2022-04-12T00:00:00+00:00</published>
            <updated>2022-04-12T00:00:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<blockquote>An interview with Mukulika Pahari, a NumPy contributor.</blockquote><p>Our first Contributor Spotlight interview is with Mukulika Pahari, our “go-to” person for Numpy documentation.
Mukulika is a Computer Science student at Mumbai University. Her passions outside of
computing involve things with paper, including reading books (fiction!), folding origami, and journaling.
During our interview she discussed why she joined NumPy, what keeps her motivated, and how likely
she would recommend becoming a NumPy contributor.</p>
<h2 id="tell-us-something-about-yourself">Tell us something about yourself.<a class="headerlink" href="#tell-us-something-about-yourself" title="Link to this heading">#</a></h2>
<p>Hi, I am Mukulika. I live in Mumbai, India, and I’m completing my Computer Science degree at Mumbai University.
I joined NumPy last summer during Google Season of Docs. The idea behind this initiative is to raise awareness
of open source, the role of documentation, and the importance of technical writing. It also gives technical
writers an opportunity to gain experience working on open source projects.</p>
<p>Apart from that, I like to read fiction &ndash; literally everything that I can put my hands on &ndash;
and I find it relaxing to learn origami from YouTube tutorials.</p>
<h2 id="what-is-your-role-in-the-numpy-project">What is your role in the NumPy project?<a class="headerlink" href="#what-is-your-role-in-the-numpy-project" title="Link to this heading">#</a></h2>
<p>I write technical documentation for NumPy, and I help new contributors with their questions.</p>
<h2 id="what-are-your-best-and-worst-experiences-contributing-to-numpy-or-other-open-source-projects">What are your best and worst experiences contributing to NumPy or other open source projects?<a class="headerlink" href="#what-are-your-best-and-worst-experiences-contributing-to-numpy-or-other-open-source-projects" title="Link to this heading">#</a></h2>
<p>The best part for me, honestly, is the people. It is inspiring to meet people from diverse backgrounds
all over the world and do something together. However, I do find it quite scary to put your code out
there for &ldquo;the whole world to see and evaluate.&rdquo; It can challenge my confidence. But meeting all
the contributors, seeing their work, and getting their valuable feedback is absolutely worth it.</p>
<h2 id="what-motivated-you-to-join-and-contribute-to-numpywhat-keeps-you-motivated">What motivated you to join and contribute to NumPy?What keeps you motivated?<a class="headerlink" href="#what-motivated-you-to-join-and-contribute-to-numpywhat-keeps-you-motivated" title="Link to this heading">#</a></h2>
<p>Since I already used NumPy in my data analysis courses in school, and now I am using it at my internship,
I thought that I could also contribute to it. It is always more fun to do side projects in a group.
Once you get to know the people in the NumPy community, you want to stay. They are really open and supportive!</p>
<h2 id="what-is-the-book-youve-given-most-as-a-gift-and-why">What is the book you’ve given most as a gift and why?<a class="headerlink" href="#what-is-the-book-youve-given-most-as-a-gift-and-why" title="Link to this heading">#</a></h2>
<p>Well, I do not really give out books to people &ndash; being a broke college student is quite a barrier.
But I think that everyone should read &ldquo;The Hitchhiker&rsquo;s Guide to Galaxy&rdquo; by Douglas Adams. It is
absolutely hilarious! It is both entertaining and spiked with wisdom.</p>
<h2 id="what-small-purchase-has-most-impacted-your-life-recently">What small purchase has most impacted your life recently?<a class="headerlink" href="#what-small-purchase-has-most-impacted-your-life-recently" title="Link to this heading">#</a></h2>
<p>I recently bought a nice journal and started to write in it. I find it very cleansing to put thoughts
on paper and give them structure. I appreciate pretty paper products&ndash;this one has pastel pages.</p>
<h2 id="how-has-a-failure-or-apparent-failure-set-you-up-for-later-success">How has a failure, or apparent failure, set you up for later success?<a class="headerlink" href="#how-has-a-failure-or-apparent-failure-set-you-up-for-later-success" title="Link to this heading">#</a></h2>
<p>I can&rsquo;t think of a specific situation, but, in general, all my experiences so far seem
to follow a general theme: it is absolutely okay not to be great at everything.
You fail, and then you learn for the future.</p>
<h2 id="who-do-you-consider-a-successful-person">Who do you consider a successful person?<a class="headerlink" href="#who-do-you-consider-a-successful-person" title="Link to this heading">#</a></h2>
<p>My definition of success is being happy without causing harm to anyone.</p>
<h2 id="what-advice-would-you-give-someone-at-the-start-of-their-career-what-advice-should">What advice would you give someone at the start of their career? What advice should<a class="headerlink" href="#what-advice-would-you-give-someone-at-the-start-of-their-career-what-advice-should" title="Link to this heading">#</a></h2>
<p>they ignore?
Since I am at the beginning of my career, I can&rsquo;t say much. But I think it is nice
to listen to everyone and get feedback, with the mindset that you do not necessarily have
to act on their advice. Having multiple perspectives is good.</p>
<h2 id="how-likely-you-are-to-recommend-contributing-to-numpy-on-a-scale-of-zero-to-ten">How likely you are to recommend contributing to NumPy on a scale of zero to ten?<a class="headerlink" href="#how-likely-you-are-to-recommend-contributing-to-numpy-on-a-scale-of-zero-to-ten" title="Link to this heading">#</a></h2>
<p>I&rsquo;d say a solid nine! It is overall a great experience.</p>
<h2 id="is-there-something-you-wish-id-asked-but-havent">Is there something you wish I’d asked but haven’t?<a class="headerlink" href="#is-there-something-you-wish-id-asked-but-havent" title="Link to this heading">#</a></h2>
<p>Yes. What I like the most about the NumPy community is that
it does not require huge commitments time-wise. Every little thing is appreciated,
so that is certainly motivating.</p>
]]></content>
            
                 
                    
                 
                    
                         
                        
                            
                             
                                <category scheme="taxonomy:Tags" term="contributor-spotlight" label="contributor-spotlight" />
                             
                                <category scheme="taxonomy:Tags" term="numpy" label="numpy" />
                            
                        
                    
                
            
        </entry>
    
</feed>
