In src/: In Stata zipfile SConstruct config_project.ini utils, saving(project_files, replace)
In folder pypkg.
Requirements (python packages): build (python-build in Anaconda), wheel, setuptools
python -m build
Then you can install from the wheel file (or source distribution) in dist/. Or, to install the package in dev-mode (from this dir)
conda develop src
With pip it would be pip install -e src.
Requirements: twine. API key
Remember: Keep the two package versions the same. Delete old versions from dist/.
python -m twine upload dist/*
Use __token__ for username and token value for password.
If you want to use this package without installing it ("dev" mode), then you need the src folder in the adopath. If you're already in Stata and calling one of our programs then getting that initial call working is easy (see code/setup.do). You want something like
adopath + ../src
But for batch-mode operations (e.g., computing signature from a dta file), started from terminal or Stata, it's a bit trickier and we do this by setting the environment variable before running scons.
For starting scons from the terminal:
- On Linux you can do:
export S_ADO="../src/;UPDATES;BASE;SITE;.;PERSONAL;PLUS;OLDPLACE"
- And on Windows cmd you can do
set S_ADO=../src/;UPDATES;BASE;SITE;.;PERSONAL;PLUS;OLDPLACE
For starting scons from Stata, you'll want to start python and do:
import os
os.environ["S_ADO"] = "../src/;UPDATES;BASE;SITE;.;PERSONAL;PLUS;OLDPLACE"
- In
src/: In Statado buildHelpFiles.do - Then in Python you will need
sphinxandmyst-parser. Copystatacons.md,sconsign.md, andcomplete_datasignature.mdfromsrc/todocsrc/. Then do steps in internal repoCONTRIBUTING.mdand copy those files todocsrc(not currently documented well). Then you can go intodocsrcandmake htmland see the generated docs indocs/_build/html/index.html(things should get copied todocs/).
See tests/README.md.
Check Python code with flake8 and mypy.
Versions are kept the same across both type packages.
- Pass tests?
- In
src/: Bump version + date instatacons.pkgandstatacons.ado(both) andstataconsign.ado(both). - In
pypkg/: Bump versions insetup.cfg,src/pystatacons/__init__.pyand../docsrc/conf.py. - Update
CHANGELOG.md - Build docs
- Make release in in GitHub
- Distrubute Python Package
Look at the functions we override in special_sigs.py::monkey_patch_scons() and revert_io2 in runscons.py.