Skip to content

Commit 9b4d2b3

Browse files
committed
additional files
1 parent 9099691 commit 9b4d2b3

File tree

4 files changed

+617
-80
lines changed

4 files changed

+617
-80
lines changed

.gitignore

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3-
*.py[codz]
3+
*.py[cod]
44
*$py.class
55

66
# C extensions
@@ -27,8 +27,6 @@ share/python-wheels/
2727
MANIFEST
2828

2929
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3230
*.manifest
3331
*.spec
3432

@@ -46,7 +44,7 @@ htmlcov/
4644
nosetests.xml
4745
coverage.xml
4846
*.cover
49-
*.py.cover
47+
*.py,cover
5048
.hypothesis/
5149
.pytest_cache/
5250
cover/
@@ -83,48 +81,18 @@ profile_default/
8381
ipython_config.py
8482

8583
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
84+
.python-version
8985

9086
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# UV
98-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
#uv.lock
87+
Pipfile.lock
10288

10389
# poetry
104-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105-
# This is especially recommended for binary packages to ensure reproducibility, and is more
106-
# commonly ignored for libraries.
107-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108-
#poetry.lock
109-
#poetry.toml
90+
poetry.lock
11091

11192
# pdm
112-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113-
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114-
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115-
#pdm.lock
116-
#pdm.toml
117-
.pdm-python
118-
.pdm-build/
119-
120-
# pixi
121-
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122-
#pixi.lock
123-
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124-
# in the .venv directory. It is recommended not to include this directory in version control.
125-
.pixi
126-
127-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
93+
.pdm.toml
94+
95+
# PEP 582
12896
__pypackages__/
12997

13098
# Celery stuff
@@ -136,7 +104,6 @@ celerybeat.pid
136104

137105
# Environments
138106
.env
139-
.envrc
140107
.venv
141108
env/
142109
venv/
@@ -168,40 +135,13 @@ dmypy.json
168135
# Cython debug symbols
169136
cython_debug/
170137

171-
# PyCharm
172-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174-
# and can be added to the global gitignore or merged into this file. For a more nuclear
175-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
176-
#.idea/
177-
178-
# Abstra
179-
# Abstra is an AI-powered process automation framework.
180-
# Ignore directories containing user credentials, local state, and settings.
181-
# Learn more at https://abstra.io/docs
182-
.abstra/
183-
184-
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186-
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188-
# you could uncomment the following to ignore the entire vscode folder
189-
# .vscode/
190-
191-
# Ruff stuff:
192-
.ruff_cache/
193-
194-
# PyPI configuration file
195-
.pypirc
196-
197-
# Cursor
198-
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199-
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200-
# refer to https://docs.cursor.com/context/ignore-files
201-
.cursorignore
202-
.cursorindexingignore
203-
204-
# Marimo
205-
marimo/_static/
206-
marimo/_lsp/
207-
__marimo__/
138+
# IDE
139+
.vscode/
140+
.idea/
141+
*.swp
142+
*.swo
143+
*~
144+
145+
# OS
146+
.DS_Store
147+
Thumbs.db

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2026 ansh.mn.soni
3+
Copyright (c) 2026 PySTL Contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

