I would say you don’t need a PyMC3 model in this case, just using the formula to update the posterior is enough.
But of course, have the PyMC3 model you can easily extend it to other more complicated model (which might not have conjugate prior and difficult to work out in math), for that, a few tips:
You don’t need to repeatedly define your model (might be slow to always compile the same model especially if it is a large one). For example, you can do the following:
...
# define your model
n = theano.shared(100, dtype=int))
X = theano.shared(50, dtype=float))
with model:
p = pm.Beta('p', alpha=2, beta=2)
y_obs = pm.Binomial('y_obs', p=p, n=n, observed=X)
sample_size = [10, 100, 1000, 10000]
# for loop
for s in sample_size:
n.set_value(s)
X.set_value(np.sum(new_observed_X))
with model:
trace = pm.sample()
# compute HPD.