PUBLISHING.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Publishing pythonstl to PyPI
2+
3+
This document provides step-by-step instructions for building and publishing the pythonstl package to PyPI.
4+
5+
## Prerequisites
6+
7+
Install required tools:
8+
9+
```bash
10+
pip install --upgrade pip
11+
pip install build twine
12+
```
13+
14+
## Step 1: Clean Previous Builds
15+
16+
Remove any existing build artifacts:
17+
18+
```bash
19+
# Windows PowerShell
20+
Remove-Item -Recurse -Force dist, build, *.egg-info -ErrorAction SilentlyContinue
21+
22+
# Linux/Mac
23+
rm -rf dist build *.egg-info
24+
```
25+
26+
## Step 2: Build the Distribution
27+
28+
Build both source distribution and wheel:
29+
30+
```bash
31+
python -m build
32+
```
33+
34+
This creates:
35+
- `dist/pythonstl-0.1.0.tar.gz` (source distribution)
36+
- `dist/pythonstl-0.1.0-py3-none-any.whl` (wheel)
37+
38+
## Step 3: Validate the Build
39+
40+
Check the distribution files for errors:
41+
42+
```bash
43+
twine check dist/*
44+
```
45+
46+
Expected output:
47+
```
48+
Checking dist/pythonstl-0.1.0-py3-none-any.whl: PASSED
49+
Checking dist/pythonstl-0.1.0.tar.gz: PASSED
50+
```
51+
52+
## Step 4: Test on TestPyPI (Recommended)
53+
54+
### Upload to TestPyPI
55+
56+
```bash
57+
twine upload --repository testpypi dist/*
58+
```
59+
60+
You'll be prompted for credentials. Use:
61+
- Username: `__token__`
62+
- Password: Your TestPyPI API token (starts with `pypi-`)
63+
64+
### Install from TestPyPI
65+
66+
Test the installation:
67+
68+
```bash
69+
pip install --index-url https://test.pypi.org/simple/ pythonstl
70+
```
71+
72+
### Verify Installation
73+
74+
```python
75+
python -c "from pythonstl import vector; v = vector(); v.push_back(1); print('✓ Installation successful')"
76+
```
77+
78+
## Step 5: Publish to Production PyPI
79+
80+
### Using API Token (Recommended)
81+
82+
```bash
83+
twine upload dist/* -u __token__ -p YOUR_PYPI_API_TOKEN
84+
```
85+
86+
**Security Best Practices:**
87+
- Never commit API tokens to version control
88+
- Store tokens in environment variables or password managers
89+
- Use project-scoped tokens when possible
90+
- Rotate tokens periodically
91+
92+
### Using Environment Variable
93+
94+
Set your token as an environment variable:
95+
96+
```bash
97+
# Windows PowerShell
98+
$env:TWINE_PASSWORD = "pypi-YOUR_TOKEN_HERE"
99+
twine upload dist/* -u __token__
100+
101+
# Linux/Mac
102+
export TWINE_PASSWORD="pypi-YOUR_TOKEN_HERE"
103+
twine upload dist/* -u __token__
104+
```
105+
106+
### Using .pypirc (Alternative)
107+
108+
Create `~/.pypirc`:
109+
110+
```ini
111+
[pypi]
112+
username = __token__
113+
password = pypi-YOUR_TOKEN_HERE
114+
```
115+
116+
**Warning:** Ensure `.pypirc` has restricted permissions (chmod 600 on Unix).
117+
118+
Then upload:
119+
120+
```bash
121+
twine upload dist/*
122+
```
123+
124+
## Step 6: Verify Publication
125+
126+
After successful upload:
127+
128+
1. Visit https://pypi.org/project/pythonstl/
129+
2. Install from PyPI:
130+
```bash
131+
pip install pythonstl
132+
```
133+
3. Test the installation:
134+
```python
135+
from pythonstl import stack, queue, vector, stl_set, stl_map, priority_queue
136+
print("✓ All imports successful")
137+
```
138+
139+
## Troubleshooting
140+
141+
### Build Fails
142+
143+
- Ensure `pyproject.toml` is valid
144+
- Check that all package directories have `__init__.py`
145+
- Verify Python version >= 3.10
146+
147+
### Upload Fails
148+
149+
- **403 Forbidden**: Check API token permissions
150+
- **400 Bad Request**: Package name may already exist
151+
- **File already exists**: Version already published (increment version)
152+
153+
### Import Errors After Installation
154+
155+
- Clear pip cache: `pip cache purge`
156+
- Reinstall: `pip uninstall pythonstl && pip install pythonstl`
157+
- Check for naming conflicts with other packages
158+
159+
## Version Management
160+
161+
For future releases:
162+
163+
1. Update version in `pythonstl/__init__.py`
164+
2. Update version in `pyproject.toml`
165+
3. Create git tag: `git tag v0.1.1`
166+
4. Rebuild and republish
167+
168+
## Security Checklist
169+
170+
Before publishing:
171+
172+
- [ ] No hardcoded secrets in code
173+
- [ ] No sensitive data in examples
174+
- [ ] LICENSE file included
175+
- [ ] README.md is accurate
176+
- [ ] All tests pass
177+
- [ ] Version number is correct
178+
- [ ] API token is secure
179+
180+
## Post-Publication
181+
182+
1. Create GitHub release with changelog
183+
2. Update documentation
184+
3. Announce on relevant channels
185+
4. Monitor PyPI download stats
186+
5. Respond to issues and feedback
187+
188+
## Resources
189+
190+
- PyPI: https://pypi.org/
191+
- TestPyPI: https://test.pypi.org/
192+
- Packaging Guide: https://packaging.python.org/
193+
- Twine Documentation: https://twine.readthedocs.io/

0 commit comments

Comments
 (0)